Initing a new replica

From: Cody Cutrer <cody(at)instructure(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Initing a new replica
Date: 2012-06-27 04:04:50
Message-ID: CA+=qeWvZhX=Jg3uAE6vU-x4vEYL_hA1fGTHwqGG2_+jbZ-3BTA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I've got a few questions about initing a new replica. We have a
modestly large DB cluster with a master and two replicas running with
streaming replication. We tend to switch which one is the master
fairly often, shuffling hardware, upgrading kernels, etc. However,
every time we fail over, we have to re-init the old master as a new
replica from scratch using pg_basebackup. pg_basebackup's
documentation mentions copying the basebackup from one replica to
another, but doesn't really go into details. So I'm wondering if any
of the following would be valid ways to get the old master acting as a
replica against the new master more quickly:

* Assuming the old master stops prior to the new master exiting
recovery, and there is no timeline divergence, simply copying the
.history file from pg_xlogs, creating a recovery.conf, and starting
postgres (this is similar to how we change the non-participating
replica to stream from the new master instead of the old master - copy
the .history file, alter recover.conf, and restart postgres)
* Instead of using pg_basebackup, manually call pg_start_backup and
pg_stop_backup against the new master, and rsync the data over, since
presumably little has changed since a timeline divergence
* Instead of using pg_basebackup, manually call pg_start_backup and
pg_stop_backup (against the new master? or the non-participating
slave? not necessary?), and rsync or raw copy the data over from the
non-participating slave, reducing load on the new master.

Thanks for any help,

Cody Cutrer

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2012-06-27 04:29:10 Re: Initing a new replica
Previous Message Josh Kupershmidt 2012-06-27 01:02:14 psql pager, and searching for function arguments