From: Gerhard Hintermayer <gerhard.hintermayer@gmail.com>
To: rd <rudi.pettazzi@kemen.it>
To: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: Streaming replication: rsync to switchover
Date: Tue, 19 Apr 2011 10:09:04 +0200
Message-ID: <BANLkTikrqROJjNiVpmkZorkPM7nUYHZUAw@mail.gmail.com> (raw)
In-Reply-To: <4DAC7205.8080203@kemen.it>
References: <4DAC7205.8080203@kemen.it>
Hi, I do rsync -a --delete new_primary_server::postgresql-data/
/var/lib/postgresql/9.0/data/
Take care to use -a, I had -r and wondered, why the rsync took so long,
despite the data was nearly the same.
assuming you have configured rsyncd on the server as:
[postgresql-data]
uid = postgres
path = /var/lib/postgresql/9.0/data
comment = PostgreSQL 9.0 data dir
exclude = postmaster.log pg_xlog/* postmaster.pid postgresql.conf
The exclude might be tunable a litte (the confs eg. are not stored in the
datadir anymore on my distro)
Always rsync over the existing data dir (of course stop server before)
The former master can also be stopped later. When the trigger file is
created, the connection to it is closed anyhow.
Don't forget to pg_start_backup pg_stop_backup on the new server
before/after you do rsync.
Gerhard
On Mon, Apr 18, 2011 at 7:16 PM, rd <rudi.pettazzi@kemen.it> wrote:
> Hi,
>
> I've setup streaming replication + file-based log-shipping, with a
> hot-standby.
>
> Everything's good, except I don't know which is the correct way to sync the
> once-master db with the newly promoted master after a switchover,
>
> 1) I shutdown the master and touch the trigger_file on the slave. Now the
> slave becomes the master.
> 2) On the old-master I create recovery.conf + archive directory for
> file-based log-shipping.
> 3) I hope I can setup the old-master with a simple rsync, because the
> operation could be really fast, being M and S almost identical, but I'm not
> sure about the correct way to rsync them:
>
> a) should I rsync --delete?
> b) should I delete the pg_xlog of the old master, before rsyncing? (I'm
> wondering what could happen if some of them never made its way to the slave,
> that now has become new-master)
> c) am I missing something? For example, I've read somewhere that one should
> copy pg_control and pg_stat from the old slave to the new slave but it
> doesn't make sense to me.
>
>
> thanks for any hint,
>
>
> --
> rudi pettazzi
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: gerhard.hintermayer@gmail.com, rudi.pettazzi@kemen.it
Subject: Re: Streaming replication: rsync to switchover
In-Reply-To: <BANLkTikrqROJjNiVpmkZorkPM7nUYHZUAw@mail.gmail.com>
References: <4DAC7205.8080203@kemen.it> <BANLkTikrqROJjNiVpmkZorkPM7nUYHZUAw@mail.gmail.com>
* 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