Re: Steps to switch from Master to standby mode :

From: prakhar jauhari <prak840(at)gmail(dot)com>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: Strahinja Kustudić <strahinjak(at)nordeus(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Steps to switch from Master to standby mode :
Date: 2013-06-04 06:13:16
Message-ID: CAEd0_=-oLvKG+fr+xQf1MXtfYqupO1MJVZTBdJTnYHX4FEHoBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)com>wrote:

> On Mon, Jun 3, 2013 at 9:43 PM, prakhar jauhari <prak840(at)gmail(dot)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
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Kouber Saparev 2013-06-04 11:53:51 Big UPDATE breaking replication
Previous Message Alex Lai 2013-06-03 16:45:09 VACUUM does not update pg_catalog.pg_stat_all_tables views