Matthew Kelly JMatthewKelly at gmail.com
Wed Jun 27 02:19:17 PDT 2007
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 =3D 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 =3D 'dbname=3Dmaster host=3D192.168.10.1 port=3D5432
user=3Dpostgres';
node 2 admin conninfo =3D 'dbname=3Dslave host=3D192.168.10.2 port=3D5432
user=3Dpostgres';

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

init cluster ( id=3D1, comment =3D '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 =3D 1, fully qualified name =3D 'public.mims');
table add key (node id =3D 1, fully qualified name =3D 'public.manufacturer=
');
table add key (node id =3D 1, fully qualified name =3D 'public.temppatient'=
);
table add key (node id =3D 1, fully qualified name =3D 'public.medpraxtomim=
s');
table add key (node id =3D 1, fully qualified name =3D 'public.possiblealia=
sfor
');

#--
# 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=3D1, origin=3D1, comment=3D'All Tables and Sequences');
set add table (set id=3D1, origin=3D1, id=3D1, fully qualified name =3D '
public.address', comment=3D'address table');
set add table (set id=3D1, origin=3D1, id=3D2, fully qualified name =3D '
public.contactdetails', comment=3D'contactdetails table');
set add table (set id=3D1, origin=3D1, id=3D3, fully qualified name =3D '
public.correspondence', comment=3D'correspondence table');
set add table (set id=3D1, origin=3D1, id=3D4, fully qualified name =3D '
public.diary', comment=3D'diary table');
set add table (set id=3D1, origin=3D1, id=3D5, fully qualified name =3D '
public.diarydispatch', comment=3D'diarydispatch table');
set add table (set id=3D1, origin=3D1, id=3D6, fully qualified name =3D '
public.diaryfollowup', comment=3D'diaryfollowup table');
set add table (set id=3D1, origin=3D1, id=3D7, fully qualified name =3D '
public.diarypredispense', comment=3D'diarypredispense table');
set add table (set id=3D1, origin=3D1, id=3D8, fully qualified name =3D '
public.doctor', comment=3D'doctor table');
set add table (set id=3D1, origin=3D1, id=3D9, fully qualified name =3D '
public.event', comment=3D'event table');
set add table (set id=3D1, origin=3D1, id=3D10, fully qualified name =3D '
public.feedline', comment=3D'feedline table');
set add table (set id=3D1, origin=3D1, id=3D11, fully qualified name =3D '
public.feedlineerror', comment=3D'feedlineerror table');
set add table (set id=3D1, origin=3D1, id=3D12, fully qualified name =3D '
public.manufacturer', comment=3D'manufacturer table', key =3D serial);
set add table (set id=3D1, origin=3D1, id=3D13, fully qualified name =3D '
public.medprax', comment=3D'medprax table');
set add table (set id=3D1, origin=3D1, id=3D14, fully qualified name =3D '
public.medpraxtomims', comment=3D'medpraxtomims table', key =3D serial);
set add table (set id=3D1, origin=3D1, id=3D15, fully qualified name =3D '
public.messagetemplate', comment=3D'messagetemplate table');
set add table (set id=3D1, origin=3D1, id=3D16, fully qualified name =3D '
public.mims', comment=3D'mims table', key =3D serial);
set add table (set id=3D1, origin=3D1, id=3D17, fully qualified name =3D '
public.operator', comment=3D'operator table');
set add table (set id=3D1, origin=3D1, id=3D18, fully qualified name =3D '
public.patient', comment=3D'patient table');
set add table (set id=3D1, origin=3D1, id=3D19, fully qualified name =3D '
public.patientflag', comment=3D'patientflag table');
set add table (set id=3D1, origin=3D1, id=3D20, fully qualified name =3D '
public.patientmedicalaiddetails', comment=3D'patientmedicalaiddetails table=
');
set add table (set id=3D1, origin=3D1, id=3D21, fully qualified name =3D '
public.pharmacies', comment=3D'pharmacies table');
set add table (set id=3D1, origin=3D1, id=3D22, fully qualified name =3D '
public.pharmacy', comment=3D'pharmacy table');
set add table (set id=3D1, origin=3D1, id=3D23, fully qualified name =3D '
public.possiblealiasfor', comment=3D'possiblealiasfor table', key =3D seria=
l);
set add table (set id=3D1, origin=3D1, id=3D24, fully qualified name =3D '
public.prescription', comment=3D'prescription table');
set add table (set id=3D1, origin=3D1, id=3D25, fully qualified name =3D '
public.product', comment=3D'product table');
set add table (set id=3D1, origin=3D1, id=3D26, fully qualified name =3D '
public.temppatient', comment=3D'temppatient table', key =3D serial);
set add sequence (set id =3D 1, origin =3D 1, id =3D 27, full qualified nam=
e =3D '
public.hibernate_sequence', comment =3D '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=3D2, comment =3D 'Slave node');
store path (server =3D 1, client =3D 2, conninfo=3D'dbname=3Dmaster
host=3D192.168.0.1port=3D5432 user=3Dpostgres');
store path (server =3D 2, client =3D 1, conninfo=3D'dbname=3Dslave
host=3D192.168.0.2port=3D5432 user=3Dpostgres');
store listen (origin=3D1, provider =3D 1, receiver =3D2);
store listen (origin=3D2, provider =3D 2, receiver =3D1);



Then to initialize the replication I use:

# ----
# This defines which namespace the replication system uses
# ----

cluster name =3D 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 =3D 'dbname=3Dmaster host=3D192.168.0.1 port=3D5432
user=3Dpostgres';
node 2 admin conninfo =3D 'dbname=3Dslave host=3D192.168.0.2 port=3D5432
user=3Dpostgres';

# ----
# Node 2 subscribes set 1
# ----

subscribe set ( id =3D 1, provider =3D 1, receiver =3D 2, forward =3D no);



Regards,

Matthew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.slony.info/pipermail/slony1-general/attachments/20070627/=
085a90c0/attachment.htm


More information about the Slony1-general mailing list