Closed vitabaks closed 1 month ago
Vars:
patroni_slots:
- slot: "logical_replication_slot"
type: "logical"
plugin: "pgoutput"
database: "postgres"
Result:
--check slot on Primary
postgres=# select * from pg_replication_slots where slot_type = 'logical'\gx
-[ RECORD 1 ]-------+-------------------------
slot_name | logical_replication_slot
plugin | pgoutput
slot_type | logical
datoid | 5
database | postgres
temporary | f
active | f
active_pid |
xmin |
catalog_xmin | 733
restart_lsn | 0/172B808
confirmed_flush_lsn | 0/172B840
wal_status | reserved
safe_wal_size |
two_phase | f
conflicting | f
--check slot on Replica
postgres=# select * from pg_replication_slots where slot_type = 'logical'\gx
-[ RECORD 1 ]-------+-------------------------
slot_name | logical_replication_slot
plugin | pgoutput
slot_type | logical
datoid | 5
database | postgres
temporary | f
active | f
active_pid |
xmin |
catalog_xmin | 733
restart_lsn | 0/172B808
confirmed_flush_lsn | 0/172B840
wal_status | reserved
safe_wal_size |
two_phase | f
conflicting | f
patronictl show-config
loop_wait: 10
master_start_timeout: 300
maximum_lag_on_failover: 1048576
postgresql:
parameters:
...
use_pg_rewind: true
use_slots: true
retry_timeout: 10
slots:
logical_replication_slot:
database: postgres
plugin: pgoutput
type: logical
synchronous_mode: false
synchronous_mode_strict: false
synchronous_node_count: 1
ttl: 30
passed
Add the ability to define permanent replication slots.
patroni_slots
(by default, the value is not defined)Example:
These slots will be preserved during switchover/failover. Permanent slots that don’t exist will be created by Patroni.
How it works:
With PostgreSQL 11 onwards permanent physical slots are created on all nodes and their position is advanced every loop_wait seconds. For PostgreSQL versions older than 11 permanent physical replication slots are maintained only on the current primary. The logical slots are copied from the primary to a standby with restart, and after that their position advanced every loop_wait seconds (if necessary). Copying logical slot files performed via libpq connection and using either rewind or superuser credentials.
Doc: https://patroni.readthedocs.io/en/latest/dynamic_configuration.html
Additionally