Thread: creating table while slony-I replication is running
Hi, I am trying to find out how to CREATE a table while Slony-I replication is running (meaning without stopping Slony-I replication adding/creating new table into replication) I have tried to run this but wont work. please help. thanks. add_table.sh ---------------------------- #!/bin/sh /opt/EnterpriseDB/8.1.4.17/dbserver/bin/slonik <<_EOF_ #-- # define the namespace the replication system uses in our example it is # slony_example #-- cluster name = $CLUSTERNAME; node 1 admin conninfo = 'dbname=$MASTERDBNAME host=$MASTERHOST port=$MASTERDBPORT user=$REPLICATIONUSER'; EXECUTE SCRIPT ( SET ID = 1, FILENAME = '/opt/EnterpriseDB/8.1.4.17/dbserver/bin/add_table.sql', EVENT NODE = 1 ); _EOF_ ---------------------------------- add_table.sql ---------------------------------- CREATE TABLE gurkan ( id serial not null , fname varchar(155), lname varchar(155), primary key (id) ); ---------------------------------- ERROR: ------------------------- [enterprisedb@baba1 bin]$ ./add_table.sh <stdin>:9: PGRES_FATAL_ERROR select "_edb_replication_example".ddlScript(1, 'CREATE TABLE gurkan ( id serial not null , fname varchar(155), lname varchar(155), primary key (id) ); X\uffff\uffff', -1); - ERROR: invalid byte sequence for encoding "UNICODE": 0xc1c4 ------------------------- ------------------------- ------------------------------------------------- This mail sent through IMP: www.resolution.com
Hi Gurkan,
I just tried the same but didn't face a problem while doing so.
You can try the same steps that I did:
1. Made a exec_scr file for Slonik with execute script command (i.e attached with the email)
2. Made a test.sql file which has the create table just like the one you mentioned (i.e attached with the email)
3. Now using Slonik executed the script test.sql for master and salve like this
/opt/EnterpriseDB/8.1.4.17/dbserver/slonik exec_scr
and that created the same table on the master and respective slave node.
The encoding error that you are getting might be due to some extra or some special hidden characters in one of your script files.
Please try using the script files that I have attached with the email and following the steps given above.
Thanks,
--
Shoaib Mir
EnterpriseDB (www.enterprisedb.com )
I just tried the same but didn't face a problem while doing so.
You can try the same steps that I did:
1. Made a exec_scr file for Slonik with execute script command (i.e attached with the email)
2. Made a test.sql file which has the create table just like the one you mentioned (i.e attached with the email)
3. Now using Slonik executed the script test.sql for master and salve like this
/opt/EnterpriseDB/8.1.4.17/dbserver/slonik exec_scr
and that created the same table on the master and respective slave node.
The encoding error that you are getting might be due to some extra or some special hidden characters in one of your script files.
Please try using the script files that I have attached with the email and following the steps given above.
Thanks,
--
Shoaib Mir
EnterpriseDB (www.enterprisedb.com )
On 9/21/06, gurkan@resolution.com <gurkan@resolution.com> wrote:
Hi,
I am trying to find out how to CREATE a table while Slony-I replication is
running (meaning without stopping Slony-I replication adding/creating new table
into replication)
I have tried to run this but wont work. please help. thanks.
add_table.sh
----------------------------
#!/bin/sh
/opt/EnterpriseDB/8.1.4.17/dbserver/bin/slonik <<_EOF_
#--
# define the namespace the replication system uses in our example it is
# slony_example
#--
cluster name = $CLUSTERNAME;
node 1 admin conninfo = 'dbname=$MASTERDBNAME host=$MASTERHOST
port=$MASTERDBPORT user=$REPLICATIONUSER';
EXECUTE SCRIPT (
SET ID = 1,
FILENAME = '/opt/EnterpriseDB/8.1.4.17/dbserver/bin/add_table.sql',
EVENT NODE = 1
);
_EOF_
----------------------------------
add_table.sql
----------------------------------
CREATE TABLE gurkan
(
id serial not null ,
fname varchar(155),
lname varchar(155),
primary key (id)
);
----------------------------------
ERROR:
-------------------------
[enterprisedb@baba1 bin]$ ./add_table.sh
<stdin>:9: PGRES_FATAL_ERROR select "_edb_replication_example".ddlScript(1,
'CREATE TABLE gurkan
(
id serial not null ,
fname varchar(155),
lname varchar(155),
primary key (id)
);
X\uffff\uffff', -1); - ERROR: invalid byte sequence for encoding "UNICODE": 0xc1c4
-------------------------
-------------------------
-------------------------------------------------
This mail sent through IMP: www.resolution.com
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match
Attachment
In the last exciting episode, gurkan@resolution.com wrote: > Hi, > I am trying to find out how to CREATE a table while Slony-I replication is > running (meaning without stopping Slony-I replication adding/creating new table > into replication) I think you have some extra characters in the script. (e.g. - add_table.sql) -- select 'cbbrowne' || '@' || 'gmail.com'; http://linuxdatabases.info/info/ "I still maintain the point that designing a monolithic kernel in 1991 is a fundamental error. Be thankful you are not my student. You would not get a high grade for such a design :-)" -- Andrew Tanenbaum to Linus Torvalds
Hi, I got executing the script; (creates table on master,slave1,slave2 but does it matter to have connection to only node1 or all nodes in script, it did the same thing with connection to only node1 and I tried to connection to all nodes ? node 1 admin conninfo = 'dbname=development host=192.168.15.90 port=5444 user=enterprisedb'; node 2 admin conninfo = 'dbname=development host=192.168.15.91 port=5444 user=enterprisedb'; node 3 admin conninfo = 'dbname=development host=192.168.15.92 port=5444 user=enterprisedb'; ) (once the table cretaed, I would expect to have replication for all tables and new-created table; meaning once I do insertion to new-created table on master, I was expecting to replicate on slave1 and slave2, but it did not replicate/insert to slave1 and slave2. I am sure I am missing something?) (I believe same things needs to be done for other SQL commands, like inserting INDEXs,FUNCTIONS, etc.) thanks for reply/help >Hi Gurkan, ? >I just tried the same but didn't face a problem while doing so. > >You can try the same steps that I did: > >1. Made a exec_scr file for Slonik with execute script command >(i.eattached with the email) >2. Made a test.sql file which has the create table just like the one you >mentioned (i.e attached with the email) >3. Now using Slonik executed the script test.sql for master and salve like >this > >/opt/EnterpriseDB/8.1.4.17/dbserver/slonik exec_scr > >and that created the same table on the master and respective slave node. > >The encoding error that you are getting might be due to some extra or some >special hidden characters in one of your script files. > >Please try using the script files that I have attached with the email and >following the steps given above. > >Thanks, >-- >Shoaib Mir >EnterpriseDB (www.enterprisedb.com) > >On 9/21/06, gurkan@resolution.com <gurkan@resolution.com> wrote: >> >> Hi, >> I am trying to find out how to CREATE a table while Slony-I replication is > running (meaning without stopping Slony-I replication adding/creating new > table > into replication) > > I have tried to run this but wont work. please help. thanks. > > add_table.sh > ---------------------------- > #!/bin/sh > > /opt/EnterpriseDB/8.1.4.17/dbserver/bin/slonik <<_EOF_ > #-- > # define the namespace the replication system uses in our example > it is > # slony_example > #-- > cluster name = $CLUSTERNAME; > > node 1 admin conninfo = 'dbname=$MASTERDBNAME host=$MASTERHOST > port=$MASTERDBPORT user=$REPLICATIONUSER'; > > EXECUTE SCRIPT ( > SET ID = 1, > FILENAME = > '/opt/EnterpriseDB/8.1.4.17/dbserver/bin/add_table.sql', > EVENT NODE = 1 > ); > > _EOF_ > ---------------------------------- > > add_table.sql > ---------------------------------- > CREATE TABLE gurkan > ( > id serial not null , > fname varchar(155), > lname varchar(155), > primary key (id) > ); > ---------------------------------- > > ERROR: > ------------------------- > [enterprisedb@baba1 bin]$ ./add_table.sh > <stdin>:9: PGRES_FATAL_ERROR select > "_edb_replication_example".ddlScript(1, > 'CREATE TABLE gurkan > ( > id serial not null , > fname varchar(155), > lname varchar(155), > primary key (id) > ); > X\uffff\uffff', -1); - ERROR: invalid byte sequence for encoding > "UNICODE": 0xc1c4 > ------------------------- > ------------------------- > > > ------------------------------------------------- > This mail sent through IMP: www.resolution.com > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match > ------------------------------------------------- This mail sent through IMP: www.resolution.com