bash -x /usr/local/bin/pgpool_setup > ../pgpool_setup_output + BASEPORT=11000 ++ expr 11000 + 2 + PGBASEPORT=11002 + NUMCLUSTERS=2 + PGPOOL_INSTALL_DIR=/usr/local + PGPOOLDIR=/usr/local/etc + PGBIN=/usr/local/pgsql/bin + LPATH=/usr/local/pgsql/lib + PGSOCKET_DIR=/tmp + INITDBARG='--no-locale -E UTF_8' ++ whoami + WHOAMI=root ++ pwd + BASEDIR=/root/yugandha/pgpool2/o + INITDB=/usr/local/pgsql/bin/initdb + PG_CTL=/usr/local/pgsql/bin/pg_ctl + PSQL=/usr/local/pgsql/bin/psql + CONF=/root/yugandha/pgpool2/o/etc/pgpool.conf + FAILOVER_SCRIPT=/root/yugandha/pgpool2/o/etc/failover.sh + FOLLOW_MASTER_SCRIPT=/root/yugandha/pgpool2/o/etc/follow_master.sh + PGPOOL_REMOTE_START_SCRIPT=pgpool_remote_start + STARTALL=/root/yugandha/pgpool2/o/startall + SHUTDOWNALL=/root/yugandha/pgpool2/o/shutdownall + PCP_PASS_FILE=/root/yugandha/pgpool2/o/pcppass + PGPOOL_RELOAD=/root/yugandha/pgpool2/o/pgpool_reload + MODE=s + NO_STOP=false + '[' 0 -gt 0 ']' + case $MODE in + MODENAME='streaming replication mode' + SAMPLE_CONF=/usr/local/etc/pgpool.conf.sample-stream ++ /bin/ls + '[' '' '!=' '' ']' + exec + echo 'Satrting set up in streaming replication mode' + ORIG_BASEPORT=11000 + BASEPORT=11002 + test '!' -d etc + mkdir etc + cp /usr/local/etc/pgpool.conf.sample-stream /root/yugandha/pgpool2/o/etc/pgpool.conf + echo 'creating startall and shutdownall' + echo LD_LIBRARY_PATH=:/usr/local/pgsql/lib + echo 'dir=`pwd`' + echo PGPOOL_INSTALL_DIR=/usr/local + chmod 755 /root/yugandha/pgpool2/o/startall + echo 'dir=`pwd`' + echo PGPOOL_INSTALL_DIR=/usr/local + echo '$PGPOOL_INSTALL_DIR/bin/pgpool -f $dir/etc/pgpool.conf -m f stop' + chmod 755 /root/yugandha/pgpool2/o/shutdownall + echo 'dir=`pwd`' + echo PGPOOL_INSTALL_DIR=/usr/local + echo '$PGPOOL_INSTALL_DIR/bin/pgpool -f $dir/etc/pgpool.conf reload' + chmod 755 /root/yugandha/pgpool2/o/pgpool_reload + echo 'creating failover script' + create_failover_script + n=0 + '[' 0 -lt 2 ']' ++ expr 0 + CLUSTER=data0 + CLUSTERDIR=/root/yugandha/pgpool2/o/data0 ++ expr 11002 + 0 + PORT=11002 + echo -n 'creating database cluster /root/yugandha/pgpool2/o/data0...' + /usr/local/pgsql/bin/initdb -D /root/yugandha/pgpool2/o/data0 --no-locale -E UTF_8 + echo done. + echo 'update postgreql.conf' + set_postgresql_conf /root/yugandha/pgpool2/o/data0 + echo 'creating pgpool_remote_start' + create_pgpool_remote_start_script /root/yugandha/pgpool2/o/data0 + echo 'creating basebackup.sh' + '[' s = s ']' + create_basebackup_stream /root/yugandha/pgpool2/o/data0 + '[' s = s ']' + echo 'creating recovery.conf' + create_recovery_conf /root/yugandha/pgpool2/o/data0 0 + echo '/usr/local/pgsql/bin/pg_ctl -D /root/yugandha/pgpool2/o/data0 -m f stop' + echo '/usr/local/pgsql/bin/pg_ctl -w -D /root/yugandha/pgpool2/o/data0 start' ++ expr 0 + 1 + n=1 + echo '#1 port is 11002' + '[' 1 -lt 2 ']' ++ expr 1 + CLUSTER=data1 + CLUSTERDIR=/root/yugandha/pgpool2/o/data1 ++ expr 11002 + 1 + PORT=11003 + echo -n 'creating database cluster /root/yugandha/pgpool2/o/data1...' + /usr/local/pgsql/bin/initdb -D /root/yugandha/pgpool2/o/data1 --no-locale -E UTF_8 + echo done. + echo 'update postgreql.conf' + set_postgresql_conf /root/yugandha/pgpool2/o/data1 + echo 'creating pgpool_remote_start' + create_pgpool_remote_start_script /root/yugandha/pgpool2/o/data1 + echo 'creating basebackup.sh' + '[' s = s ']' + create_basebackup_stream /root/yugandha/pgpool2/o/data1 + '[' s = s ']' + echo 'creating recovery.conf' + create_recovery_conf /root/yugandha/pgpool2/o/data1 1 + echo '/usr/local/pgsql/bin/pg_ctl -D /root/yugandha/pgpool2/o/data1 -m f stop' + echo '/usr/local/pgsql/bin/pg_ctl -w -D /root/yugandha/pgpool2/o/data1 start' ++ expr 1 + 1 + n=2 + echo '#2 port is 11003' + '[' 2 -lt 2 ']' + set_pgpool_conf /root/yugandha/pgpool2/o/etc/pgpool.conf + echo 'sr_check_user = '\''root'\''' + echo 'recovery_user = '\''root'\''' + echo 'recovery_password = '\'''\''' + echo 'recovery_1st_stage_command = '\''basebackup.sh'\''' + '[' s = r ']' + echo 'health_check_period = 10' + echo 'health_check_user = '\''root'\''' + OIDDIR=/root/yugandha/pgpool2/o/log/pgpool/oiddir + mkdir -p /root/yugandha/pgpool2/o/log/pgpool/oiddir + echo 'memqcache_oiddir = '\''/root/yugandha/pgpool2/o/log/pgpool/oiddir'\''' + echo 'log_per_node_statement = on' + '[' s = s ']' + echo 'failover_command = '\''/root/yugandha/pgpool2/o/etc/failover.sh %d %h %p %D %m %M %H %P %r %R'\''' + echo 'socket_dir = '\''/tmp'\''' + echo 'pcp_socket_dir = '\''/tmp'\''' + PGPOOL_PORT=11000 + echo 'port = 11000' ++ expr 11000 + 1 + PCP_PORT=11001 + echo 'pcp_port = 11001' + echo localhost:11001:root:root + chmod 0600 /root/yugandha/pgpool2/o/pcppass + test '!' -d run + mkdir run + echo 'pid_file_name = '\''/root/yugandha/pgpool2/o/run/pgpool.pid'\''' + test '!' -d log + echo 'logdir = '\''/root/yugandha/pgpool2/o/log'\''' + '[' '' = true ']' + echo '$PGPOOL_INSTALL_DIR/bin/pgpool -D -n -f $dir/etc/pgpool.conf -F $dir/etc/pcp.conf -a $dir/etc/pool_hba.conf 2>&1 | cat > $dir/log/pgpool.log &' + '[' -f /usr/local/etc/pcp.conf.sample ']' + cp /usr/local/etc/pcp.conf.sample etc/pcp.conf + echo -n root: + /usr/local/bin/pg_md5 root + /usr/local/bin/pg_md5 -m -f etc/pgpool.conf -u root root + mkdir archivedir + '[' s = s ']' + echo 'temporarily start data0 cluster to create extensions' + /usr/local/pgsql/bin/pg_ctl -w -D data0 start + /usr/local/pgsql/bin/psql -p 11002 template1 + n=0 + PORT=11002 ++ expr 0 + CLUSTER=data0 + CLUSTERDIR=/root/yugandha/pgpool2/o/data0 + echo 'backend_hostname0 = '\''/tmp'\''' + echo 'backend_port0 = 11002' + echo 'backend_weight0 = 1' + echo 'backend_data_directory0 = '\''/root/yugandha/pgpool2/o/data0'\''' + echo 'temporarily start pgpool-II to create standby nodes' + wait_for_pgpool_startup + timeout=20 + '[' 20 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + /usr/local/bin/pgpool -D -n -f /root/yugandha/pgpool2/o/etc/pgpool.conf -F /root/yugandha/pgpool2/o/etc/pcp.conf -a /root/yugandha/pgpool2/o/etc/pool_hba.conf + '[' 2 = 0 ']' ++ expr 20 - 1 + timeout=19 + sleep 1 + '[' 19 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + '[' 2 = 0 ']' ++ expr 19 - 1 + timeout=18 + sleep 1 + '[' 18 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + '[' 2 = 0 ']' ++ expr 18 - 1 + timeout=17 + sleep 1 + '[' 17 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + '[' 2 = 0 ']' ++ expr 17 - 1 + timeout=16 + sleep 1 + '[' 16 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + '[' 2 = 0 ']' ++ expr 16 - 1 + timeout=15 + sleep 1 + '[' 15 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + '[' 2 = 0 ']' ++ expr 15 - 1 + timeout=14 + sleep 1 + '[' 14 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + '[' 2 = 0 ']' ++ expr 14 - 1 + timeout=13 + sleep 1 + '[' 13 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + '[' 2 = 0 ']' ++ expr 13 - 1 + timeout=12 + sleep 1 + '[' 12 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + '[' 2 = 0 ']' ++ expr 12 - 1 + timeout=11 + sleep 1 + '[' 11 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + '[' 2 = 0 ']' ++ expr 11 - 1 + timeout=10 + sleep 1 + '[' 10 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + '[' 2 = 0 ']' ++ expr 10 - 1 + timeout=9 + sleep 1 + '[' 9 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + '[' 2 = 0 ']' ++ expr 9 - 1 + timeout=8 + sleep 1 + '[' 8 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + '[' 2 = 0 ']' ++ expr 8 - 1 + timeout=7 + sleep 1 + '[' 7 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + '[' 2 = 0 ']' ++ expr 7 - 1 + timeout=6 + sleep 1 + '[' 6 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + '[' 2 = 0 ']' ++ expr 6 - 1 + timeout=5 + sleep 1 + '[' 5 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + '[' 2 = 0 ']' ++ expr 5 - 1 + timeout=4 + sleep 1 + '[' 4 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + '[' 2 = 0 ']' ++ expr 4 - 1 + timeout=3 + sleep 1 + '[' 3 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + '[' 2 = 0 ']' ++ expr 3 - 1 + timeout=2 + sleep 1 + '[' 2 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + '[' 2 = 0 ']' ++ expr 2 - 1 + timeout=1 + sleep 1 + '[' 1 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' postgres + '[' 2 = 0 ']' ++ expr 1 - 1 + timeout=0 + sleep 1 + '[' 0 -gt 0 ']' + '[' 2 -gt 1 ']' + n=1 + '[' 1 -lt 2 ']' ++ expr 11002 + 1 + PORT=11003 + echo 'backend_hostname1 = '\''/tmp'\''' + echo 'backend_port1 = 11003' + echo 'backend_weight1 = 1' ++ expr 1 + CLUSTER=data1 + CLUSTERDIR=/root/yugandha/pgpool2/o/data1 + echo 'backend_data_directory1 = '\''/root/yugandha/pgpool2/o/data1'\''' ++ expr 1 + 1 + n=2 + '[' 2 -lt 2 ']' + /usr/local/bin/pgpool -f /root/yugandha/pgpool2/o/etc/pgpool.conf reload + wait_for_pgpool_reload 2 + timeout=20 + num_node=2 + '[' 20 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? ++ grep backend_data ++ wc -l + N=0 + '[' 0 = 2 ']' ++ expr 20 - 1 + timeout=19 + sleep 1 + '[' 19 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test ++ wc -l ++ grep backend_data psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? + N=0 + '[' 0 = 2 ']' ++ expr 19 - 1 + timeout=18 + sleep 1 + '[' 18 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test ++ wc -l psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? ++ grep backend_data + N=0 + '[' 0 = 2 ']' ++ expr 18 - 1 + timeout=17 + sleep 1 + '[' 17 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test ++ grep backend_data ++ wc -l psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? + N=0 + '[' 0 = 2 ']' ++ expr 17 - 1 + timeout=16 + sleep 1 + '[' 16 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test ++ wc -l ++ grep backend_data psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? + N=0 + '[' 0 = 2 ']' ++ expr 16 - 1 + timeout=15 + sleep 1 + '[' 15 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test ++ wc -l ++ grep backend_data psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? + N=0 + '[' 0 = 2 ']' ++ expr 15 - 1 + timeout=14 + sleep 1 + '[' 14 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test ++ wc -l ++ grep backend_data psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? + N=0 + '[' 0 = 2 ']' ++ expr 14 - 1 + timeout=13 + sleep 1 + '[' 13 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test ++ grep backend_data ++ wc -l psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? + N=0 + '[' 0 = 2 ']' ++ expr 13 - 1 + timeout=12 + sleep 1 + '[' 12 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test ++ grep backend_data ++ wc -l psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? + N=0 + '[' 0 = 2 ']' ++ expr 12 - 1 + timeout=11 + sleep 1 + '[' 11 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test ++ grep backend_data psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? ++ wc -l + N=0 + '[' 0 = 2 ']' ++ expr 11 - 1 + timeout=10 + sleep 1 + '[' 10 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test ++ wc -l psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? ++ grep backend_data + N=0 + '[' 0 = 2 ']' ++ expr 10 - 1 + timeout=9 + sleep 1 + '[' 9 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test ++ grep backend_data ++ wc -l psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? + N=0 + '[' 0 = 2 ']' ++ expr 9 - 1 + timeout=8 + sleep 1 + '[' 8 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test ++ wc -l ++ grep backend_data psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? + N=0 + '[' 0 = 2 ']' ++ expr 8 - 1 + timeout=7 + sleep 1 + '[' 7 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test ++ grep backend_data ++ wc -l psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? + N=0 + '[' 0 = 2 ']' ++ expr 7 - 1 + timeout=6 + sleep 1 + '[' 6 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test ++ wc -l ++ grep backend_data psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? + N=0 + '[' 0 = 2 ']' ++ expr 6 - 1 + timeout=5 + sleep 1 + '[' 5 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test ++ grep backend_data ++ wc -l psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? + N=0 + '[' 0 = 2 ']' ++ expr 5 - 1 + timeout=4 + sleep 1 + '[' 4 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test ++ wc -l ++ grep backend_data psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? + N=0 + '[' 0 = 2 ']' ++ expr 4 - 1 + timeout=3 + sleep 1 + '[' 3 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test ++ grep backend_data ++ wc -l psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? + N=0 + '[' 0 = 2 ']' ++ expr 3 - 1 + timeout=2 + sleep 1 + '[' 2 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test ++ wc -l psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? ++ grep backend_data + N=0 + '[' 0 = 2 ']' ++ expr 2 - 1 + timeout=1 + sleep 1 + '[' 1 -gt 0 ']' ++ /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_status' test ++ wc -l psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? ++ grep backend_data + N=0 + '[' 0 = 2 ']' ++ expr 1 - 1 + timeout=0 + sleep 1 + '[' 0 -gt 0 ']' + /usr/local/pgsql/bin/psql -p 11000 -c 'show pool_nodes' test psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? + export PCPPASSFILE=/root/yugandha/pgpool2/o/pcppass + PCPPASSFILE=/root/yugandha/pgpool2/o/pcppass + n=1 + '[' 1 -lt 2 ']' + echo -n 'recovery node 1...' + /usr/local/bin/pcp_recovery_node -w -h localhost -p 11001 -n 1 ERROR: node recovery failed, unable to connect to master node: 0 + echo done. ++ expr 1 + 1 + n=2 + '[' 2 -lt 2 ']' + '[' 2 -lt 2 ']' + '[' s = r -o s = n ']' + '[' s = s ']' + echo 'creating follow master script' + create_follow_master_script + echo 'follow_master_command = '\''/root/yugandha/pgpool2/o/etc/follow_master.sh %d %h %p %D %m %M %H %P %r %R'\''' + /usr/local/pgsql/bin/psql -p 11000 test psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.11000"? + echo 'pgpool port is 11000' + echo 'pcp port is 11001' + '[' false = false ']' + echo 'shutdown all' + /root/yugandha/pgpool2/o/shutdownall + echo 'export PGPOOL_PORT=11000' + echo 'export PCP_PORT=11001' + echo 'export PCPPASSFILE=/root/yugandha/pgpool2/o/pcppass' + chmod 755 bashrc.ports + echo + echo 'pgpool-II setting for streaming replication mode is done.' + echo 'To start the whole system, use /root/yugandha/pgpool2/o/startall.' + echo 'To shutdown the whole system, use /root/yugandha/pgpool2/o/shutdownall.' + echo 'pcp command user name is "root", password is "root".' + echo 'Each PostgreSQL, pgpool-II and pcp port is as follows:' + cat README.port + echo 'The info above is in README.port.' + '[' false = true ']'