mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-06-15 02:40:28 +00:00
xCAT-client: allow pgsqlsetup(1) to accept additional listen_addresses (#3519)
This commit is contained in:
@ -72,6 +72,7 @@ $::pgcmddir = "/usr/bin"; # pg cmds location
|
||||
$::debiancfgdir = "/etc/postgresql/9.1/main";
|
||||
my $INIT;
|
||||
my $SETUPODBC;
|
||||
my @LISTENADDRS;
|
||||
my $NOSTART;
|
||||
my $SETUPPCM;
|
||||
my $HELP;
|
||||
@ -83,6 +84,7 @@ if (
|
||||
!GetOptions(
|
||||
'i|init' => \$INIT,
|
||||
'o|odbc' => \$SETUPODBC,
|
||||
'l|listen=s'=> \@LISTENADDRS,
|
||||
'N|nostart' => \$NOSTART,
|
||||
'P|PCM' => \$SETUPPCM,
|
||||
'h|help' => \$HELP,
|
||||
@ -128,6 +130,13 @@ if ((!($INIT)) && ($SETUPODBC))
|
||||
|
||||
}
|
||||
|
||||
# create comma-separated list of additional listen addresses
|
||||
my $listenaddrs = undef;
|
||||
if (@LISTENADDRS)
|
||||
{
|
||||
$listenaddrs = join ',', @LISTENADDRS;
|
||||
}
|
||||
|
||||
#
|
||||
# Get OS
|
||||
#
|
||||
@ -428,7 +437,7 @@ sub usage
|
||||
"Usage:\npgsqlsetup - Performs the setup of PostgreSQL for xCAT to use as its database. See man pgsqlsetup for more information."
|
||||
);
|
||||
my $msg =
|
||||
"pgsqlsetup <-h|--help>\n <-v|--version>\n <-i|--init> [-N|--nostart] [-P|--PCM] [-o|--odbc] [-V|--verbose]\n <-o|--odbc> [-V|--verbose]";
|
||||
"pgsqlsetup <-h|--help>\n <-v|--version>\n <-i|--init> [-N|--nostart] [-l|--listen address] [-P|--PCM] [-o|--odbc] [-V|--verbose]\n <-o|--odbc> [-V|--verbose]";
|
||||
|
||||
xCAT::MsgUtils->message('I', "$msg");
|
||||
}
|
||||
@ -789,6 +798,10 @@ sub initpgdb
|
||||
if ($::osname eq 'Linux')
|
||||
{
|
||||
$cmd = qq~ echo listen_addresses = \\'localhost,$::MN\\' >> $pgconf~;
|
||||
if ($::listenaddrs)
|
||||
{
|
||||
$cmd = qq~ echo listen_addresses = \\'localhost,$::MN,$::listenaddrs\\' >> $pgconf~;
|
||||
}
|
||||
`$cmd`;
|
||||
}
|
||||
|
||||
@ -796,6 +809,10 @@ sub initpgdb
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
$cmd = qq~ echo listen_addresses = \\'$::MN\\' >> $pgconf~;
|
||||
if ($::listenaddrs)
|
||||
{
|
||||
$cmd = qq~ echo listen_addresses = \\'$::MN,$::listenaddrs\\' >> $pgconf~;
|
||||
}
|
||||
`$cmd`;
|
||||
$cmd = qq~echo logging_collector = on >> $pgconf~;
|
||||
`$cmd`;
|
||||
|
@ -9,7 +9,7 @@ B<pgsqlsetup> {B<-h> | B<--help>}
|
||||
|
||||
B<pgsqlsetup> {B<-v> | B<--version>}
|
||||
|
||||
B<pgsqlsetup> {B<-i> | B<--init>} [B<-N> | B<--nostart>] [B<-P> | B<--PCM>] [B<-o> | B<--odbc>] [B<-V> | B<--verbose>]
|
||||
B<pgsqlsetup> {B<-i> | B<--init>} [B<-N> | B<--nostart>] [B<--listen> | B<-l> I<address>] [B<-P> | B<--PCM>] [B<-o> | B<--odbc>] [B<-V> | B<--verbose>]
|
||||
|
||||
B<pgsqlsetup> {B<-o> | B<--setupODBC>} [B<-V> | B<--verbose>]
|
||||
|
||||
@ -46,6 +46,10 @@ For more documentation see:Setting_Up_PostgreSQL_as_the_xCAT_DB
|
||||
|
||||
This option with the -i flag will create the database, but will not backup and restore xCAT tables into the database. It will create the cfgloc file such that the next start of xcatd will try and contact the database. This can be used to setup the xCAT PostgreSQL database during or before install.
|
||||
|
||||
=item B<-l|--listen> I<address>
|
||||
|
||||
This option is used to specify additional IP addresses on which the PostgreSQL database will listen. Without it, only localhost (on Linux) and the management node's main IP (on Linux and AIX) will be configured. This option can be specified multiple times.
|
||||
|
||||
=item B<-P|--PCM>
|
||||
|
||||
This option sets up PostgreSQL database to be used with xCAT running with PCM.
|
||||
|
Reference in New Issue
Block a user