Thread: Replication rolling back to normal.

Replication rolling back to normal.

From
Dasitha Karunajeewa
Date:
Dear Team,

I have installed PostgreSQL 9.6 on two servers. One is master and other is for slave server. Current setup as follows.

  • Master Server - pgmaster
  • Salve Server - pgslave                 
To implement this I have followed this article https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-on-postgresql-on-an-ubuntu-12-04-vps

Master Slave combination is working fine. 

when I create a file at the file trigger location ex: /tmp/postgresql.trigger.5432 on pgslave server, it started accepting read and as well as write request which is perfectly correct.

What I want to know is how to switch them back to the normal status. That means pgmaster need to be the Master server which acept the writed and pgslave that accepts only reads along with the replication.


Regards,

Dasitha.

Re: Replication rolling back to normal.

From
Michael Paquier
Date:
On Fri, Oct 21, 2016 at 10:10 PM, Dasitha Karunajeewa
<dasitha@duosoftware.com> wrote:
> What I want to know is how to switch them back to the normal status. That
> means pgmaster need to be the Master server which acept the writed and
> pgslave that accepts only reads along with the replication.

If your promoted standby got ahead of the former master, you could use
the promoted standby as a new master, and replug the former master as
a standby. The latter step can be done by either running pg_rewind on
the former masfer or taking a new base backup from the promoted
standby and use that to set up a new standby. pg_rewind will be
successful to run only if the master has kept WAL segments from the
last checkpoint record where WAL forked when standby has been
promoted.
--
Michael


Re: Replication rolling back to normal.

From
Michael Paquier
Date:
On Mon, Oct 24, 2016 at 2:20 PM, Dasitha Karunajeewa
<dasitha@duosoftware.com> wrote:
> Hi Michael,
>
> Thanks a lot for the information. I am totally new to Postgres clustering. I
> have follow up the below-attached article.
>
https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-on-postgresql-on-an-ubuntu-12-04-vps
>
> Can u guide me on how to do it as u mentioned :)

Documentation is your best friend:
https://www.postgresql.org/docs/9.6/static/high-availability.html
--
Michael