mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
Document upgrade process from repmgr3
Also provide unpackaged extension upgrade SQL, and a script to assist converting repmgr.conf files.
This commit is contained in:
88
contrib/convert-config.pl
Executable file
88
contrib/convert-config.pl
Executable file
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
|
||||
if (scalar @ARGV < 1) {
|
||||
print qq|Please provide path to the repmgr.conf file as first parameter\n|;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
my $file = $ARGV[0];
|
||||
|
||||
if (!-e $file) {
|
||||
print qq|Provide file "$file" does not exist\n|;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!-f $file) {
|
||||
print qq|Provide path "$file" does not point to a file\n|;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
my @outp = ();
|
||||
my $fh = undef;
|
||||
|
||||
if (!open ($fh, $file)){
|
||||
print qq|Unable to open "$file"\n|;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
my $data_directory_found = 0;
|
||||
|
||||
while(<$fh>) {
|
||||
my $line = $_;
|
||||
chomp $line;
|
||||
if ($line =~ m|\s*#|) {
|
||||
push @outp, $line;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($line !~ m|\s*(\S+?)\s*=(.+?)$|) {
|
||||
push @outp, $line;
|
||||
continue;
|
||||
}
|
||||
|
||||
my $param = $1;
|
||||
my $value = $2;
|
||||
|
||||
# These parameters can be removed:
|
||||
next if ($param eq 'cluster');
|
||||
|
||||
# These parameters can be renamed:
|
||||
if ($param eq 'node') {
|
||||
push @outp, qq|node_id=${value}|;
|
||||
}
|
||||
elsif ($param eq 'failover') {
|
||||
push @outp, qq|failover_mode=${value}|;
|
||||
}
|
||||
elsif ($param eq 'loglevel') {
|
||||
push @outp, qq|log_level=${value}|;
|
||||
}
|
||||
elsif ($param eq 'logfacility') {
|
||||
push @outp, qq|log_facility=${value}|;
|
||||
}
|
||||
elsif ($param eq 'logfile') {
|
||||
push @outp, qq|log_file=${value}|;
|
||||
}
|
||||
elsif ($param eq 'master_reponse_timeout') {
|
||||
push @outp, qq|async_query_timeout=${value}|;
|
||||
}
|
||||
else {
|
||||
if ($param eq 'data_directory') {
|
||||
$data_directory_found = 1;
|
||||
}
|
||||
push @outp, $line;
|
||||
}
|
||||
}
|
||||
|
||||
close $fh;
|
||||
|
||||
print join("\n", @outp);
|
||||
print "\n";
|
||||
|
||||
if ($data_directory_found == 0) {
|
||||
print "data_directory=\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user