Home > Archive > Slony1 PostgreSQL Replication > July 2005 > about Execute SQL/DDL script and add new









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author about Execute SQL/DDL script and add new
Sun.betty

2005-07-12, 3:24 am


Hello! All!

create.sql :
BEGIN;
create table tb_test4 (
INFO_ID NUMERIC(6) not null,
TO_NAME VARCHAR(256) null,
constraint PK_TB_TEST4 primary key (INFO_ID)
);
COMMIT ;

script exec.sh
#!/bin/sh

CLUSTERNAME=test1
MASTERDBNAME=test
MASTERPORT=8432
SLAVEDBNAME=test
SLAVEPORT=8432
MASTERHOST=10.10.10.67
SLAVEHOST=10.10.10.36
REPLICATIONUSER=mast
er
PGBENCHUSER=master
export CLUSTERNAME MASTERDBNAME MASTERPORT SLAVEDBNAME SLAVEPORT MASTERHOST SLAVEHOST REPLICATIONUSER PGBENCHUSER
slonik <<_EOF_
cluster name = $CLUSTERNAME;
node 1 admin conninfo = 'dbname=$MASTERDBNAM
E host=$MASTERHOST user=$REPLICATIONUSE
R';
node 2 admin conninfo = 'dbname=$SLAVEDBNAME
host=$SLAVEHOST user=$PGBENCHUSER';
EXECUTE SCRIPT (SET ID = 1 , FILENAME = '/u2/master/betty/create.sql' , EVENT NODE = 1 );
_EOF_
# exec.sh script end

1) read document :
SET ID = ival
The unique numeric ID number of the set affected by the script

this "SET ID" should is create by
create set (id=1, origin=1, comment='All pgbench tables');
appointed value of "id" options.is or not ?

2) exec script exec.sh show errors:
bash-2.03$ ./exec.sh
<stdin>:4: PGRES_FATAL_ERROR select "_test1".ddlScript(1, '
begin;
create table tb_test4 (
INFO_ID NUMERIC(6) not null,
TO_NAME VARCHAR(256) null,
constraint PK_TB_TEST4 primary key (INFO_ID)
);
COMMIT ;
', -1); - ERROR: unexpected error -8 in EXECUTE of query "
begin;
create table tb_test4 (
INFO_ID NUMERIC(6) not null,
TO_NAME VARCHAR(256) null,
constraint PK_TB_TEST4 primary key (INFO_ID)
);
COMMIT ;
"
CONTEXT: PL/pgSQL function "ddlscript_int" line 54 at execute statement
PL/pgSQL function "ddlscript" line 31 at perform
bash-2.03$

what's wrong with it ? if i use is error? for right.how to do it?

Question 2: about Subscribing Nodes
first : set up a set use script setCluster.sh
#!/bin/sh
CLUSTERNAME=test1
MASTERDBNAME=test
MASTERPORT=8432
SLAVEDBNAME=test
SLAVEPORT=8432
MASTERHOST=10.10.10.67
SLAVEHOST=10.10.10.36
REPLICATIONUSER=mast
er
PGBENCHUSER=master
export CLUSTERNAME MASTERDBNAME MASTERPORT SLAVEDBNAME SLAVEPORT MASTERHOST SLAVEHOST REPLICATIONUSER PGBENCHUSER

slonik <<_EOF_
cluster name = $CLUSTERNAME;
node 1 admin conninfo = 'dbname=$MASTERDBNAM
E host=$MASTERHOST user=$REPLICATIONUSE
R';
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=$MA
STERDBNAME host=$MASTERHOST user=$REPLICATIONUSE
R');
store path (server = 2, client = 1, conninfo='dbname=$SL
AVEDBNAME host=$SLAVEHOST user=$PGBENCHUSER');

store listen (origin=1, provider = 1, receiver =2);
store listen (origin=2, provider = 2, receiver =1);
_EOF_

second : if have need add node 3 to this set(cluster name=test1 and setid=1)
how to do it ? I read document about Subscribing Nodes chapter
slonik <<_EOF_
try {
echo 'Subscribing sets';
subscribe set (id = 1, provider=1, receiver=2, forward=yes);
subscribe set (id = 1, provider=1, receiver=3, forward=yes);
subscribe set (id = 1, provider=1, receiver=4, forward=yes);
} on error {
echo 'Could not subscribe the sets!';
exit -1;
}
_EOF_

my question is : when create "set 1" ¡£define "node 1 admin conninfo"and "node 2 admin conninfo" info (host , username , dbname).
when add node 3 to "set 1" , why not need define "node 3 admin conninfo" info¡£ if no define,how to know relation info(host,username,d
bname) of node 3?
how to add node 3 to this set ? what is the right use manner?


if you know ,Please help me! give some tip for that . Thank you for you help very much !


---------------------------------
DO YOU YAHOO!?
ÑÅ»¢Ãâ·ÑGÓÊÏä£_Öйúµ
ÚÒ»¾øÎÞÀ¬»øÓʼþɧÈų
¬´óÓÊÏä
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com