You can use pgpool to do this. Or you can use failover manager byenterpriseDB.
RegardsSameer
PS: Sent from my Mobile device. Pls ignore typo n abb