Postgresql – Postgres read from master after slave failure

postgresql

I'm new to postgres and have setup a master:slave database. Everywhere I look I see slave promoting to master failover, but what I can't seem to find anywhere is what happens if the slave fails.

How do I make the queries select the right master/slave db incase the slave has gone down? I'm using pgbouncer for my connection manager for each instance. Should I be using something different?

Best Answer

Usually the replica server is used for HA (that's why everyone is talking about promoting it) and for read scaling. From your question it seems you're interested in the later. As you use the replica for read scaling, you can use any load balancer to spread the read load between the master and slave. If the slave goes down, most load balancers will stop sending traffic to it.