Defining Slony-I Clusters

6. Defining Slony-I Clusters

A Slony-I cluster is the basic grouping of database instances in which replication takes place. It consists of a set of PostgreSQL database instances in which is defined a namespace specific to that cluster. For instance, if the cluster is called cbcluster, then Slony-I will define, at the initialization time for each node, a schema called _cbcluster, in which it then creates numerous tables that store Slony-I configuration and replication state information. See schemadoc for more documentation about what is stored in that schema. More specifically, the tables sl_log_1 and sl_log_2 log changes collected on the origin node as they are replicated to subscribers.

Each database instance in which replication is to take place is identified by a node number.

For a simple install, it may be reasonable for the origin to be node #1, and for the subscriber to be node #2.

Note that, as recorded in the "" under How can I renumber nodes?, the node number is immutable, so it is not possible to change a node's node number after it has been set up.

Some planning should be done, in more complex cases, to ensure that the numbering system is kept sane, lest the administrators be driven insane. The node numbers should be chosen to somehow correspond to the shape of the environment, as opposed to (say) the order in which nodes were initialized.

In Slony-I version 1.1, the SLONIK INCLUDE and SLONIK DEFINE statements allow you to create a sort of "symbol table" behind the scenes so that slonik scripts can use names for nodes rather than cryptic numbers.