[CLUE-Tech] postgres restart failure

grant grant at amadensor.com
Thu Jun 6 17:58:53 MDT 2002


On Tue, 4 Jun 2002, Jason Friedman wrote:

> I tried to restart Postgres -- the stop succeeded but the start
> failed!  I determined the cause to be an open psql session.  Strange
> that this would cause a problem ...
>
Most likely, you did not actually shut down Postgres.  If you set the
shutdown to wait (-w, the default) it waits to shutdown the backends until
all clients are shutdown, but if you told it not to wait(-W) the shutdown
tool will exit and calim success (it sent the signal) even though all of
the clients are not closed.

You have 2 options:
1)  Set it to wait for the shutdown (the default)
2)  Do a forced shutdown (this will kill all backends, and psqls will drop
their connections when their backend goes down)

Here are my scripts:

pgstatus.sh
/usr/local/pgsql/bin/pg_ctl -D /home/postgres/data status

pgstart.sh
/usr/local/pgsql/bin/pg_ctl -D /home/postgres/data -l logfile -o -i start

pgstop.sh
/usr/local/pgsql/bin/pg_ctl -D /home/postgres/data -ms stop

pgkill.sh
/usr/local/pgsql/bin/pg_ctl -D /home/postgres/data -mf stop

pg_ctl is a utility to start, stop, restart, reload configuration files,
or report the status of a PostgreSQL server.

Usage:
  pg_ctl start   [-w] [-D DATADIR] [-s] [-l FILENAME] [-o "OPTIONS"]
  pg_ctl stop    [-W] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]
  pg_ctl restart [-w] [-D DATADIR] [-s] [-m SHUTDOWN-MODE] [-o "OPTIONS"]
  pg_ctl reload  [-D DATADIR] [-s]
  pg_ctl status  [-D DATADIR]

Common options:
  -D DATADIR            Location of the database storage area
  -s                    Only print errors, no informational messages
  -w                    Wait until operation completes
  -W                    Do not wait until operation completes
(The default is to wait for shutdown, but not for start or restart.)

If the -D option is omitted, the environment variable PGDATA is used.

Options for start or restart:
  -l FILENAME           Write (or append) server log to FILENAME.  The
                        use of this option is highly recommended.
  -o OPTIONS            Command line options to pass to the postmaster
                        (PostgreSQL server executable)
  -p PATH-TO-POSTMASTER Normally not necessary

Options for stop or restart:
  -m SHUTDOWN-MODE      May be 'smart', 'fast', or 'immediate'

Shutdown modes are:
  smart                 Quit after all clients have disconnected
  fast                  Quit directly, with proper shutdown
  immediate             Quit without complete shutdown; will lead
                        to recovery run on restart

Report bugs to <pgsql-bugs at postgresql.org>.





More information about the clue-tech mailing list