From: Martín Marqués <martin.marques@2ndquadrant.com>
To: Adrian Klaver <adrian.klaver@aklaver.com>
To: Olivier Gautherot <olivier@gautherot.net>
Cc: pgsql-general@postgresql.org
Subject: Re: Fast logical replication jump start with PG 10
Date: Sat, 26 May 2018 15:13:45 -0300
Message-ID: <37f124de-5346-263a-01b9-f593673a3c43@2ndquadrant.com> (raw)
In-Reply-To: <67e76903-b1fb-5a43-4b83-4f721ae2e1b0@aklaver.com>
References: <CAJ7S9TVygExihaXt2E1bNH_0kGnx8bA62fmGreDGWTwb3_Pi7g@mail.gmail.com>
<729c1726-2e61-f03f-fe7e-c1dcf3f59e85@aklaver.com>
<CAJ7S9TWdYCi-FBhB4a5=gf7TfdZ=z6B+4wAQLAEJzZtoa0V3LA@mail.gmail.com>
<239dddd5-aa45-a7fe-b35a-085b978f8bd6@aklaver.com>
<CAJ7S9TUZJfcYEqQOxiLEy7d05NHfG7N0AyZYsG-4ngvb9PwLAQ@mail.gmail.com>
<67e76903-b1fb-5a43-4b83-4f721ae2e1b0@aklaver.com>
Hi,
El 26/05/18 a las 14:27, Adrian Klaver escribió:
>
> I am still learning what logical replication is capable of so take the
> following with that in mind.
>
> 1) I used
> pg_basebackup(www.postgresql.org/docs/10/static/app-pgbasebackup.html)
> to create a new $DATA directory for a replica instance.
>
> 2) I configured the master and the replica for logical replication. Also
> changed the copied over conf files to work for the new instance e.g.
> changed the port number.
>
> 3) I set up the PUBLICATION:
>
> CREATE PUBLICATION everything FOR ALL TABLES;
>
> 4) I set up the SUBSCRIPTION:
>
> CREATE SUBSCRIPTION test_sub CONNECTION 'dbname=production user=postgres
> port=5432' PUBLICATION everything WITH(copy_data=false);
>
> *NOTE* the copy_data=false.
>
> 5) Then I started entering data in the master and it was replicated.
>
> Caveats:
>
> 1) This was a small database.
>
> 2) The master and replica where on the same machine.
>
> 3) There was no activity on the master between the pg_basebackup and the
> CREATE PUBLICATION/CREATE SUBSCRIPTION commands.
This last caveat is a stopper. If the active node is *active* (receiving
writes statements) you'll lose all those changes.
I would instead suggest using pglogical and the
pglogical_create_subscriber tool to create the subscriber from a basebackup.
Kind Regards,
--
Martín Marqués http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, 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 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-general@postgresql.org
Cc: martin.marques@2ndquadrant.com, adrian.klaver@aklaver.com, olivier@gautherot.net
Subject: Re: Fast logical replication jump start with PG 10
In-Reply-To: <37f124de-5346-263a-01b9-f593673a3c43@2ndquadrant.com>
References: <CAJ7S9TVygExihaXt2E1bNH_0kGnx8bA62fmGreDGWTwb3_Pi7g@mail.gmail.com> <729c1726-2e61-f03f-fe7e-c1dcf3f59e85@aklaver.com> <CAJ7S9TWdYCi-FBhB4a5=gf7TfdZ=z6B+4wAQLAEJzZtoa0V3LA@mail.gmail.com> <239dddd5-aa45-a7fe-b35a-085b978f8bd6@aklaver.com> <CAJ7S9TUZJfcYEqQOxiLEy7d05NHfG7N0AyZYsG-4ngvb9PwLAQ@mail.gmail.com> <67e76903-b1fb-5a43-4b83-4f721ae2e1b0@aklaver.com> <37f124de-5346-263a-01b9-f593673a3c43@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