Quick question. I have a 2 node cluster - each node has its own ip.
But from reading this, I really need a 3rd ip, which potentially floats between the nodes to which ever is the master / rw node.
Is that right? Sort of makes sense I guess
That's one way to solve that problem. If you are using repmgr/repmgrd you can call own commands on events like failover. And, if you are using pgbouncer or connection-pooling you can change the config for pgbouncer (redefine the databases and there connection strings) and reload pgbouncer. You can do that with the event-notification commands defined in your repmgr-config. Other solution: with some Java-drivers you can define several databases and checks (if the database read-only or rw), the next PostgreSQL 10 will offer a similar feature.
okay think I have it setup, but when i do a switch over it gets stuck here.
NOTICE: STANDBY PROMOTE successful
NOTICE: Executing pg_rewind on old master server
NOTICE: 3 files copied to /var/lib/pgsql/9.6/data
NOTICE: restarting server using '/usr/pgsql-9.6/bin/pg_ctl -w -D /var/lib/pgsql/9.6/data -m fast restart'
pg_ctl: PID file "/var/lib/pgsql/9.6/data/postmaster.pid" does not exist
NOTICE: STANDBY PROMOTE successful
NOTICE: Executing pg_rewind on old master server
NOTICE: 5 files copied to /var/lib/postgresql/9.5/data
NOTICE: restarting server using '/usr/local/bin/pg_ctl -w -D /var/lib/postgresql/9.5/node_1/data -m fast restart'
pg_ctl: PID file "/var/lib/postgresql/9.5/node_1/data/postmaster.pid" does not exist
Is server running?
starting server anyway
NOTICE: node 1 is replicating in state "streaming"
NOTICE: switchover was successful