Hi
Please can someone assist me? Im trying to replicate a database to another
machine. All the scripts and commands run without any errors but no data
gets copied over. Here is the script I use to prepare the databases, :
#--
# define the namespace the replication system uses in our example it is
# slony_example
#--
cluster name = sloncluster;
#--
# 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=master host=192.168.10.1 port=5432
user=postgres';
node 2 admin conninfo = 'dbname=slave host=192.168.10.2 port=5432
user=postgres';
#--
# 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');
#--
# Because the history table does not have a primary key or other unique
# constraint that could be used to identify a row, we need to add one.
# The following command adds a bigint column named
# _Slony-I_$CLUSTERNAME_rowID to the table. It will have a default value
# of nextval('_$CLUSTERNAME.s1_rowid_seq'), and have UNIQUE and NOT NULL
# constraints applied. All existing rows will be initialized with a
# number
#--
table add key (node id = 1, fully qualified name = 'public.mims');
table add key (node id = 1, fully qualified name = 'public.manufacturer');
table add key (node id = 1, fully qualified name = 'public.temppatient');
table add key (node id = 1, fully qualified name = 'public.medpraxtomims');
table add key (node id = 1, fully qualified name = 'public.possiblealiasfor
');
#--
# 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 Tables and Sequences');
set add table (set id=1, origin=1, id=1, fully qualified name = '
public.address', comment='address table');
set add table (set id=1, origin=1, id=2, fully qualified name = '
public.contactdetails', comment='contactdetails table');
set add table (set id=1, origin=1, id=3, fully qualified name = '
public.correspondence', comment='correspondence table');
set add table (set id=1, origin=1, id=4, fully qualified name = '
public.diary', comment='diary table');
set add table (set id=1, origin=1, id=5, fully qualified name = '
public.diarydispatch', comment='diarydispatch table');
set add table (set id=1, origin=1, id=6, fully qualified name = '
public.diaryfollowup', comment='diaryfollowup table');
set add table (set id=1, origin=1, id=7, fully qualified name = '
public.diarypredispense', comment='diarypredispense table');
set add table (set id=1, origin=1, id=8, fully qualified name = '
public.doctor', comment='doctor table');
set add table (set id=1, origin=1, id=9, fully qualified name = '
public.event', comment='event table');
set add table (set id=1, origin=1, id=10, fully qualified name = '
public.feedline', comment='feedline table');
set add table (set id=1, origin=1, id=11, fully qualified name = '
public.feedlineerror', comment='feedlineerror table');
set add table (set id=1, origin=1, id=12, fully qualified name = '
public.manufacturer', comment='manufacturer table', key = serial);
set add table (set id=1, origin=1, id=13, fully qualified name = '
public.medprax', comment='medprax table');
set add table (set id=1, origin=1, id=14, fully qualified name = '
public.medpraxtomims', comment='medpraxtomims table', key = serial);
set add table (set id=1, origin=1, id=15, fully qualified name = '
public.messagetemplate', comment='messagetemplate table');
set add table (set id=1, origin=1, id=16, fully qualified name = '
public.mims', comment='mims table', key = serial);
set add table (set id=1, origin=1, id=17, fully qualified name = '
public.operator', comment='operator table');
set add table (set id=1, origin=1, id=18, fully qualified name = '
public.patient', comment='patient table');
set add table (set id=1, origin=1, id=19, fully qualified name = '
public.patientflag', comment='patientflag table');
set add table (set id=1, origin=1, id=20, fully qualified name = '
public.patientmedicalaiddetails', comment='patientmedicalaiddetails table');
set add table (set id=1, origin=1, id=21, fully qualified name = '
public.pharmacies', comment='pharmacies table');
set add table (set id=1, origin=1, id=22, fully qualified name = '
public.pharmacy', comment='pharmacy table');
set add table (set id=1, origin=1, id=23, fully qualified name = '
public.possiblealiasfor', comment='possiblealiasfor table', key = serial);
set add table (set id=1, origin=1, id=24, fully qualified name = '
public.prescription', comment='prescription table');
set add table (set id=1, origin=1, id=25, fully qualified name = '
public.product', comment='product table');
set add table (set id=1, origin=1, id=26, fully qualified name = '
public.temppatient', comment='temppatient table', key = serial);
set add sequence (set id = 1, origin = 1, id = 27, full qualified name = '
public.hibernate_sequence', comment = 'Sequence hibernate_sequence');
#--
# 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');
store path (server = 1, client = 2, conninfo='dbname=master
host=192.168.0.1port=5432 user=postgres');
store path (server = 2, client = 1, conninfo='dbname=slave
host=192.168.0.2port=5432 user=postgres');
store listen (origin=1, provider = 1, receiver =2);
store listen (origin=2, provider = 2, receiver =1);
Then to initialize the replication I use:
# ----
# This defines which namespace the replication system uses
# ----
cluster name = sloncluster;
# ----
# 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=master host=192.168.0.1 port=5432
user=postgres';
node 2 admin conninfo = 'dbname=slave host=192.168.0.2 port=5432
user=postgres';
# ----
# Node 2 subscribes set 1
# ----
subscribe set ( id = 1, provider = 1, receiver = 2, forward = no);
Regards,
Matthew
_______________________________________________
Slony1-general mailing list
[email protected]
http://lists.slony.info/mailman/listinfo/slony1-general