Hi Folks,
I have a question regarding the replication of tables between PostgreSQL 9.1 to 
PostgreSQL 9.5.
Is it possible to replicate tables of same name but with different schema names 
?. I am trying to replicate appl.table(s) from PostgreSQL 9.1 to user1.table(s) 
of PostgreSQL 9.5 and all I could see is below
Could not find table "appl"."pgbench_accounts" on subscriber
I have a set of tables under the "appl" schema in PG9.1 and the same tables 
have been created under the "user1" schema in PG9.5. I went through the 
documentation of "set add table" and came across a TABLES argument but even 
that uses the schema_name to qualify a table name.
1) Is it a requirement for the tables to be created under same schema names ? 
or is there an alternative around it ? 
2) And, where is the step of "start of replication" supposed to be executed: at 
master or at slave ?. I inadvertently executed it on slave and the child 
process of slon deamon crashed and tried to come up every 10 seconds while 
there were messages in the slon redirection log that the child process was kill 
with 9 and trying to come up after 10 seconds.

Please find below the commands that I have used.
Init cluster / Create set / Store path
export CLUSTERNAME=pg_upg
export MASTERDBNAME=db1
export SLAVEDBNAME=db1_repl
export MASTERHOST=node1
export SLAVEHOST=node2
export MAS_REPLICATIONUSER=appl
export SLV_REPLICATIONUSER=user1
export MAS_PAS=appl
export SLV_PAS=user1
export MAS_PORT=5432
export SLV_PORT=5632


 slonik <<EOF
        cluster name = $CLUSTERNAME;
        node 1 admin conninfo = 'dbname=$MASTERDBNAME host=$MASTERHOST 
user=$MAS_REPLICATIONUSER password=$MAS_PAS port=$MAS_PORT';
        node 2 admin conninfo = 'dbname=$SLAVEDBNAME host=$SLAVEHOST 
user=$SLV_REPLICATIONUSER password=$SLV_PAS port=$SLV_PORT';
        init cluster ( id=1, comment = 'Master Node');
        create set (id=1, origin=1, comment='All pgbench tables');
        set add table (set id=1, origin=1, id=1, fully qualified name = 
'appl.pgbench_accounts', comment='accounts table');
        set add table (set id=1, origin=1, id=2, fully qualified name = 
'appl.pgbench_branches', comment='branches table');
        set add table (set id=1, origin=1, id=3, fully qualified name = 
'appl.pgbench_tellers', comment='tellers table');
        set add table (set id=1, origin=1, id=4, fully qualified name = 
'appl.pgbench_history', comment='history table');
        create set (id=2, origin=1, comment='All T* tables');
        ### set add table (set id=2, origin=1, id=1, fully qualified name = 
'appl.t1', comment='t1 table');
        set add table (set id=2, origin=1, id=5, fully qualified name = 
'appl.tab1', comment='tab1 table');
        store node (id=2, comment = 'Slave node', event node=1);
        store path (server = 1, client = 2, conninfo='dbname=$MASTERDBNAME 
host=$MASTERHOST user=$MAS_REPLICATIONUSER password=$MAS_PAS port=$MAS_PORT');
        store path (server = 2, client = 1, conninfo='dbname=$SLAVEDBNAME 
host=$SLAVEHOST user=$SLV_REPLICATIONUSER password=$SLV_PAS port=$SLV_PORT');
EOF

starting slon deamons
slon $CLUSTERNAME "dbname=$MASTERDBNAME user=$MAS_REPLICATIONUSER 
host=$MASTERHOST port=$MAS_PORT" -d2 >>master.log
slon $CLUSTERNAME "dbname=$SLAVEDBNAME user=$SLV_REPLICATIONUSER 
host=$SLAVEHOST port=$SLV_PORT" -d2 >>slave.log
start of replication
slonik <<_EOF_
         cluster name = $CLUSTERNAME;
         #
         node 1 admin conninfo = 'dbname=$MASTERDBNAME host=$MASTERHOST 
user=$MAS_REPLICATIONUSER password=$MAS_PAS port=$MAS_PORT';
         node 2 admin conninfo = 'dbname=$SLAVEDBNAME host=$SLAVEHOST 
user=$SLV_REPLICATIONUSER password=$SLV_PAS port=$SLV_PORT';
         subscribe set ( id = 1, provider = 1, receiver = 2, forward = no);
         subscribe set ( id = 2, provider = 1, receiver = 2, forward = no);_EOF_

Regards, Nawaz Ahmed 
_______________________________________________
Slony1-general mailing list
Slony1-general@lists.slony.info
http://lists.slony.info/mailman/listinfo/slony1-general

Reply via email to