Sun.betty alanxzq
Mon Jul 11 09:44:18 PDT 2005
Q1: how to read table sl_log_2 ?

test=# select relname
test-# ,relowner
test-# , relkind
test-# , relfilenode
test-# , relnatts
test-# , relhasindex
test-# , reltoastrelid
test-# , reltoastidxid
test-# from pg_class
test-# where relkind ='r'
test-#     and relname not like 'sql_%'
test-#     and relname not like 'pg_%'
test-# order by relname ;
    relname     | relowner | relkind | relfilenode | relnatts | relhasindex | reltoastrelid | reltoastidxid 
----------------+----------+---------+-------------+----------+-------------+---------------+---------------
 accounts       |        1 | r       |      319045 |        4 | t           |             0 |             0
 branches       |        1 | r       |      319037 |        3 | t           |             0 |             0
 history        |        1 | r       |      419364 |        7 | t           |             0 |             0
 sl_config_lock |        1 | r       |      419543 |        1 | f           |             0 |             0
 sl_confirm     |        1 | r       |      419509 |        4 | t           |             0 |             0
 sl_event       |        1 | r       |      419502 |       15 | t           |        419504 |             0
 sl_listen      |        1 | r       |      419478 |        3 | t           |             0 |             0
 sl_log_1       |        1 | r       |      419518 |        6 | t           |        419520 |             0
 sl_log_2       |        1 | r       |      419524 |        6 | t           |        419526 |             0
 sl_node        |        1 | r       |      419396 |        4 | t           |        419398 |             0
 sl_path        |        1 | r       |      419463 |        4 | t           |        419465 |             0
 sl_seqlog      |        1 | r       |      419514 |        4 | t           |             0 |             0
 sl_sequence    |        1 | r       |      419450 |        6 | t           |        419452 |             0
 sl_set         |        1 | r       |      419403 |        4 | t           |        419405 |             0
 sl_setsync     |        1 | r       |      419414 |        7 | t           |        419416 |             0
 sl_subscribe   |        1 | r       |      419490 |        5 | t           |             0 |             0
 sl_table       |        1 | r       |      419429 |        8 | t           |        419431 |             0
 sl_trigger     |        1 | r       |      419442 |        2 | t           |             0 |             0
 tellers        |        1 | r       |      319041 |        4 | t           |             0 |             0
(19 rows)

test=# \d sl_log_2
Did not find any relation named "sl_log_2".
test=# 

want to read table : sl_log_2 ,command exec failed.why?how to read it ?

 

Q2: there have a set 1 use setCluster.sh script create.

#!/bin/sh
CLUSTERNAME=test1
MASTERDBNAME=test
MASTERPORT=8432
SLAVEDBNAME=test
SLAVEPORT=8432
MASTERHOST=10.10.10.67
SLAVEHOST=10.10.10.36
REPLICATIONUSER=master
PGBENCHUSER=master
export CLUSTERNAME MASTERDBNAME MASTERPORT SLAVEDBNAME SLAVEPORT MASTERHOST SLAVEHOST REPLICATIONUSER PGBENCHUSER

slonik <<_EOF_
   cluster name = $CLUSTERNAME;

   node 1 admin conninfo = 'dbname=$MASTERDBNAME host=$MASTERHOST user=$REPLICATIONUSER';
   node 2 admin conninfo = 'dbname=$SLAVEDBNAME host=$SLAVEHOST user=$PGBENCHUSER';

   init cluster ( id=1, comment = 'Master Node');

   table add key (node id = 1, fully qualified name = 'public.history');

   create set (id=1, origin=1, comment='All pgbench tables');
   set add table (set id=1, origin=1, id=1, fully qualified name = 'public.accounts', comment='accounts table');
   set add table (set id=1, origin=1, id=2, fully qualified name = 'public.branches', comment='branches table');
   set add table (set id=1, origin=1, id=3, fully qualified name = 'public.tellers', comment='tellers table');
   set add table (set id=1, origin=1, id=4, fully qualified name = 'public.history', comment='history table', key = serial);

   store node (id=2, comment = 'Slave node');
   store path (server = 1, client = 2, conninfo='dbname=$MASTERDBNAME host=$MASTERHOST user=$REPLICATIONUSER');
   store path (server = 2, client = 1, conninfo='dbname=$SLAVEDBNAME host=$SLAVEHOST user=$PGBENCHUSER');
   store listen (origin=1, provider = 1, receiver =2);
   store listen (origin=2, provider = 2, receiver =1);
_EOF_

now , want to add a new table to this cluster and set .

create table tb_test1 (
INFO_ID              NUMERIC(6)           not null,
TO_NAME              VARCHAR(256)         null,
constraint PK_TB_TEST1 primary key (INFO_ID)
);

I read the document , carry out step maybe like this:

step 1 : create table at database test. (at master (node 1))

step 2 : pg_dump -U master -h 10.10.10.67 -p 8432 -t tb_test1 test | psql -s -U master -h 10.10.10.36 -p 8432  test

(at slave (node 2) keep on master and slave table schema same.)

step 3: use script : addSet.sh

#!/bin/sh

CLUSTERNAME=test1
MASTERDBNAME=test
MASTERPORT=8432
SLAVEDBNAME=test
SLAVEPORT=8432
MASTERHOST=10.10.10.67
SLAVEHOST=10.10.10.36
REPLICATIONUSER=master
PGBENCHUSER=master
export CLUSTERNAME MASTERDBNAME MASTERPORT SLAVEDBNAME SLAVEPORT MASTERHOST SLAVEHOST REPLICATIONUSER PGBENCHUSER
slonik <<_EOF_
   cluster name = $CLUSTERNAME;
   node 1 admin conninfo = 'dbname=$MASTERDBNAME host=$MASTERHOST user=$REPLICATIONUSER';
   node 2 admin conninfo = 'dbname=$SLAVEDBNAME host=$SLAVEHOST user=$PGBENCHUSER';
   create set (id=2, origin=1, comment='All pgbench tables');
   set add table (set id=1, origin=1, id=5, fully qualified name = 'public.tb_test1', comment='tb_test1 table');
_EOF_

about set add table I have a question about the value of id , this id is increase by degrees . step is 1 . how to know ,now , the id max value ?

step 4: use script merge.sh merge set 1 and set 2 change to set 1

#!/bin/sh

CLUSTERNAME=test1
MASTERDBNAME=test
MASTERPORT=8432
SLAVEDBNAME=test
SLAVEPORT=8432
MASTERHOST=10.10.10.67
SLAVEHOST=10.10.10.36
REPLICATIONUSER=master
PGBENCHUSER=master
export CLUSTERNAME MASTERDBNAME MASTERPORT SLAVEDBNAME SLAVEPORT MASTERHOST SLAVEHOST REPLICATIONUSER PGBENCHUSER
slonik <<_EOF_
   cluster name = $CLUSTERNAME;
   node 1 admin conninfo = 'dbname=$MASTERDBNAME host=$MASTERHOST user=$REPLICATIONUSER';
   node 2 admin conninfo = 'dbname=$SLAVEDBNAME host=$SLAVEHOST user=$PGBENCHUSER';
   MERGE SET ( ID = 2, 
         ADD ID = 9999,
         ORIGIN = 1 );
_EOF_

but exec merge.sh show errors:

bash-2.03$ ./merge.sh
<stdin>:4: PGRES_FATAL_ERROR select "_test1".mergeSet(2, 9999);  - ERROR:  Slony-I: set 9999 not found

my question:

1) this step for add new table to existing set is or not right ?

2) if this step process is right , exec merge.sh show errors .what reasons? how to resolve it ?

3) I read the notes about :

ID = ival 
   
Unique ID of the set to contain the union of the two separate sets.

ADD ID = ival 
   
Unique ID of the set whose objects should be transferred. 

ORIGIN = ival 
   
Current origin node for both sets. 

   
this ADD ID should fill in use script addSet.sh create set 2 (ADD ID=2) is or not right ?

   
ORIGIN should fill in use script setCluster.sh create set 1 (ORIGIN=1) is or not right ?

   
but for ID should fill in what ? I try to fill in 3 or 1 both exec show errors ?

if anybody know it , Please give some tips for me . Thanks very much .

 

		
---------------------------------
DO YOU YAHOO!?
  ????G???No.1??????????  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gborg.postgresql.org/pipermail/slony1-general/attachments/20050711/c48f7938/attachment-0001.html


More information about the Slony1-general mailing list