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 1.2.3.4 -D /var/lib/postgresql/9.5/main -U [username] -v -P -x
Then I tried to test the failover process.
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?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
It’s possible that there may be an issue with your replication configuration. Here are some things you can check:
Check the postgresql.conf and pg_hba.conf files on both the master and slave servers to ensure that they are properly configured for replication.
Check the log files on both servers to see if there are any error messages related to replication.
Check the replication status by running the following command on the master server:
SELECT * FROM pg_stat_replication;
This will show you if the slave server is connected and if replication is currently running.
Check that the replication slot is still active by running the following command on the master server:
SELECT * FROM pg_replication_slots;
If the slot is not active, you may need to recreate it on the new master.
Make sure that the WAL files are being properly archived and streamed to the slave server. You can check the pg_xlog directory on the master to see if new WAL files are being generated, and the pg_wal directory on the slave to see if they are being properly received.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.