Domanda

Comando di esempio slonik al 1 ° nodo:

slonik <<_EOF_
#--
# define the namespace the replication system uses in our example it is
# slony_example
#--
cluster name = $CLUSTERNAME;

#--
# admin conninfo's are used by slonik to connect to the nodes one for each
# node on each side of the cluster, the syntax is that of PQconnectdb in
# the C-API
# --
node 1 admin conninfo = 'dbname=$MASTERDBNAME host=$MASTERHOST user=$REPLICATIONUSER';
node 2 admin conninfo = 'dbname=$SLAVEDBNAME host=$SLAVEHOST user=$REPLICATIONUSER';

#--
# init the first node.  Its id MUST be 1.  This creates the schema
# _$CLUSTERNAME containing all replication system specific database
# objects.

#--
init cluster ( id=1, comment = 'Master Node');

#--
# Slony-I organizes tables into sets.  The smallest unit a node can
# subscribe is a set.  The following commands create one set containing
# all 4 pgbench tables.  The master or origin of the set is node 1.
#--
create set (id=1, origin=1, comment='All pgbench tables');
set add table (set id=1, origin=1, id=1, fully qualified name = 'public.accounts', comment='accounts table');
set add table (set id=1, origin=1, id=2, fully qualified name = 'public.branches', comment='branches table');
set add table (set id=1, origin=1, id=3, fully qualified name = 'public.tellers', comment='tellers table');
set add table (set id=1, origin=1, id=4, fully qualified name = 'public.history', comment='history table');

#--
# Create the second node (the slave) tell the 2 nodes how to connect to
# each other and how they should listen for events.
#--

store node (id=2, comment = 'Slave node', event node=1);
store path (server = 1, client = 2, conninfo='dbname=$MASTERDBNAME host=$MASTERHOST user=$REPLICATIONUSER');
store path (server = 2, client = 1, conninfo='dbname=$SLAVEDBNAME host=$SLAVEHOST user=$REPLICATIONUSER');
_EOF_

Comando di esempio slonik al 2 ° nodo:

slonik <<_EOF_
 # ----
 # This defines which namespace the replication system uses
 # ----
 cluster name = $CLUSTERNAME;

 # ----
 # Admin conninfo's are used by the slonik program to connect
 # to the node databases.  So these are the PQconnectdb arguments
 # that connect from the administrators workstation (where
 # slonik is executed).
 # ----
 node 1 admin conninfo = 'dbname=$MASTERDBNAME host=$MASTERHOST user=$REPLICATIONUSER';
 node 2 admin conninfo = 'dbname=$SLAVEDBNAME host=$SLAVEHOST user=$REPLICATIONUSER';

 # ----
 # Node 2 subscribes set 1
 # ----
 subscribe set ( id = 1, provider = 1, receiver = 2, forward = no);
_EOF_

Quali dei slonik comandi sopra (a quale slonik di comando), crea lo schema $ CLUSTERNAME in ogni del database del nodo?

Sono più interessato al secondo nodo; è il comando nodo di archivio (), che crea lo schema $ CLUSTERNAME nella banca dati del secondo nodo?

È stato utile?

Soluzione

"grappolo init" sul primo nodo, "nodo di archivio" sulla seconda.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top