pg_ctl
От | Tatsuo Ishii |
---|---|
Тема | pg_ctl |
Дата | |
Msg-id | 19991206181144M.t-ishii@sra.co.jp обсуждение исходный текст |
Ответы |
Re: [HACKERS] pg_ctl
(Peter Eisentraut <e99re41@DoCS.UU.SE>)
|
Список | pgsql-hackers |
As I promised, I have written a small program called "pg_ctl" to start/stop/restart postmaster. I have committed into src/bin/pg_ctl. Please remember to pull the latest postmaster.c. o How to use pg_ctl has three modes: 1. startup mode pg_ctl [-w][-D database_dir][-p path_to_postmaster][-o "postmaster_opts"] start start postmaster. If -w is specified, pg_ctl will block until database is in the production mode. -D sets path to the database directory, which overrides the environment variable $PGDATA. pg_ctl finds postmaster.pid and other files under the directory. -p specifies the path to postmaster. If -p is not given, default path (generated as $(BINDIR)/postmaster while making pg_ctl from pg_ctl.sh) will be used. If -o option is not given, pg_ctl will take options for postmaster from $PGDATA/postamster.opts.default. Note that this file is not currently installed by "make install." So you have to make it by hand or could copy from postmaster.opts that is made once pg_ctl starts postmaster. Sample postmaster.opts.default looks like: postmaster -S or you could write it in one line: postmaster -S 2. stop mode pg_ctl [-w][-D database_dir][-m s[mart]|f[ast]|i[mmediate]] stop stop postmaster. -m specifies database shutdown method. The default is "-m smart". 3. restart mode pg_ctl [-w][-D database_dir][-m s[mart]|f[ast]|i[mmediate]][-o "postmaster_opts"] restart stop postmaster, then start it again. Options to start postmaster is taken from $PGDATA/postmaster.opts unless -o is given. 4. status reporting mode pg_ctl [-D database_dir] status reports status of postmaster. Currently reported information is relatively limited. Hopefully we could add the functionarity to report more valuable info such as number of backend running. o sample session Here is an example session using pg_ctl: $ pg_ctl stop # stop postmaster postmaster successfully shut down. $ pg_ctl stop # cannot stop postmaster if it is not running pg_ctl: Can't find /usr/local/src/pgsql/current/data/postmaster.pid. Is postmaster running? $ pg_ctl start # start postmaster postmaster successfully started up. $ pg_ctl status # status report $ pg_ctl status pg_ctl: postmaster is running (pid: 736) options are: /usr/local/src/pgsql/current/bin/postmaster -p 5432 -D /usr/local/src/pgsql/current/data -B 64 -b /usr/local/src/pgsql/current/bin/postgres -N 32 -S $ pg_ctl restart # stop postmaster then start it again Waiting for postmaster shutting down...done. postmaster successfully shut down. postmaster successfully started up. $ pg_ctl status # see how the pid is different from before pg_ctl: postmaster is running (pid: 761) options are: /usr/local/src/pgsql/current/bin/postmaster -p 5432 -D /usr/local/src/pgsql/current/data -B 64 -b /usr/local/src/pgsql/current/bin/postgres -N 32 -S $ pg_ctl -o "-S -B 1024 -N 128 -o -F" restart # restart with different options Waiting for postmaster shutting down...done. postmaster successfully shut down. postmaster successfully started up. $ pg_ctl status pg_ctl: postmaster is running (pid: 961) options are: /usr/local/src/pgsql/current/bin/postmaster -p 5432 -D /usr/local/src/pgsql/current/data -B 1024 -b /usr/local/src/pgsql/current/bin/postgres -N 128 -S -o '-F' -- Tatsuo Ishii
В списке pgsql-hackers по дате отправления: