Re: WAL scenario valid?

From: Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>
To: prakhar jauhari <prak840(at)gmail(dot)com>
Cc: Keith Ouellette <Keith(dot)Ouellette(at)airgas(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: WAL scenario valid?
Date: 2013-06-19 20:06:11
Message-ID: CAL_0b1tq=hEPX4FyNRpK90TKoXaucc41EcydD0vZ7_bBauPygQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Tue, Jun 18, 2013 at 11:20 PM, prakhar jauhari <prak840(at)gmail(dot)com> wrote:
> When a switchover happens DB2 becomes the new master and when DB1 comes up
> it will act as the standby to the new master (.history files from new master
> are copied to DB1 to bump up its timeline so as to setup SR). DB1 is not
> recreated from scratch. This runs fine in normal switchover, but there seems

I am not sure this works fine. You have probably got some silent
corruption on db1.

What you need is to resync db1 from db2. You can do it either the
canonical way, base backup with pg_basebackup or rsync, or using
pg_rewind.

From pg_rewind docs:

pg_rewind is a tool for synchronizing a PostgreSQL data directory with another
PostgreSQL data directory that was forked from the first one. The result is
equivalent to rsyncing the first data directory (referred to as the old cluster
from now on) with the second one (the new cluster). The advantage of pg_rewind
over rsync is that pg_rewind uses the WAL to determine changed data blocks,
and does not require reading through all files in the cluster. That makes it
a lot faster when the database is large and only a small portion of it differs
between the clusters.

https://github.com/vmware/pg_rewind

--
Kind regards,
Sergey Konoplev
PostgreSQL Consultant and DBA

Profile: http://www.linkedin.com/in/grayhemp
Phone: USA +1 (415) 867-9984, Russia +7 (901) 903-0499, +7 (988) 888-1979
Skype: gray-hemp
Jabber: gray(dot)ru(at)gmail(dot)com

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Marcos Cano 2013-06-19 20:21:48 Re: pg_upgrade issue
Previous Message Craig James 2013-06-19 19:48:15 Re: Why sequence grant is separated from table?