Modifying Slony Clusters

Replication clusters have much forethought applied to their creation.
However, in the course of systems development, some changes are always necessary
sooner or later. This article walks through the steps required to:

Add a node to the cluster.

Switch data providers of a table set.

Promote a replication to master.

Apply schema changes to the replication cluster.

These examples will use the replication scheme originally set up in "Introducing
Slony."

Figure 1.

Adding a Node

Suppose that in addition to the replica you created for the gb
database, you want another replica of the same database for reporting. Here's
how to add a replica of the gb table set on a second database in
the 8.0 installation. The 7.4 Node 1, database gb, will originate
the data set and replicate it directly to Node 2, also database
gb, and Node 3, database gb2.

Figure 2.

Before starting, be sure to create gb2 in the 8.0 installation,
seeding it with the same empty schema as the other two databases in this
cluster. You do not want a dump of the schema of gb as is it now,
but rather as it was before you defined the Slony-I cluster.

Next, define Node 3 and ensure there are paths from Node 3 to and
from Nodes 1 and 2. From there, enable listening along each path mirroring the
expected table set replication. The listening of 2 and 3 via Node 1 reflects this
mirroring, rather than having a direct listen path between 2 and 3.

This is a really good time to remember that the connection information in
the store path command pertains to the server node.
This is also a pretty good time to look up drop path and
drop listen, two more slonik commands.

Once the new slon process is up and running, you can subscribe
Table Set 1, originating at Node 1, to Node 3. At this point the log files are
invaluable; tail -f the log files to watch for progress and
errors. The log files in this case are slon_gb_1.out,
slon_gb_2.out, and slon_gb_3.out. If you see any problems, you may
have to remove the paths and/or listens, replacing them with corrected
ones.