Mon Jul 11 16:00:43 PDT 2005
- Previous message: [Slony1-general] Adding tables to an existing set in Slony1
- Next message: 回复: Re: [Slony1-general] Adding tables to an existing set in Slony1
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Sun.betty wrote: > 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 ? > sl_log_2 is presumably in the same namespace/schema as all of the other Slony-I tables. If your cluster is consistently called "test1", then its fully qualified name would be _test1.sl_log_2 At this point in time, sl_log_2 isn't actually used for anything, so I don't see any reason for you to need to look in it for anything. You'll only find that it is empty. > 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 ? > 1. If set #1 is already being subscribed, then you cannot add a table to it. You would need to add the new table to "set id=2", not to "set id=1". 2. You can find the current maximum table ID via the query... select max(tab_id) from _test1.sl_table; > 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 ? > I wouldn't think so. > 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 . > It seems reasonably clear in the documentation. For MERGE SET... ID = ival indicates the set to contain the union of the two separate sets. If you plan to merge sets 1 and 2 together to get a new set 1, then "ID = 1" ADD ID = ival indicates the unique id of the set whose objects should be transferred. That would be set #2. ORIGIN is the current origin node for both sets; that appears to be node #1.
- Previous message: [Slony1-general] Adding tables to an existing set in Slony1
- Next message: 回复: Re: [Slony1-general] Adding tables to an existing set in Slony1
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-general mailing list