From: | Martín Marqués <martin(dot)marques(at)2ndquadrant(dot)com> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Olivier Gautherot <olivier(at)gautherot(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Fast logical replication jump start with PG 10 |
Date: | 2018-05-26 18:13:45 |
Message-ID: | 37f124de-5346-263a-01b9-f593673a3c43@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Janes | 2018-05-26 18:16:33 | Re: Fast logical replication jump start with PG 10 |
Previous Message | Adrian Klaver | 2018-05-26 18:00:33 | Re: Fast logical replication jump start with PG 10 |