Category: Database

When someone is asked to configure a PostgreSQL slave replica, the first thing that get’s done usually is “Googling It”, then clicking on the first title that sounds like a good How-To article without paying any attention to the subtle details that could make a huge difference between building a sloppy slave replica and a resilient one. This recipe focuses on building a resilient setup for a Slave replica of a Master of any size and band-width usage and applies safety margins into the configuration in case a slave lag or conflict gets introduced (arising from any unexpected conditions).

Now, we need to create the replica_user on the master node, this user will be used by the slave node to connect for streaming replication.

But first delete the contents of the current directory: Then run the command to perform the base backup: In case the master node is serving a live system and is under heavy load, you can (and would be advised to) limit the transfer rate between the master and the slave so as not to affect the responsiveness of the live master node.

Just make sure that port 5432 is open on the master node for the slave node IP address to connect from.

Related Articles