Reusing an old master (as slave) after a switchover
Todays blogpost is old news but it's not very well known and it has to do with how to add an old master after a slave has been promoted. Fujii Masao explained the situation in his patch back in the day. So in todays post i will be demonstrating a combination of replication slots for retaining the writes on a promoted slave and how to re-introduce an old master to the replication. Say that we have a master-slave setup, stop the master gracefully and create and activate a replica slot on the slave : monkey=# SELECT * FROM pg_create_physical_replication_slot('this_is_a_replica_slot'); slot_name | xlog_position ------------------------+--------------- this_is_a_replica_slot | (1 row) postgres@bf9823730feb:~$ pg_receivexlog -D . -S this_is_a_replica_slot -v -h 10.0.0.3 -U repuser pg_receivexlog: starting log streaming at 0/4000000 (timeline 1) ^C pg_receivexlog: received interrupt signal, exiting pg_recei...