Menu

#4217 [FVT]pgsqlsetup -i failed to start postgresql

2.8.5
closed
yangsong
None
database
7
2014-08-28
2014-07-15
No

xCAT 2.8.5 20140710 build.

[root@p7hvs7br01 ~]# pgsqlsetup -i -V
Running command on p7hvs7br01.clusters.com: rpm -qa | grep perl-DBD-Pg 2>&1

Running command on p7hvs7br01.clusters.com: rpm -qa | grep postgresql 2>&1

Running command on p7hvs7br01.clusters.com: ps -ef | grep postgres 2>&1

Input the password for xcatadm id:
Backing up xCAT Database to /root/xcat-dbback.
This could take several minutes.
Running command on p7hvs7br01.clusters.com: mkdir -p /root/xcat-dbback 2>&1

Running command on p7hvs7br01.clusters.com: XCATBYPASS=1 dumpxCATdb -p /root/xcat-dbback 2>&1

Shutting down the xcatd daemon during database migration.
Stopping xcatd (via systemctl): [ OK ]
Running command on p7hvs7br01.clusters.com: grep master /root/xcat-dbback/site.csv 2>&1

The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

fixing permissions on existing directory /var/lib/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in /var/lib/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

/usr/bin/postgres -D /var/lib/pgsql/data

or
/usr/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start

Running command on p7hvs7br01.clusters.com: fgrep 9.114.34.64 /var/lib/pgsql/data/pg_hba.conf 2>&1

Running command on p7hvs7br01.clusters.com: cp /var/lib/pgsql/data/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf.org 2>&1

Running command on p7hvs7br01.clusters.com: awk '{gsub("IPv4 local connections:","IPv4 local connections:\nhost all all 9.114.34.64/32 md5 "); print}' /var/lib/pgsql/data/pg_hba.conf > /var/lib/pgsql/data/pg_hba.conf.xcat 2>&1

Running command on p7hvs7br01.clusters.com: cp -p /var/lib/pgsql/data/pg_hba.conf.xcat /var/lib/pgsql/data/pg_hba.conf 2>&1

Running command on p7hvs7br01.clusters.com: rm /var/lib/pgsql/data/pg_hba.conf.xcat 2>&1

Running command on p7hvs7br01.clusters.com: fgrep "setup by xCAT" /var/lib/pgsql/data/postgresql.conf 2>&1

Running command on p7hvs7br01.clusters.com: chown postgres /var/lib/pgsql/data/* 2>&1

Running command on p7hvs7br01.clusters.com: chgrp postgres /var/lib/pgsql/data/* 2>&1

Starting the PosgreSQL Server
failed to start postgresql.
[root@p7hvs7br01 ~]# echo $?
1
[root@p7hvs7br01 ~]# lsxcatd -v
Unable to open socket connection to xcatd daemon on localhost:3001.
Verify that the xcatd daemon is running and that your SSL setup is correct.
Connection failure: IO::Socket::INET: connect: Connection refused at /opt/xcat/lib/perl/xCAT/Client.pm line 217.
[root@p7hvs7br01 ~]# service xcatd status
cat: /var/run/xcatd.pid: No such file or directory
xCAT service is not running

Some debug information:
Missing pggresql in hash %svchash

3563 #--------------------------------------------------------------------------------
3564 sub servicemap{
3565 my $svcname=shift;
3566 if( $svcname =~ /xCAT::Utils/)
3567 {
3568 $svcname=shift;
3569 }
3570
3571 my $svcmgrtype=shift;
3572
3573
3574 #hash structure:
3575 #"service name $svcname" =>{
3576 #"service manager name(SYSVinit/systemd) $svcmgrtype"
3577 #=> ["list of possible service file names for the specified $svcname under the specified $svcmgrtype "]
3578 # }
3579 my %svchash=(
3580 "dhcp" => ["dhcp3-server","dhcpd","isc-dhcp-server"],
3581 "nfs" => ["nfsserver","nfs-server","nfs","nfs-kernel-server"],
3582 "named" => ["named","bind9"],
3583 "syslog" => ["syslog","syslogd","rsyslog"],
3584 "firewall" => ["iptables","firewalld","SuSEfirewall2_setup","ufw"],
3585 "http" => ["apache2","httpd"],
3586 "ntpserver" =>["ntpd","ntp"],
3587 "mysql" => ["mysqld","mysql"],
3588 );

Discussion

  • yangsong

    yangsong - 2014-07-15

    hi, there are some problems in service stuff in Utils.pm and xcatlib.sh, I have checked in the fix in 2.8.5 and 2.9, it need to be verified.

    commit 4fb700d3fd522c6e5b2234dd7c17fe248ab530f5
    Author: immarvin yangsbj@cn.ibm.com
    Date: Tue Jul 15 03:10:05 2014 -0700

    fix the defect #4217 [FVT]pgsqlsetup -i failed to start postgresql
    

    diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm
    index 56e4953..1c6deb8 100644
    --- a/perl-xCAT/xCAT/Utils.pm
    +++ b/perl-xCAT/xCAT/Utils.pm
    @@ -3595,7 +3595,7 @@ sub servicemap{
    }elsif ($svcmgrtype == 1){
    $path="/usr/lib/systemd/system/";
    $postfix=".service";
    - $retdefault=$svcname.".service";
    +# $retdefault=$svcname.".service";
    }elsif ($svcmgrtype == 2){
    $path="/etc/init/";
    $postfix=".conf";
    diff --git a/xCAT/postscripts/xcatlib.sh b/xCAT/postscripts/xcatlib.sh
    index 46d9d3a..e6fec7f 100644
    --- a/xCAT/postscripts/xcatlib.sh
    +++ b/xCAT/postscripts/xcatlib.sh
    @@ -298,7 +298,7 @@ function servicemap {
    if [ "$svcmgrtype" = "0" ];then
    path="/etc/init.d/"
    elif [ "$svcmgrtype" = "1" ];then
    - retdefault=$svcname.service
    + #retdefault=$svcname.service
    path="/usr/lib/systemd/system/"
    postfix=".service"
    elif [ "$svcmgrtype" = "2" ];then


    commit dd1478c5e17f890db7123d512a4e5c9407d42aaf
    Author: immarvin yangsbj@cn.ibm.com
    Date: Tue Jul 15 03:10:05 2014 -0700

    fix the defect #4217 [FVT]pgsqlsetup -i failed to start postgresql
    

    diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm
    index ee19a60..8d75343 100644
    --- a/perl-xCAT/xCAT/Utils.pm
    +++ b/perl-xCAT/xCAT/Utils.pm
    @@ -3624,7 +3624,7 @@ sub servicemap{
    }elsif ($svcmgrtype == 1){
    $path="/usr/lib/systemd/system/";
    $postfix=".service";
    - $retdefault=$svcname.".service";
    +# $retdefault=$svcname.".service";
    }elsif ($svcmgrtype == 2){
    $path="/etc/init/";
    $postfix=".conf";
    diff --git a/xCAT/postscripts/xcatlib.sh b/xCAT/postscripts/xcatlib.sh
    index fb96e13..65b8984 100644
    --- a/xCAT/postscripts/xcatlib.sh
    +++ b/xCAT/postscripts/xcatlib.sh
    @@ -298,7 +298,7 @@ function servicemap {
    if [ "$svcmgrtype" = "0" ];then
    path="/etc/init.d/"
    elif [ "$svcmgrtype" = "1" ];then
    - retdefault=$svcname.service
    + #retdefault=$svcname.service
    path="/usr/lib/systemd/system/"
    postfix=".service"
    elif [ "$svcmgrtype" = "2" ];then

     
  • Lissa Valletta

    Lissa Valletta - 2014-07-15
    • assigned_to: Lissa Valletta --> yangsong
     
  • Lissa Valletta

    Lissa Valletta - 2014-07-15

    Yang Song should postgresql be added to the svchash as was suggested. It seems if mysql is there, it should be there. You did not do that. Although I do not see xcatd there either.

     
    • yangsong

      yangsong - 2014-07-16

      hi Lissa, according to the code logic, %svchash includes all the possible service names among different os distributions and releases, i.e, /etc/init.d/xxx for SysVinit, /etc/init/xxx.conf for Upstart and /usr/lib/systemd/system/xxx.service for Systemd. If there are only 1 service name for the given service, we do not need to specify it in %svchash, the argument can be used as the service name.

       
  • Lissa Valletta

    Lissa Valletta - 2014-07-16

    It would be good to add this additional information on the comments for svchash in Utils.pm It is not clear that you would not put one in their if there was only one possible name.

     
    • yangsong

      yangsong - 2014-07-23

      comments added:
      commit aac3f853f1e47dcfbc2f7cc015c3e6fa0f993af2
      Author: immarvin yangsbj@cn.ibm.com
      Date: Thu Jul 17 08:03:58 2014 -0700

      add comment for servicemap subroutine
      

      diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm
      index 1c6deb8..5717a03 100644
      --- a/perl-xCAT/xCAT/Utils.pm
      --- a/perl-xCAT/xCAT/Utils.pm
      +++ b/perl-xCAT/xCAT/Utils.pm
      @@ -3576,6 +3576,13 @@ sub servicemap{
      #"service manager name(SYSVinit/systemd) $svcmgrtype"
      #=> ["list of possible service file names for the specified $svcname under th
      # }
      + #
      + #
      + # if there are more than 1 possible service names for a service among
      + # different os distributions and os releases, the service should be
      + # specified in %svchash with structure
      + # (general service name) => {list of possible service names}
      + #
      my %svchash=(
      "dhcp" => ["dhcp3-server","dhcpd","isc-dhcp-server"]
      ,
      "nfs" => ["nfsserver","nfs-server","nfs","nfs-kernel-server"],
      diff --git a/xCAT/postscripts/xcatlib.sh b/xCAT/postscripts/xcatlib.sh
      index e6fec7f..d1a4d08 100644
      --- a/xCAT/postscripts/xcatlib.sh
      +++ b/xCAT/postscripts/xcatlib.sh
      @@ -273,6 +273,11 @@ function servicemap {
      local svcmgrtype=$2
      local svclistname=

      • if there are more than 1 possible service names for a service among

      • different os distributions and os releases, the service should be

      • specified with structure

      • INIT_(general service name) = "list of possible service names"

      • INIT_dhcp="dhcp3-server dhcpd isc-dhcp-server";

        INIT_nfs="nfsserver nfs-server nfs nfs-kernel-server";

      commit 07d51d6e5ef74bf1d369976ad3f705f3d89f9071
      Author: immarvin yangsbj@cn.ibm.com
      Date: Thu Jul 17 08:03:58 2014 -0700

      add comment for servicemap subroutine
      

      diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm
      index 8d75343..1180656 100644
      --- a/perl-xCAT/xCAT/Utils.pm
      +++ b/perl-xCAT/xCAT/Utils.pm
      @@ -3605,6 +3605,13 @@ sub servicemap{
      #"service manager name(SYSVinit/systemd) $svcmgrtype"
      #=> ["list of possible service file names for the specified $svcname under th
      # }
      + #
      + #
      + # if there are more than 1 possible service names for a service among
      + # different os distributions and os releases, the service should be
      + # specified in %svchash with structure
      + # (general service name) => {list of possible service names}
      + #
      my %svchash=(
      "dhcp" => ["dhcp3-server","dhcpd","isc-dhcp-server"]
      ,
      "nfs" => ["nfsserver","nfs-server","nfs","nfs-kernel-server"],
      diff --git a/xCAT/postscripts/xcatlib.sh b/xCAT/postscripts/xcatlib.sh
      index 65b8984..ff17a7b 100644
      --- a/xCAT/postscripts/xcatlib.sh
      +++ b/xCAT/postscripts/xcatlib.sh
      @@ -273,6 +273,11 @@ function servicemap {
      local svcmgrtype=$2
      local svclistname=

      • if there are more than 1 possible service names for a service among

      • different os distributions and os releases, the service should be

      • specified with structure

      • INIT_(general service name) = "list of possible service names"

      • INIT_dhcp="dhcp3-server dhcpd isc-dhcp-server";

        INIT_nfs="nfsserver nfs-server nfs nfs-kernel-server";

       
  • yangsong

    yangsong - 2014-07-23
    • status: open --> pending
     
  • ting ting li

    ting ting li - 2014-08-21
    • status: pending --> closed