From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Craig James <cjames@emolecules.com>
To: pgsql-admin@postgresql.org
Subject: Re: Reversing pg_logical replication
Date: Tue, 25 Sep 2018 19:53:49 +0200
Message-ID: <64b2d16e-6c7c-002a-1e16-209a3ae43bef@2ndquadrant.com> (raw)
In-Reply-To: <CAFwQ8rdGB-jUPtrDXpp-gMgS8guWg8SWSkBjkXy0San3rmvj8w@mail.gmail.com>
References: <CAFwQ8rdGB-jUPtrDXpp-gMgS8guWg8SWSkBjkXy0San3rmvj8w@mail.gmail.com>
On 21/09/2018 17:21, Craig James wrote:
> I dug around on the web for comments and tools about how to reverse the
> master/slave relationship of a pg_logical publisher/subscriber pair
> without having to start fresh and re-copy all the data. All I found were
> several discussions that seemed to say, "You can't do it. You have to
> promote the subscriber to publisher, then blow off the original
> publisher's tables, make it a subscriber, and start from scratch."
>
> But the create-subscription SQL has a "with (copy_data = false)", which
> seems to do exactly what I need. So I tried it, and it works fine.
This works as long as both nodes are in sync and no one is writing to
either of them while you do these changes.
The hard part is doing it while both nodes are active.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
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: peter.eisentraut@2ndquadrant.com, cjames@emolecules.com
Subject: Re: Reversing pg_logical replication
In-Reply-To: <64b2d16e-6c7c-002a-1e16-209a3ae43bef@2ndquadrant.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