From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | Dave Johansen <davejohansen(at)gmail(dot)com> |
Cc: | pgsql-admin(at)postgresql(dot)org |
Subject: | Re: Setting up streaming replication with new server as master? |
Date: | 2016-02-05 20:27:29 |
Message-ID: | 20160205202729.GZ3331@tamriel.snowman.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
* Dave Johansen (davejohansen(at)gmail(dot)com) wrote:
> We would like to start using streaming replication, but the catch is that
> we want the new server to be the master. The server is still in use and
> receiving new data, so we would like to minimize down time, and I would
> prefer to be able to copy all, or at least the large majority of the data
> to the new server before doing the final sync to make it the master.
>
> Will pg_basebackup work?
Partially.
> Can it be run multiple times? (i.e. start it now to copy all of the data
> over the weekend and then a second time on Monday before doing the switch)
No.
> Do I need to manually copy the files with rsync?
I wouldn't suggest rsync, unless you do it when the database is shut
down and you checksum the files.
> What's the recommended way to handle this?
I'd suggest pg_basebackup and then set up the new system as a follower
of the primary using a recovery.conf. When you shut down the current
server, all of the WAL changes should be streamed over to the new server
and then you can trigger it to become a read/write master, once it has
the last of the WAL from the current server, and then you can just
redirect new connections to it, or flip it into place by giving it the
new IP, etc.
If you want to do actual incremental backups as you were thinking
pg_basebackup might do, you could use pgBackRest, which does support
that.
Thanks!
Stephen
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Johansen | 2016-02-05 20:44:42 | Re: Setting up streaming replication with new server as master? |
Previous Message | Dave Johansen | 2016-02-05 20:13:31 | Setting up streaming replication with new server as master? |