pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: Scott Marlowe <scott.marlowe@gmail.com>
Cc: Wells Oliver <wellsoliver@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Setting up streaming replication w/ a big ole database
Date: Tue, 10 Apr 2012 15:11:10 -0400
Message-ID: <13762.1334085070@sss.pgh.pa.us> (raw)
In-Reply-To: <4F843A7D0200002500046D87@gw.wicourts.gov>
References: <CAOC+FBWhe2dMU8ZUv2HT8YjrPvB38A2NpBwqwoyEB_iXhxqv4g@mail.gmail.com>
	<CAOR=d=0GatiMKwExHOXsoU67Nv_mYacYx2arTZRNLaXdEc1YpA@mail.gmail.com>
	<CAOC+FBUeAUw5J7EUzJH2-RyZUGxAJCXpcDJ5C=G-3n_hS0+B2g@mail.gmail.com>
	<4F843A7D0200002500046D87@gw.wicourts.gov>

"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> Wells Oliver <wellsoliver@gmail.com> wrote:
>> I admit to being scared as crap of rsync'ing a live database to
>> another server. Like chills are running down my spine even typing
>> it. Is this an approved, safe thing?
 
> It is fine, as long as you're doing it between the pg_start_backup()
> and pg_stop_backup() calls.  We do it on 100 production databases
> every week.  It is approved, documented, and safe.

Right.  It is true that the rsync alone will not give you a consistent
copy if the database is actively being modified.  The secret sauce is
in having a copy of all the WAL that was generated while the rsync
happened.  Replaying that against the copied data will apply (or
reapply) any changes that occurred meanwhile, thus fixing the
inconsistencies.

(I find that people are much more likely to believe that this works
once they grasp the principle.)

			regards, tom lane



view thread (6+ messages)

Message-ID: <13762.1334085070@sss.pgh.pa.us>
Permalink:  ../13762.1334085070@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/13762.1334085070@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, Kevin.Grittner@wicourts.gov, scott.marlowe@gmail.com, wellsoliver@gmail.com
  Subject: Re: Setting up streaming replication w/ a big ole database
  In-Reply-To: <13762.1334085070@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox