Postgresql – changing server roles in streaming replication

failoverpostgresqlpostgresql-9.2replication

I want to implement streaming replication using postgresql-9.2.4 in my reporting application. I came stuck on the below scenario.

  1. create master and slave with synchronous replication which is working fine.
  2. then I brought down master and brought up slave as master using trigger file on slave side manually.
  3. fired log in new master which is working fine.

Now my question is that how can I bring up the old master as slave so that it points to new master without taking base backup or using rsync?

My reporting application will contain large data (approx 50 TB) and more. If I take base backup or rsync feature it will surely take more time to sync old master to new master .

Is there any other way or third party tool which help me to avoid base backup?

Best Answer

Unforutnatley, you cannot do this without taking a new base backup. This is something being worked on, but at this point repointing the slave is not supported.

There exists a tool called pg_rewind, but there are definite cornercases where that one does not work properly, so it's quite a risky way.

For now, doing a basebackup/rsync is the supported method for this.