Re: Speed up Switchover

From: Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>
To: TJ <tj(at)wallago(dot)co(dot)uk>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Speed up Switchover
Date: 2013-07-26 05:00:23
Message-ID: CAL_0b1s-FgebjVKMH9RsPGgyGam_8Bxp7_s8fRTJVTterHrsNA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jul 25, 2013 at 1:03 AM, TJ <tj(at)wallago(dot)co(dot)uk> wrote:
> I am looking for a way of speeding up the process of switching over of
> severs.
> At the moment we are switching over via the trigger file, reconfiguring our
> applications, patching or updating the old primary and rsyncing the data
> over to the old primary.
>
> I was wondering if there was an easier way to get the primary setup as a
> secondary without having to rsync the data as it can take up to 10 hours.

pg_rewind (https://github.com/vmware/pg_rewind) is what you need.

From its 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.

--
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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Atri Sharma 2013-07-26 05:16:08 Re: Tablespace on Postgrsql
Previous Message devonline 2013-07-26 01:51:48 Re: Tablespace on Postgrsql