To use pg_recvlogical, you must first configure a replication connection in pg_hba.conf.
For PostgreSQL 9.4, 9.5, 9.6:
local replication myuser trust
For PostgreSQL 10 or later:
local mydatabase myuser trust
Ensure max_wal_senders is set to at least 1 in postgresql.conf and restart PostgreSQL.
Usage Example:
- Create a slot:
$ pg_recvlogical -d postgres --slot test_slot --create-slot -P wal2json
- Start streaming with options:
$ pg_recvlogical -d postgres --slot test_slot --start -o pretty-print=1 -o add-msg-prefixes=wal2json -f -
- Drop the slot when finished:
$ pg_recvlogical -d postgres --slot test_slot --drop-slot
$ pg_recvlogical -d postgres --slot test_slot --create-slot -P wal2json
$ pg_recvlogical -d postgres --slot test_slot --start -o pretty-print=1 -o add-msg-prefixes=wal2json -f -