Ed L. pgsql
Fri Oct 29 19:50:44 PDT 2004
On Friday September 10 2004 12:26, Hendrik Woltersdorf wrote:
> I have some experiences with other replication systems (Sybase) and had
> the same concerns about the initial sync. Once upon a time it took me a
> whole weekend and 1,5GB of temporary disk space to copy 300MB of data
> from Duesseldorf to Frankfurt.
> But it's easy to build a slon deamon that does not do the initial delete
> and copy (controlled by a command line option). That way I can do the
> sync any way I like, subscribe without copying and restart the slon
> without the "do not copy"  flag. It's also a work around for removing a
> table from a set.

Hmm.  I've applied the patch and built fine, but having trouble setting 
this up.  Any clues as to what I'm doing wrong would be much appreciated.

My objective is replication between 1 master 
(dba at elvis:9001:mydb) and 1 slave (pg746dba at elvis:9746:mydb), but
copy the initial database from master to slave via pg_dump/scp/psql
instead of via slon's copy functionality.

First, I run this slonik script on the master:
 
cluster name = slony;
node 1 admin conninfo = 'user=dba host=elvis port=9001 dbname=mydb';
init cluster ( id = 1, comment = 'Master' );
create set ( id = 1, origin = 1, comment = 'All tables' );
set add table ( id = 9035874, set id = 1, origin = 1, fully qualified name = 'public.bar', comment = 'Table public.bar');
set add table ( id = 9035864, set id = 1, origin = 1, fully qualified name = 'public.foo', comment = 'Table public.foo');
set add sequence ( id = 9035872, set id = 1, origin = 1, fully qualified name = 'public.bar_id_seq', comment = 'Sequence public.bar_id_seq');
set add sequence ( id = 9035862, set id = 1, origin = 1, fully qualified name = 'public.foo_id_seq', comment = 'Sequence public.foo_id_seq');

That clearly starts replicating rows into sl_log_1.  Then I dump the
master database altogether using pg_dump and then load into the slave.
So the slave now has a snapshot of the master's replication log, while 
the master continues to be updated with new data.

Then I try to initialize and subscribe the slave with this slonik script:

cluster name = slony;
node 1 admin conninfo = 'user=dba host=elvis port=9001 dbname=mydb';
node 2 admin conninfo = 'user=pg746dba host=elvis port=9746 dbname=mydb';
store node ( id = 2, comment = 'Slave' );
store path ( server = 1, client = 2, conninfo = 'user=dba host=elvis port=9001 dbname=mydb' );
store path ( server = 2, client = 1, conninfo = 'user=pg746dba host=elvis port=9746 dbname=mydb' );
store listen ( origin = 1, provider = 1, receiver = 2 );
store listen ( origin = 2, provider = 2, receiver = 1 );
subscribe set ( id = 1, provider = 1, receiver = 2, forward = no);

No joy.  I get this error...

	Error: namespace "_slony" already exists in database of node 2

Of course it does, since I got that namespace from the dump/load of the
master.  But then how/where do I store the node.  I'm clueless here.  
How is this done?

Would anyone mind giving an example of the exact order you use to do your 
slonik setup, dumps, loads, and slon startup?

Ed



More information about the Slony1-general mailing list