暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

PostgreSQL的pg_ctl命令

DBA随笔记 2024-12-23
70
常用的 pg_ctl 命令
pg_ctl start   
pg_ctl stop   
pg_ctl restart  
pg_ctl status
    [postgres@pgserver bin]$ pg_ctl --help
    pg_ctl is a utility to initialize, start, stop, or control a PostgreSQL server.


    Usage:
      pg_ctl init[db]   [-D DATADIR] [-s] [-o OPTIONS]
      pg_ctl start      [-D DATADIR] [-l FILENAME] [-W] [-t SECS] [-s]
                        [-o OPTIONS] [-p PATH] [-c]
      pg_ctl stop       [-D DATADIR] [-m SHUTDOWN-MODE] [-W] [-t SECS] [-s]
      pg_ctl restart    [-D DATADIR] [-m SHUTDOWN-MODE] [-W] [-t SECS] [-s]
                        [-o OPTIONS] [-c]
      pg_ctl reload     [-D DATADIR] [-s]
      pg_ctl status     [-D DATADIR]
      pg_ctl promote    [-D DATADIR] [-W] [-t SECS] [-s]
      pg_ctl logrotate  [-D DATADIR] [-s]
      pg_ctl kill       SIGNALNAME PID


    Common options:
      -D, --pgdata=DATADIR   location of the database storage area
      -s, --silent           only print errors, no informational messages
      -t, --timeout=SECS     seconds to wait when using -w option
      -V, --version          output version information, then exit
      -w, --wait             wait until operation completes (default)
      -W, --no-wait          do not wait until operation completes
      -?, --help             show this help, then exit
    If the -D option is omitted, the environment variable PGDATA is used.


    Options for start or restart:
      -c, --core-files       allow postgres to produce core files
      -l, --log=FILENAME     write (or append) server log to FILENAME
      -o, --options=OPTIONS  command line options to pass to postgres
                             (PostgreSQL server executable) or initdb
      -p PATH-TO-POSTGRES    normally not necessary


    Options for stop or restart:
      -m, --mode=MODE        MODE can be "smart""fast"or "immediate"


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


    Allowed signal names for kill:
      ABRT HUP INT KILL QUIT TERM USR1 USR2


    Report bugs to <pgsql-bugs@lists.postgresql.org>.
    PostgreSQL home page: <https://www.postgresql.org/>
    [postgres@pgserver bin]$
    pg_ctl stop -m  smart
    pg_ctl stop -m  fast   
    pg_ctl stop -m  immediate



    文章转载自DBA随笔记,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

    评论