如果想向一个复制集里面增加新的表,可以用以下脚本:
#!/bin/shsource ./replinit.shtableID=tablename=$SLONIK << _END_## define cluster namespace and node connection information#cluster name = $CLUSTER;node $MASTERNODE admin conninfo = 'dbname=$MASTER_DB host=$MASTER_IP port=5432 user=$REPLUSER password=$REPLPWD';node $SLAVENODE admin conninfo = 'dbname=$SLAVE_DB host=$SLAVE_IP port=5432 user=$REPLUSER password=$REPLPWD';create set (ID=999,origin=$MASTERNODE,comment='add $tablename table');set add table (set ID=999,ID=$tableID,fully qualifIEd name ='public.$tablename',comment='table $tablename ');#SUBSCRIBE SET (ID = 999,PROVIDER = $MASTERNODE,RECEIVER =$SLAVENODE,forward=no);echo 'wait 1 ...';SYNC (ID=$MASTERNODE);echo 'wait 2 ...';WAIT FOR EVENT (ORIGIN = ALL,CONFIRMED = ALL,WAIT ON=$MASTERNODE,TIMEOUT=0);#SLEEP(seconds =2);echo 'MERGE SET ...';MERGE SET ( ID = $SETID,ADD ID = 999,ORIGIN = $MASTERNODE );echo '$tablename table added';#DROP SET (ID=999,origin=$MASTERNODE);_END_总结
以上是内存溢出为你收集整理的Slony1 增加表复制全部内容,希望文章能够帮你解决Slony1 增加表复制所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)