4

Master (10.0.0.1):

Edit postgresql.conf

listen_addresses = '*'
wal_level = logical
max_wal_senders = 3
max_replication_slots = 3
hot_standby = on

Edit pg_hba.conf

host    replication     postgres    0.0.0.0/0   trust

Create a replication slot for the slave

select * from pg_create_physical_replication_slot('master');

Slave #1 (10.0.0.2):

Remove 9.4/main directory

rm -rf /var/lib/postgresql/9.4/main

Do a base backup of the master

pg_basebackup -P -R -X stream -c fast -h 10.0.0.1 -U postgres -D /var/lib/postgresql/9.4/main

Edit recovery.conf

standby_mode = 'on'
primary_conninfo = 'user=postgres host=10.0.0.1 sslmode=prefer sslcompression=1 krbsrvname=postgres'
primary_slot_name = 'master'

Copy conf files from master

rsync -av [email protected]:/etc/postgresql/ /etc/postgresql/

Restart cluster

pg_ctlcluster 9.4 main restart

Slave #2 (10.0.0.3):

Same steps as for slave #1 except the ip of the slave is different.

The problem: A change on the master propagates the change onto slave #1 but not slave #2. Tried rebooting slave #2 and setting up again from a fresh install but still doesn't work. Any ideas?

Thanks!

0

1 Answer 1

3

Community Wiki answer generated from a comment left by the question author. Feel free to edit to improve

Nevermind, I fixed it. There needs to be one replication slot per slave. I added another replication slot "master2". So slave #1 is using the "master" replication slot and slave #2 is using the "master2" replication slot. Works fine now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.