PostgreSQL configuration for BDR v4
Several PostgreSQL configuration parameters affect BDR nodes. You can set these parameters differently on each node, although that isn't generally recommended.
PostgreSQL settings for BDR
BDR requires these PostgreSQL settings to run correctly:
wal_level
— Must be set tological
, since BDR relies on logical decoding.shared_preload_libraries
— Must containbdr
, although it can contain other entries before or after, as needed. However, don't includepglogical
.track_commit_timestamp
— Must be set toon
for conflict resolution to retrieve the timestamp for each conflicting row.
BDR requires these PostgreSQL settings to be set to appropriate values, which vary according to the size and scale of the cluster.
logical_decoding_work_mem
— Memory buffer size used by logical decoding. Transactions larger than this overflow the buffer and are stored temporarily on local disk. Default is 64 MB, but you can set it much higher.max_worker_processes
— BDR uses background workers for replication and maintenance tasks, so you need enough worker slots for it to work correctly. The formula for the correct minimal number of workers, for each database, is:- One per PostgreSQL instance plus
- One per database on that instance plus
- Four per BDR-enabled database plus
- One per peer node in the BDR group plus
- One for each writer-enabled per peer node in the BDR group You might need more worker processes temporarily when a node is being removed from a BDR group.
max_wal_senders
— Two needed per every peer node.max_replication_slots
— Same asmax_wal_senders
.wal_sender_timeout
andwal_receiver_timeout