This file is indexed.

/usr/bin/slonik_add_node is in slony1-2-bin 2.2.4-3.

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
70
71
#!/usr/bin/perl
# 
# Author: Gurjeet Singh

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: add_node [--config file] node# event_node#

    adds a node to the cluster.

event_node is the node number of the currnet origin node.
";

if ($SHOW_USAGE) {
  print $USAGE;
  exit 0;
}

require '/usr/share/slony1/slon-tools.pm';
require $CONFIG_FILE;

my ($addnode, $current_origin) = @ARGV;
if ($addnode =~ /^(?:node)?(\d+)$/) {
  $addnode = $1;
} else {
  die $USAGE;
}

if ($current_origin =~ /^(?:node)?(\d+)$/) {
  $current_origin = $1;
} else {
  die $USAGE;
}

my ($dbname, $dbhost) = ($DBNAME[$addnode], $HOST[$addnode]);

my $slonik = '';

$slonik .=  "\n# ADD NODE\n";
$slonik .= genheader();
$slonik .= "  try {\n";
$slonik .= "     store node (id = $addnode, event node = $current_origin, comment = 'Node $addnode - $dbname\@$dbhost');\n";
$slonik .= "  } on error {\n";
$slonik .= "      echo 'Failed to add node $node to cluster';\n";
$slonik .= "      exit 1;\n";
$slonik .= "  }\n";

# STORE PATH
$slonik .=  "\n# STORE PATHS\n";
foreach my $node (@NODES) {
  my $adddsn = $DSN[$addnode];
  if ($node != $addnode) {       # skip the master node; it's already initialized!
    my ($dbname, $dbhost, $nodedsn) = ($DBNAME[$node], $HOST[$node], $DSN[$node]);
    $slonik .= "  store path (server = $addnode, client = $node, conninfo = '$adddsn');\n";
    $slonik .= "  store path (server = $node, client = $addnode, conninfo = '$nodedsn');\n";
  }
}

$slonik .= "  echo 'added node $addnode to cluster';\n";
$slonik .= "  echo 'Please start a slon replication daemon for node $addnode';\n";

run_slonik_script($slonik, 'ADD NODE');