Fri Mar 11 18:55:46 PST 2005
- Previous message: [Slony1-commit] By cbbrowne: Per Bug #1152, add -U $dbuser parameter to database query
- Next message: [Slony1-commit] By cbbrowne: New Directory
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Log Message: ----------- Added --config and --help to uninstall_nodes.pl (last script). According to the documentation for UNINSTALL NODE, it already handles the various commands that were subsequently being sent to psql, so I've removed them from this script. Instead of just running UNINSTALL NODE on $MASTERNODE, run it on all nodes, doing $MASTERNODE last. Modified Files: -------------- slony1-engine/tools/altperl: uninstall_nodes.pl (r1.7 -> r1.8) -------------- next part -------------- Index: uninstall_nodes.pl =================================================================== RCS file: /usr/local/cvsroot/slony1/slony1-engine/tools/altperl/uninstall_nodes.pl,v retrieving revision 1.7 retrieving revision 1.8 diff -Ltools/altperl/uninstall_nodes.pl -Ltools/altperl/uninstall_nodes.pl -u -w -r1.7 -r1.8 --- tools/altperl/uninstall_nodes.pl +++ tools/altperl/uninstall_nodes.pl @@ -3,26 +3,38 @@ # Author: Christopher Browne # Copyright 2004 Afilias Canada +use Getopt::Long; + +# Defaults +$CONFIG_FILE = '@@SYSCONFDIR@@/slon_tools.conf'; +$SHOW_USAGE = 0; + +# Read command-line options +GetOptions("config=s" => \$CONFIG_FILE, + "help" => \$SHOW_USAGE); + +my $USAGE = +"Usage: uninstall_nodes [--config file] + + Removes Slony configuration from all nodes in a cluster. + +"; + +if ($SHOW_USAGE) { + print $USAGE; + exit 0; +} + require '@@PGLIBDIR@@/slon-tools.pm'; -require '@@SYSCONFDIR@@/slon_tools.conf'; +require $CONFIG_FILE; $FILE="/tmp/slonik.$$"; open(SLONIK, ">$FILE"); print SLONIK genheader(); -print SLONIK qq{ - uninstall node (id=$MASTERNODE); -}; -close SLONIK; -run_slonik_script($FILE); - foreach my $node (@NODES) { - foreach my $command ("drop schema _$CLUSTER_NAME cascade;") { - print $command, "\n"; - print `echo "$command" | psql -h $HOST[$node] -U $USER[$node] -d $DBNAME[$node] -p $PORT[$node]`; - } - foreach my $t (@SERIALTABLES) { - my $command = "alter table $t drop column \\\"_Slony-I_" . $CLUSTER_NAME . "_rowID\\\";"; - print $command, "\n"; - print `echo "$command" | psql -h $HOST[$node] -U $USER[$node] -d $DBNAME[$node] -p $PORT[$node]`; - } + next if $node == $MASTERNODE; # Do this one last + print SLONIK " uninstall node (id=$node);\n"; } +print SLONIK " uninstall node (id=$MASTERNODE);\n"; +close SLONIK; +run_slonik_script($FILE);
- Previous message: [Slony1-commit] By cbbrowne: Per Bug #1152, add -U $dbuser parameter to database query
- Next message: [Slony1-commit] By cbbrowne: New Directory
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list