/usr/bin/slonik_failover 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 | #!/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: slonik_failover [--config file] dead_node backup_node
Abandons dead_node, making backup_node the origin for all sets on
dead_node.
move_set should be used if dead_node is still available, so that
transactions are not lost.
";
if ($SHOW_USAGE) {
print $USAGE;
exit 0;
}
require '/usr/share/slony1/slon-tools.pm';
require $CONFIG_FILE;
my ($node1, $node2) = @ARGV;
if ($node1 =~ /^(?:node)?(\d+)$/) {
$node1 = $1;
} else {
die $USAGE;
}
if ($node2 =~ /^(?:node)?(\d+)$/) {
$node2 = $1;
} else {
die $USAGE;
}
my $slonik = '';
$slonik .= genheader();
$slonik .= " try {\n";
$slonik .= " failover (id = $node1, backup node = $node2);\n";
$slonik .= " } on error {\n";
$slonik .= " echo 'Failure to fail node $node1 over to $node2';\n";
$slonik .= " exit 1;\n";
$slonik .= " }\n";
$slonik .= " echo 'Replication sets originating on $node1 failed over to $node2';\n";
run_slonik_script($slonik, 'FAILOVER');
|