Thread: Weird pg_ctl behaviour via ssh
Hello, I am fiddling around with pgpool-II and online recovery. Recovery depends on remote starting of a cluster. This means I need to ssh into a box, start clustern (with PITR recovery) and terminate that ssh connection. If I use the following script: ssh -T remote "export LD_LIBRARY_PATH=/opt/postgres-8.3.3/lib; nohup /opt/postgres-8.3.3/bin/pg_ctl -w -D /data/pg833-data start > /dev/null 2>&1;exit;" the script terminates earlier than the DB is up: /opt/postgres-8.3.3/bin/psql -h remote -p 5555 postgres psql: FATAL: the database system is starting up which is problem for pgpool. But if I use command: ssh -T remote "export LD_LIBRARY_PATH=/opt/postgres-8.3.3/lib; nohup /opt/postgres-8.3.3/bin/pg_ctl -w -D /data/pg833-data start 2>&1;exit;" the ssh never terminates. Which is, again problem for pg_pool. The outoput will be as bellow. How can I terminate the script really at the moment when DB is up? Thank you, Bohdan ... .FATAL: the database system is starting up .scp: /data/archive_log/00000004.history: No such file or directory could not start server scp: /data/archive_log/00000005.history: No such file or directory scp: /data/archive_log/00000006.history: No such file or directory scp: /data/archive_log/00000007.history: No such file or directory scp: /data/archive_log/00000008.history: No such file or directory scp: /data/archive_log/00000009.history: No such file or directory scp: /data/archive_log/0000000A.history: No such file or directory scp: /data/archive_log/0000000B.history: No such file or directory scp: /data/archive_log/0000000C.history: No such file or directory scp: /data/archive_log/0000000D.history: No such file or directory scp: /data/archive_log/0000000E.history: No such file or directory scp: /data/archive_log/0000000F.history: No such file or directory scp: /data/archive_log/00000010.history: No such file or directory scp: /data/archive_log/00000011.history: No such file or directory LOG: selected new timeline ID: 17 scp: /data/archive_log/00000001.history: No such file or directory LOG: archive recovery complete LOG: autovacuum launcher started LOG: database system is ready to accept connections
On Thu, Jul 31, 2008 at 11:24:35AM +0200, Bohdan Linda wrote: > /opt/postgres-8.3.3/bin/psql -h remote -p 5555 postgres > psql: FATAL: the database system is starting up > I am attaching additional info. The /dev/null is understable, but what I am worried is that if I query status of a server via: ssh -T remote "export LD_LIBRARY_PATH=/opt/postgres-8.3.3/lib; nohup /opt/postgres-8.3.3/bin/pg_ctl -w -D /data/pg833-data status 2>&1 I get: pg_ctl: server is running (PID: 14478) /opt/postgres-8.3.3/bin/postgres -D /data/pg833-data But still psql is returning: psql: FATAL: the database system is starting up Why we have such inconsistency? How to avoid it? Thank you, Bohdan