Reputation: 139
I am new to PostgreSQL. I am trying to implement logical replication in PostgreSQL installed in my laptop.
When I run the following query to create a replication slot, I am getting
could not access file wal2json: no such file or directory
SELECT * FROM pg_create_logical_replication_slot('test_slot', 'wal2json');
After a search in google, I understand that wal2json is an additional extension kind of thing which needs to be setup separately.
Does anyone have an idea how to setup "wal2json" in PostgreSQL installed on a local laptop (Windows OS)?
Upvotes: 1
Views: 4288
Reputation: 18059
You can find the binaries for wal2json here: https://www.striim.com/docs/smsgc/en/smsgc-how-to-guides/postgresql-to-google-cloud-postgresql-migration-guide/set-up-the-postgresql-source.html
(They're provided by a third-party, Striim, but the company appears legit, so I'm not concerned by it.)
After downloading, copy the dll file into the C:\Program Files\PostgreSQL\VERSION\lib
folder, and restart PostgreSQL.
EDIT: Actually, on attempting to use the wal2json extension from NodeJS, it appears something is incompatible between the prebuilt Windows 10 binary above, and my Postgres install. I get the following error in Postgraphile:
Could not Initiate PgLDSSourcePlugin, continuing without LDS live queries. Error: Couldn't create replication slot, seems you don't have wal2json installed? Error: could not load library "C:/Program Files/PostgreSQL/13/lib/wal2json.dll": The specified procedure could not be found.
So in the end I had to compile the dll myself, as the wal2json readme specifies. (I was getting a compilation error, so I tried upgrading Visual Studio from 2015 to 2019. Once I did so, the build completed easily however. I just opened the wal2json.vcxproj
file, pressed Build->Build wal2json
, then copied the dll file it produced into the PostgreSQL lib
folder.)
Upvotes: 0
Reputation: 1518
wal2json is a plugin (not an extension) that needs to be installed separately. The README.md file has some info about installing it for Windows. I think that you will have an easier time installing and managing PostgreSQL and the plugin inside a Linux virtual machine.
Upvotes: 1