Postgresql replication: How to convert the old master to the new slave
Hi, I followed this tutorial (https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-on-postgresql-on-an-ubuntu-12-04-vps#configure-the-slave-server) to create a replication scheme between to postgresql servers (v9.5 on Ubuntu 16.04).
The only difference is that for the initial database replication I used this:
sudo -u postgres pg_basebackup -h 22.214.171.124 -D /var/lib/postgresql/9.5/main -U [username] -v -P -x
Then I tried to test the failover process.
- I stopped the master server
- I 'touched' the trigger file on the Server to make it read-write (it worked)
- Added some test data on the Slave's (now Master) database (it worked)
- I switched to the old master server and (a) did a pg_basebackup from the new master and (b) created a recovery.conf file (ir worked)
- restarted the new slave (no problems)
However whatever change I make on the new Master, it won't be coped to the new slave. Also the new slave is not read-only.
Can someone explain to me what did I do wrong?