|
pg_ctlNamepg_ctl — Starts, stops, and restarts postmasterpg_ctl [-w] [-D datadir][-p path] [-o "options"] start pg_ctl [-w] [-D datadir] [-m [s[mart]|f[ast]|i[mmediate]]] stop pg_ctl [-w] [-D datadir] [-m [s[mart]|f[ast]|i[mmediate]] [-o "options"] restart pg_ctl [-D datadir] status Inputs
Outputs
Descriptionpg_ctl is a utility for starting, stopping or restarting postmaster. UsageStarting postmasterTo start up postmaster: > pg_ctl start If -w is supplied, pg_ctl waits for the database server comes up, by watching for creation of the pid file (PGDATA/postmaster.pid), for up to 60 seconds. Parameters to invoke postmaster are taken from the following sources:
postmaster.opts.default contains parameters for postmaster. With a default installation, the -S option is enabled. So pg_ctl start implies: postmaster -S Note that postmaster.opts.default is installed by initdb from lib/postmaster.opts.default.sample under the Postgres installation directory (lib/postmaster.opts.default.sample is copied from src/bin/pg_ctl/postmaster.opts.default.sample while installing Postgres). To override the default parameters you can use -D, -p and -o options. An example of starting the postmaster, blocking until postmaster comes up is: > pg_ctl -w start To specify the postmaster binary path, try: > pg_ctl -p /usr/local/pgsq/bin/postmaster start For a postmaster using port 5433, and running without fsync, use: > pg_ctl -o "-o -F -p 5433" start Stopping postmaster
> pg_ctl stopstops postmaster. Using the -m switch allows one to control how the backend shuts down. -w waits for postmaster to shut down. -m specifies the shut down mode. Restarting postmasterThis is almost equivalent to stopping the postmaster then starting it again except that the parameters used before stopping it would be used too. This is done by saving them in $PGDATA/postmaster.opts file. -w, -D, -m, -fast, -immediate and -o can also be used in the restarting mode and they have same meanings as described above. To restart postmaster in the simplest form: > pg_ctl restart To restart postmaster, waiting for it to shut down and to come up: > pg_ctl -w restart To restart using port 5433 and disabling fsync after restarting: > pg_ctl -o "-o -F -p 5433" restart postmaster statusTo get status information from postmaster: > pg_ctl status Here is a sample output from pg_ctl: pg_ctl: postmaster is running (pid: 13718) options are: /usr/local/src/pgsql/current/bin/postmaster -p 5433 -D /usr/local/src/pgsql/current/data -B 64 -b /usr/local/src/pgsql/current/bin/postgres -N 32 -o '-F' |
|||||||||||||||||
With any suggestions or questions please feel free to contact us |