pg_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
ͨ³£ÕâЩ²ÎÊýÓõ¥»òË«ÒýºÅÒýÆð£¬ÒÔ±£Ö¤ËüÃÇÒÔÒ»×éµÄ·½Ê½´«µÝ£®
ÉùÃ÷¹Ø±Õģʽ£®
> pg_ctl startÈç¹ûʹÓÃÁË -w£¬pg_ctl µÈ´ýÊý¾Ý¿â·þÎñÆ÷Æô¶¯£Í¨¹ý¹Û²ì pid Îļþ£¨PGDATA/postmaster.pid£©µÄ´´½¨£¬×î¶àµÈ´ý 60 Ã룮
¼¤»î postmaster µÄ²ÎÊý´ÓÏÂÃæµÄ×ÊÔ´Àï»ñÈ¡£º
Êý¾Ý¿âĿ¼£ºPGDATA »·¾³±äÁ¿£®
ÆäËû²ÎÊý£ºPGDATA/postmaster.opts.default£®
postmaster -SÇë×¢Òâ postmaster.opts.default ÊÇÓÉ initdb ´Ó Postgres µÄ°²×°Ä¿Â¼£¨lib/postmaster.opts.default.sample ÊÇ°²×° Postgres ʱ´Ó src/bin/pg_ctl/postmaster.opts.default.sample £©ÀïµÄ» lib/postmaster.opts.default.sample ¿½±´À´µÄ£®
Òª¸²¸ÇȱʡµÄ²ÎÊý£¬Äã¿ÉÒÔʹÓà -D£¬-p ºÍ -o Ñ¡Ï
Ò»¸öÆô¶¯ postmaster£¬²¢µÈµ½l postmaster Æô¶¯ºó²ÅÍ˳öµÄÀý×ÓÊÇ£º
> pg_ctl -w startÒªÉùÃ÷ postmaster ¶þ½øÖÆ·¾¶£¬ÊÔÊÔ£º
> pg_ctl -p /usr/local/pgsq/bin/postmaster start¶ÔÒ»¸öʹÓö˿Ú5433£¬²¢ÇÒÔËÐÐÔÚÎÞ´ÅÅÌͬ²½µÄģʽµÄ postmaster£¬Ê¹Óãº
> pg_ctl -o "-o -F -p 5433" start
> pg_ctl stopÍ£Ö¹ postmaster£®Ê¹Óà -m ¿ª¹ØÒÔÔÊÐíÎÒÃÇ¿ØÖƺó¶ËÊÇÈçºÎÍ£Ö¹µÄ£®-w µÈ´ý postmaster Í£Ö¹£®-m ÉùÃ÷Í£Ö¹µÄģʽ£®
ÒªÓÃ×î¼òµ¥µÄ·½·¨ÖØÆð postmaster£º
> pg_ctl restartÒªÖØÆð postmaster£¬µÈËüÍ£Ö¹²¢ÖØÐÂÆô¶¯£º
> pg_ctl -w restartÒªÔÚ 5433 ¶Ë¿ÚÖØÆð²¢ÇÒÖØÆðºó¹Ø±Õ fsync£º
> pg_ctl -o "-o -F -p 5433" restart
> pg_ctl statusÏÂÃæÊÇһЩ´Ó 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'