Understanding timelines

Until now you have seen how to set up a single slave. Basically, having more than just one slave is easy. Just repeat the process that consists of the creation of pg_basebackup and recovery.conf. This is all it takes to create more slaves on the fly. Of course you can also simply clone existing base backups.

Running many slaves in parallel is easy; however, the failover process is not too trivial. For the sake of simplicity, let's assume there is one master and two slaves. What happens if the master dies? The answer is nothing. PostgreSQL does not care. Those two slaves will try to reconnect again and again but otherwise nothing will happen—there is no automatic failover process.

Your task is to elect a new master and make ...

Get PostgreSQL Administration Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.