Slony-I的删除:

接前篇:http://www.cnblogs.com/gaojian/p/3196244.html  

简单的Slony-I设置实例

 如何删除slony相关的内容呢。

我再另外找一台机器,安装slony,也安装postgresql(这个是为防止万一而已)

编写脚本:

[postgres@pg100 ~]$ cat remove.sh
#!/bin/sh

CLUSTERNAME=testdb3_cluster
MASTERDBNAME=testdb3
SLAVEDBNAME=testdb3
MASTERHOST=192.168.10.102
SLAVEHOST=192.168.10.101
REPLICATIONUSER=postgres

/usr/local/slony/bin/slonik <<_EOF_
    #--
    # define the namespace the replication system
    # uses in our example it is slony_example
    #--
    cluster name = $CLUSTERNAME;

    #--
    # admin conninfo's are used by slonik to connect to 
    # the nodes one for eachnode on each side of the cluster, 
    # the syntax is that of PQconnectdb in
    # the C-API
    # --
    node 1 admin conninfo = 'dbname=$MASTERDBNAME 
           host=$MASTERHOST user=$REPLICATIONUSER';
    node 2 admin conninfo = 'dbname=$SLAVEDBNAME 
           host=$SLAVEHOST user=$REPLICATIONUSER';

    uninstall node (id = 1);
    uninstall node (id = 2);
_EOF_
[postgres@pg100 ~]$ 

然后运行:

[postgres@pg100 ~]$ sh remove.sh
<stdin>:16: NOTICE:  Slony-I: Please drop schema "_testdb3_cluster"
<stdin>:16: NOTICE:  drop cascades to 162 other objects
DETAIL:  drop cascades to table _testdb3_cluster.sl_node
drop cascades to table _testdb3_cluster.sl_nodelock
drop cascades to table _testdb3_cluster.sl_set
drop cascades to table _testdb3_cluster.sl_setsync
drop cascades to table _testdb3_cluster.sl_table
drop cascades to table _testdb3_cluster.sl_sequence
drop cascades to table _testdb3_cluster.sl_path
drop cascades to table _testdb3_cluster.sl_listen
drop cascades to table _testdb3_cluster.sl_subscribe
drop cascades to table _testdb3_cluster.sl_event
drop cascades to table _testdb3_cluster.sl_confirm
drop cascades to table _testdb3_cluster.sl_seqlog
drop cascades to function _testdb3_cluster.sequencelastvalue(text)
drop cascades to table _testdb3_cluster.sl_log_1
drop cascades to table _testdb3_cluster.sl_log_2
drop cascades to table _testdb3_cluster.sl_registry
drop cascades to view _testdb3_cluster.sl_seqlastvalue
drop cascades to sequence _testdb3_cluster.sl_local_node_id
drop cascades to sequence _testdb3_cluster.sl_event_seq
drop cascades to sequence _testdb3_cluster.sl_action_seq
drop cascades to sequence _testdb3_cluster.sl_log_status
drop cascades to table _testdb3_cluster.sl_config_lock
drop cascades to table _testdb3_cluster.sl_event_lock
drop cascades to table _testdb3_cluster.sl_archive_counter
drop cascades to table _testdb3_cluster.sl_components
drop cascades to type _testdb3_cluster.vactables
drop cascades to function _testdb3_cluster.createevent(name,text)
drop cascades to function _testdb3_cluster.createevent(name,text,text)
drop cascades to function _testdb3_cluster.createevent(name,text,text,text)
drop cascades to function _testdb3_cluster.createevent(name,text,text,text,text)
drop cascades to function _testdb3_cluster.createevent(name,text,text,text,text,text)
drop cascades to function _testdb3_cluster.createevent(name,text,text,text,text,text,text)
drop cascades to function _testdb3_cluster.createevent(name,text,text,text,text,text,text,text)
drop cascades to function _testdb3_cluster.createevent(name,text,text,text,text,text,text,text,text)
drop cascades to function _testdb3_cluster.createevent(name,text,text,text,text,text,text,text,text,text)
drop cascades to function _testdb3_cluster.denyaccess()
drop cascades to trigger _testdb3_cluster_denyaccess on table t1
drop cascades to function _testdb3_cluster.lockedset()
drop cascades to function _testdb3_cluster.getlocalnodeid(name)
drop cascades to function _testdb3_cluster.getmoduleversion()
drop cascades to function _testdb3_cluster.resetsession()
drop cascades to function _testdb3_cluster.checkmoduleversion()
drop cascades to function _testdb3_cluster.decode_tgargs(bytea)
drop cascades to function _testdb3_cluster.logtrigger()
drop cascades to trigger _testdb3_cluster_logtrigger on table t1
drop cascades to function _testdb3_cluster.terminatenodeconnections(integer)
drop cascades to function _testdb3_cluster.killbackend(integer,text)
drop cascades to function _testdb3_cluster.seqtrack(integer,bigint)
drop cascades to function _testdb3_cluster.slon_quote_brute(text)
drop cascades to function _testdb3_cluster.slon_quote_input(text)
drop cascades to function _testdb3_cluster.slonyversionmajor()
drop cascades to function _testdb3_cluster.slonyversionminor()
drop cascades to function _testdb3_cluster.slonyversionpatchlevel()
drop cascades to function _testdb3_cluster.slonyversion()
drop cascades to function _testdb3_cluster.registry_set_int4(text,integer)
drop cascades to function _testdb3_cluster.registry_get_int4(text,integer)
drop cascades to function _testdb3_cluster.registry_set_text(text,text)
drop cascades to function _testdb3_cluster.registry_get_text(text,text)
drop cascades to function _testdb3_cluster.registry_set_timestamp(text,timestamp with time zone)
drop cascades to function _testdb3_cluster.registry_get_timestamp(text,timestamp with time zone)
drop cascades to function _testdb3_cluster.cleanupnodelock()
drop cascades to function _testdb3_cluster.registernodeconnection(integer)
drop cascades to function _testdb3_cluster.initializelocalnode(integer,text)
drop cascades to function _testdb3_cluster.storenode(integer,text)
drop cascades to function _testdb3_cluster.storenode_int(integer,text)
drop cascades to function _testdb3_cluster.enablenode(integer)
drop cascades to function _testdb3_cluster.enablenode_int(integer)
drop cascades to function _testdb3_cluster.disablenode(integer)
drop cascades to function _testdb3_cluster.disablenode_int(integer)
drop cascades to function _testdb3_cluster.dropnode(integer)
drop cascades to function _testdb3_cluster.dropnode_int(integer)
drop cascades to function _testdb3_cluster.failednode(integer,integer)
drop cascades to function _testdb3_cluster.failednode2(integer,integer,integer,bigint,bigint)
drop cascades to function _testdb3_cluster.failoverset_int(integer,integer,integer,bigint)
drop cascades to function _testdb3_cluster.uninstallnode()
drop cascades to function _testdb3_cluster.clonenodeprepare(integer,integer,text)
drop cascades to function _testdb3_cluster.clonenodeprepare_int(integer,integer,text)
drop cascades to function _testdb3_cluster.clonenodefinish(integer,integer)
drop cascades to function _testdb3_cluster.storepath(integer,integer,text,integer)
drop cascades to function _testdb3_cluster.storepath_int(integer,integer,text,integer)
drop cascades to function _testdb3_cluster.droppath(integer,integer)
drop cascades to function _testdb3_cluster.droppath_int(integer,integer)
drop cascades to function _testdb3_cluster.storelisten(integer,integer,integer)
drop cascades to function _testdb3_cluster.storelisten_int(integer,integer,integer)
drop cascades to function _testdb3_cluster.droplisten(integer,integer,integer)
drop cascades to function _testdb3_cluster.droplisten_int(integer,integer,integer)
drop cascades to function _testdb3_cluster.storeset(integer,text)
drop cascades to function _testdb3_cluster.storeset_int(integer,integer,text)
drop cascades to function _testdb3_cluster.lockset(integer)
drop cascades to function _testdb3_cluster.unlockset(integer)
drop cascades to function _testdb3_cluster.moveset(integer,integer)
drop cascades to function _testdb3_cluster.moveset_int(integer,integer,integer,bigint)
drop cascades to function _testdb3_cluster.dropset(integer)
drop cascades to function _testdb3_cluster.dropset_int(integer)
drop cascades to function _testdb3_cluster.mergeset(integer,integer)
drop cascades to function _testdb3_cluster.issubscriptioninprogress(integer)
drop cascades to function _testdb3_cluster.mergeset_int(integer,integer)
drop cascades to function _testdb3_cluster.setaddtable(integer,integer,text,name,text)
drop cascades to function _testdb3_cluster.setaddtable_int(integer,integer,text,name,text)
drop cascades to function _testdb3_cluster.setdroptable(integer)
and 62 other objects (see server log for list)
<stdin>:17: NOTICE:  Slony-I: Please drop schema "_testdb3_cluster"
<stdin>:17: NOTICE:  drop cascades to 162 other objects
DETAIL:  drop cascades to table _testdb3_cluster.sl_node
drop cascades to table _testdb3_cluster.sl_nodelock
drop cascades to table _testdb3_cluster.sl_set
drop cascades to table _testdb3_cluster.sl_setsync
drop cascades to table _testdb3_cluster.sl_table
drop cascades to table _testdb3_cluster.sl_sequence
drop cascades to table _testdb3_cluster.sl_path
drop cascades to table _testdb3_cluster.sl_listen
drop cascades to table _testdb3_cluster.sl_subscribe
drop cascades to table _testdb3_cluster.sl_event
drop cascades to table _testdb3_cluster.sl_confirm
drop cascades to table _testdb3_cluster.sl_seqlog
drop cascades to function _testdb3_cluster.sequencelastvalue(text)
drop cascades to table _testdb3_cluster.sl_log_1
drop cascades to table _testdb3_cluster.sl_log_2
drop cascades to table _testdb3_cluster.sl_registry
drop cascades to view _testdb3_cluster.sl_seqlastvalue
drop cascades to sequence _testdb3_cluster.sl_local_node_id
drop cascades to sequence _testdb3_cluster.sl_event_seq
drop cascades to sequence _testdb3_cluster.sl_action_seq
drop cascades to sequence _testdb3_cluster.sl_log_status
drop cascades to table _testdb3_cluster.sl_config_lock
drop cascades to table _testdb3_cluster.sl_event_lock
drop cascades to table _testdb3_cluster.sl_archive_counter
drop cascades to table _testdb3_cluster.sl_components
drop cascades to type _testdb3_cluster.vactables
drop cascades to function _testdb3_cluster.createevent(name,text)
drop cascades to function _testdb3_cluster.createevent(name,text,text)
drop cascades to function _testdb3_cluster.createevent(name,text,text,text)
drop cascades to function _testdb3_cluster.createevent(name,text,text,text,text)
drop cascades to function _testdb3_cluster.createevent(name,text,text,text,text,text)
drop cascades to function _testdb3_cluster.createevent(name,text,text,text,text,text,text)
drop cascades to function _testdb3_cluster.createevent(name,text,text,text,text,text,text,text)
drop cascades to function _testdb3_cluster.createevent(name,text,text,text,text,text,text,text,text)
drop cascades to function _testdb3_cluster.createevent(name,text,text,text,text,text,text,text,text,text)
drop cascades to function _testdb3_cluster.denyaccess()
drop cascades to trigger _testdb3_cluster_denyaccess on table t1
drop cascades to function _testdb3_cluster.lockedset()
drop cascades to function _testdb3_cluster.getlocalnodeid(name)
drop cascades to function _testdb3_cluster.getmoduleversion()
drop cascades to function _testdb3_cluster.resetsession()
drop cascades to function _testdb3_cluster.checkmoduleversion()
drop cascades to function _testdb3_cluster.decode_tgargs(bytea)
drop cascades to function _testdb3_cluster.logtrigger()
drop cascades to trigger _testdb3_cluster_logtrigger on table t1
drop cascades to function _testdb3_cluster.terminatenodeconnections(integer)
drop cascades to function _testdb3_cluster.killbackend(integer,text)
drop cascades to function _testdb3_cluster.seqtrack(integer,bigint)
drop cascades to function _testdb3_cluster.slon_quote_brute(text)
drop cascades to function _testdb3_cluster.slon_quote_input(text)
drop cascades to function _testdb3_cluster.slonyversionmajor()
drop cascades to function _testdb3_cluster.slonyversionminor()
drop cascades to function _testdb3_cluster.slonyversionpatchlevel()
drop cascades to function _testdb3_cluster.slonyversion()
drop cascades to function _testdb3_cluster.registry_set_int4(text,integer)
drop cascades to function _testdb3_cluster.registry_get_int4(text,integer)
drop cascades to function _testdb3_cluster.registry_set_text(text,text)
drop cascades to function _testdb3_cluster.registry_get_text(text,text)
drop cascades to function _testdb3_cluster.registry_set_timestamp(text,timestamp with time zone)
drop cascades to function _testdb3_cluster.registry_get_timestamp(text,timestamp with time zone)
drop cascades to function _testdb3_cluster.cleanupnodelock()
drop cascades to function _testdb3_cluster.registernodeconnection(integer)
drop cascades to function _testdb3_cluster.initializelocalnode(integer,text)
drop cascades to function _testdb3_cluster.storenode(integer,text)
drop cascades to function _testdb3_cluster.storenode_int(integer,text)
drop cascades to function _testdb3_cluster.enablenode(integer)
drop cascades to function _testdb3_cluster.enablenode_int(integer)
drop cascades to function _testdb3_cluster.disablenode(integer)
drop cascades to function _testdb3_cluster.disablenode_int(integer)
drop cascades to function _testdb3_cluster.dropnode(integer)
drop cascades to function _testdb3_cluster.dropnode_int(integer)
drop cascades to function _testdb3_cluster.failednode(integer,integer)
drop cascades to function _testdb3_cluster.failednode2(integer,integer,integer,bigint,bigint)
drop cascades to function _testdb3_cluster.failoverset_int(integer,integer,integer,bigint)
drop cascades to function _testdb3_cluster.uninstallnode()
drop cascades to function _testdb3_cluster.clonenodeprepare(integer,integer,text)
drop cascades to function _testdb3_cluster.clonenodeprepare_int(integer,integer,text)
drop cascades to function _testdb3_cluster.clonenodefinish(integer,integer)
drop cascades to function _testdb3_cluster.storepath(integer,integer,text,integer)
drop cascades to function _testdb3_cluster.storepath_int(integer,integer,text,integer)
drop cascades to function _testdb3_cluster.droppath(integer,integer)
drop cascades to function _testdb3_cluster.droppath_int(integer,integer)
drop cascades to function _testdb3_cluster.storelisten(integer,integer,integer)
drop cascades to function _testdb3_cluster.storelisten_int(integer,integer,integer)
drop cascades to function _testdb3_cluster.droplisten(integer,integer,integer)
drop cascades to function _testdb3_cluster.droplisten_int(integer,integer,integer)
drop cascades to function _testdb3_cluster.storeset(integer,text)
drop cascades to function _testdb3_cluster.storeset_int(integer,integer,text)
drop cascades to function _testdb3_cluster.lockset(integer)
drop cascades to function _testdb3_cluster.unlockset(integer)
drop cascades to function _testdb3_cluster.moveset(integer,integer)
drop cascades to function _testdb3_cluster.moveset_int(integer,integer,integer,bigint)
drop cascades to function _testdb3_cluster.dropset(integer)
drop cascades to function _testdb3_cluster.dropset_int(integer)
drop cascades to function _testdb3_cluster.mergeset(integer,integer)
drop cascades to function _testdb3_cluster.issubscriptioninprogress(integer)
drop cascades to function _testdb3_cluster.mergeset_int(integer,integer)
drop cascades to function _testdb3_cluster.setaddtable(integer,integer,text,name,text)
drop cascades to function _testdb3_cluster.setaddtable_int(integer,integer,text,name,text)
drop cascades to function _testdb3_cluster.setdroptable(integer)
and 62 other objects (see server log for list)
[postgres@pg100 ~]$ 

删除成功。 

原文地址:https://www.cnblogs.com/gaojian/p/3197942.html