Ed L. pgsql
Fri Sep 17 01:50:20 PDT 2004
I'm reviewing the first slonik example in the README and trying to figure 
out which values correspond to which entities (origin, server, client, 
provider, receiver).  Below I've reduced the example and replaced the magic 
numbers with variable names for a simple master-slave replication setup in 
order to ask you if it appears I'm correctly understanding the type of each 
of the IDs in the example.  Assume I understand the conninfo parts correct.

Questions:

    What's the difference between a node ID and a cluster ID?
    Any problem using oids for the table IDs in "set add table"?
    Any problem using 'public' for replication tables schemaname?
    Below, are origin, server, client, provider, and receiver all "node" 
numbers?

MASTER_ID=1     # Master's node ID number, first one has to be 1
SLAVE_ID=2      # Slave's node ID number, first one has to be 1
SET_ID=37       # Arbitrary set ID number?  Or does it have to start with 1?

CLUSTER=test1                     # schema name for replication tables?
DBNAME1=pgbench_node1
DBNAME2=pgbench_node2
HOST1=<host name of pgbench_node1>
HOST2=<host name of pgbench_node2>
SLONY_USER=<PostgreSQL superuser to connect as for replication>
PGBENCH_USER=<normal user to run the pgbench application>

slonik <<_EOF_
    cluster name = $CLUSTER;
    node $MASTER_ID admin conninfo = '...';
    node $SLAVE_ID admin conninfo = '...';
    init cluster ( id = $MASTER_ID, comment = 'Node $MASTER_ID' );
    create set ( id = $SET_ID, origin = $MASTER_ID );
    set add table ( id = 1, set id = $SET_ID, origin = $MASTER_ID, 
                    fully qualified name = 'public.accounts');
    set add table ( id = 2, set id = $SET_ID, origin = $MASTER_ID, 
                    fully qualified name = 'public.branches');
    set add table ( id = 3, set id = $SET_ID, origin = $MASTER_ID, 
                    fully qualified name = 'public.tellers');
    store node ( id = $SLAVE_ID, comment = 'Node $SLAVE_ID' );
    store path ( server = $MASTER_ID, client = $SLAVE_ID, conninfo = '...');
    store path ( server = $SLAVE_ID, client = $MASTER_ID, conninfo = '...');
    store listen ( 
        origin = $MASTER_ID, provider = $MASTER_ID, receiver = $SLAVE_ID );
    store listen ( 
        origin = $SLAVE_ID, provider = $SLAVE_ID, receiver = $MASTER_ID );
_EOF_





More information about the Slony1-general mailing list