Re: Steps to switch from Master to standby mode : - Mailing list pgsql-admin

From prakhar jauhari
Subject Re: Steps to switch from Master to standby mode :
Date
Msg-id CAEd0_=-oLvKG+fr+xQf1MXtfYqupO1MJVZTBdJTnYHX4FEHoBA@mail.gmail.com
Whole thread Raw
In response to Re: Steps to switch from Master to standby mode :  (Amit Langote <amitlangote09@gmail.com>)
List pgsql-admin
Hey,

Using these steps to for archiving and HA:

Node1 : current master ......         Node2 : current standby


On master  in (postgresql.conf):

archive_mode = on
archive_command = 'test ! -f /data/pgsql/archivedir/%f && cp %p /data/pgsql/archivedir/%f'
archive_timeout = 3600

Note : I sync /data/pgsql/archivedir/ between master and standby using rsync.

On standby in (recovery.conf):

standby_mode = 'on'
primary_conninfo = 'host=<MASTER IP> port=5432 user=replicationuser'
trigger_file = '/tmp/pg_failover_trigger'
restore_command = 'cp /data/pgsql/archivedir/%f %p'
recovery_target_timeline = 'latest'

So when a switchover happens,

Node1 = new standby .......         Node2 = new master.

On Node1 :
1. I stop postgres.
2. Update postgresql.conf to remove archiving settings.
3. Place recovery.conf in data cluster.
5. Forcefully sync /data/pgsql/archivedir/ from Node2. (To get 0000000x.history file in Node1 archives).
4. And restart postgres.

So Node1 comes up in Standby mode now.
It connects Streaming Replication with Node2.
But then breaks the SR connection giving above errors.

One doubt that i have is, that when Node1 comes up it has all the archives (including that it generated when Node1 was master) when it comes up in standby mode.
Is that a problem?

Please let me know the problem with this approach.


regards,
Prakhar.



On Mon, Jun 3, 2013 at 7:46 PM, Amit Langote <amitlangote09@gmail.com> wrote:
On Mon, Jun 3, 2013 at 9:43 PM, prakhar jauhari <prak840@gmail.com> wrote:

>
> and they just continue like this.
> Please help me with the reason for this issue.
>

Can you provide exact steps you have used "to setup up Master to
standby switch"? That might help reproducing the problem and provide
some pointers as to what is happening.


--
Amit Langote

pgsql-admin by date:

Previous
From: Alex Lai
Date:
Subject: VACUUM does not update pg_catalog.pg_stat_all_tables views
Next
From: Kouber Saparev
Date:
Subject: Big UPDATE breaking replication