Christopher Browne cbbrowne at gmail.com
Tue Oct 8 09:03:51 PDT 2019
On Tue, 8 Oct 2019 at 03:20, Klaus Darilion <klaus.mailinglists at pernau.at>
wrote:

> Hello!
>
> We use Slony 2.1.4, with ~55 global slaves. Susbcribing [1] a node takes
> from ~3minutes (a few milli seconds away) to 15 minutes (200ms away) -
> one some minutes for the initial sync.
>
> a) Is it safe to subscribe multiple nodes in parallel, or do I have to
> subscribe them one after the other?
>

You cannot run multiple subscriptions simultaneously from a single
provider, but supposing you have 2 subscribed nodes (node 1 and node 2),
and want 3 more (3, 4, 5), you could parallelize somewhat, where node 3 is
subscribing to node 1 while node 4 subscribes via node 2.

Node 5 will need to wait for one of those to complete before it can start.


> b) Why does it take so long to subscribe? Can I speed up the subscribe?


Well, the process involves:
a) Copying all of the data in the replication set, and
b) Regenerating all of the indexes on the tables (as it is almost always
faster to deactivate indexes while doing the COPY)

It is essentially as fast as a pg_dump (or as slow).

If you have some way of using filesystem snapshots, then it is possible to
improve speed by "cloning" the database, and then doing the following:

- Stop all update activity on the origin (e.g. - you need an application
outage to do this).
- Use filesystem snapshot to establish the new database that is an exact
clone of the origin database (disk arrays and fancy modern filesystems and
volume managers support this sort of thing; it's highly platform specific,
but it's pretty common)

You now have a database that is a clone of the origin; it needs to be
turned into a node.  This is done as follows:
- Make sure replication is set up on the origin node:
  - INIT CLUSTER, if needed
  - CREATE SET
  - SET ADD TABLE/SEQUENCE
  - this work could all be done beforehand, reducing the amount of time of
the outage especially if there are a lot of tables being replicated
- If there was any replication configuration on the new node, drop it (e.g.
- use DROP NODE, pointing at the new node)
- Create replication configuration on the new node:
  - Use STORE NODE to set it up as a new node
  - SUBSCRIBE SET with the OMIT COPY option (see
http://www.slony.info/documentation/2.2/stmtsubscribeset.html )

At that point, users of the database can be let in to do work, as, after
this point, data will get replicated to the new node.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.slony.info/pipermail/slony1-general/attachments/20191008/bb85918f/attachment.htm 


More information about the Slony1-general mailing list