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