Hendrik Woltersdorf hendrik.woltersdorf
Mon Nov 1 08:26:37 PST 2004
                                                                              
       An:  "Ed L." <pgsql at bluepolka.net>                                     
                                                                              
                                                                              
                                                                              
    Kopie:  slony1-general at gborg.postgresql.or                                
                                                                              
                                                                              
                                                                              
    Datum:  09:24:15 Heute                                                    
                                                                              
                                                                              
                                                                              
    Thema:  Antwort: Re: [Slony1-general] Slony-I Capabilities [auf Viren     
           geprueft]                                                          
                                                                              











Hi Ed,

I did NOT dump/load the whole database including the _slony schema. This
messes up all slony information in the slave node; of course.
Dump/load only the tables or schemas with the tables and sequences to
replicate !

My setup is (starting from scratch):

1. stop all data changing activity on the nodes
2. dump/load the database/schema(s)/tables from master to slave
3. set up slony on the two nodes
4. create the set(s)
5. start the slon deamon on the slave node with "-c"
6. subscribe
(6.1. restart the slon deamon without "-c")
7. resume database activities

regards

Hendrik Woltersdorf




             "Ed L."
             <pgsql at bluepolka.
             net>                                                       An
                                        Hendrik Woltersdorf
             29.10.2004 20:50           <hendrik.woltersdorf at xcom.de>
                                                                     Kopie
                                        Jan Wieck <JanWieck at Yahoo.com>,
                                        slony1-general at gborg.postgresql.or
                                        g,
                                        slony1-general-bounces at gborg.postg
                                        resql.org, Christopher Browne
                                        <cbbrowne at ca.afilias.info>
                                                                     Thema
                                        Re: [Slony1-general] Slony-I
                                        Capabilities [auf Viren geprueft]










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