/usr/bin/slonik_drop_node is in slony1-2-bin 2.2.5-2+b1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | #!/usr/bin/perl
#
# Author: Christopher Browne
# Copyright 2004-2009 Afilias Canada
use Getopt::Long;
# Defaults
$CONFIG_FILE = '/etc/slony1/slon_tools.conf';
$SHOW_USAGE = 0;
# Read command-line options
GetOptions("config=s" => \$CONFIG_FILE,
"help" => \$SHOW_USAGE);
my $USAGE =
"Usage: drop_node [--config file] node# event_node#
Drops a node.
node# is the id of the node in config file you wish to remove from cluster.
event_node# is the node number of the current origin node; the one capable of
sending notification to other nodes.
This will lead to Slony-I dropping the triggers (generally that deny the
ability to update data), restoring the \"native\" triggers, dropping the
schema used by Slony-I, and the slon process for that node terminating
itself.
As a result, the database should be available for whatever use your
application makes of the database.
This is a pretty major operation, with considerable potential to cause
substantial destruction; make sure you drop the right node!
The operation will fail if there are any nodes subscribing to the node
that you attempt to drop, so there is a bit of a failsafe to protect
you from errors.
";
if ($SHOW_USAGE) {
print $USAGE;
exit 0;
}
require '/usr/share/slony1/slon-tools.pm';
require $CONFIG_FILE;
my ($node, $event_node) = @ARGV;
if ($node =~ /^(?:node)?(\d+)$/) {
$node = $1;
} else {
die $USAGE;
}
if ($event_node =~ /^(?:node)?(\d+)$/) {
$event_node = $1;
} else {
print "Need to specify event node!\n";
die $USAGE;
}
my $slonik = '';
$slonik .= genheader();
$slonik .= " drop node (id = $node, event node = $event_node);\n";
$slonik .= " echo 'dropped node $node cluster';\n";
run_slonik_script($slonik, 'DROP NODE');
|