Re: pg_upgrade and rsync

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_upgrade and rsync
Date: 2015-01-29 17:09:58
Message-ID: 54CA6966.90700@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 01/29/2015 11:34 AM, Bruce Momjian wrote:
> On Thu, Jan 29, 2015 at 10:21:30AM -0500, Andrew Dunstan wrote:
>> On 01/29/2015 12:26 AM, Josh Berkus wrote:
>>>> So, for my 2c, I'm on the fence about it. On the one hand, I agree,
>>>> it's a bit of a complex process to get right. On the other hand, it's
>>>> far better if we put something out there along the lines of "if you
>>>> really want to, this is how to do it" than having folks try to fumble
>>>> through to find the correct steps themselves.
>>> So, here's the correct steps for Bruce, because his current doc does not
>>> cover all of these. I really think this should go in as a numbered set
>>> of steps; the current doc has some steps as steps, and other stuff
>>> buried in paragraphs.
>>>
>>> 1. Install the new version binaries on both servers, alongside the old
>>> version.
>>>
>>> 2. If not done by the package install, initdb the new version's data
>>> directory.
>>>
>>> 3. Check that the replica is not very lagged. If it is, wait for
>>> traffic to die down and for it to catch up.
>>>
>>> 4. Shut down the master using -m fast or -m smart for a clean shutdown.
>>> It is not necessary to shut down the replicas yet.
>>>
>>> 5. pg_upgrade the master using the --link option. Do not start the new
>>> version yet.
>>>
>>> 6. create a data directory for the new version on the replica. This
>>> directory should be empty; if it was initdb'd by the installation
>>> package, then delete its contents.
>>>
>>> 7. shut down postgres on the replica.
>>>
>>> 8. rsync both the old and new data directories from the master to the
>>> replica, using the --size-only and -H hard links options. For example,
>>> if both 9.3 and 9.4 are in /var/lib/postgresql, do:
>>>
>>> rsync -aHv --size-only -e ssh --itemize-changes /var/lib/postgresql/
>>> replica-host:/var/lib/postgresql/
>>>
>>> 9. Create a recovery.conf file in the replica's data directory with the
>>> appropriate parameters.
>>>
>>> 10. Start the master, then the replica
>>>
>>>
>> I find steps 2 and 6 confusing.
> For number 2, he is creating a new cluster on the master server. For
> #6, he is just creating an empty data directory, though this is not
> required as rsync will create the directory for you.
>

Then step 2 should specify that it's for the master.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-01-29 17:10:58 Re: jsonb, unicode escapes and escaped backslashes
Previous Message Robert Haas 2015-01-29 17:01:40 Re: Parallel Seq Scan