← 返回命令列表

Linux command

pg_ctl 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Start PostgreSQL

pg_ctl start -D [/var/lib/postgresql/data]

Stop PostgreSQL

pg_ctl stop -D [/var/lib/postgresql/data]

Restart PostgreSQL

pg_ctl restart -D [/var/lib/postgresql/data]

Reload configuration

pg_ctl reload -D [/var/lib/postgresql/data]

Check status

pg_ctl status -D [/var/lib/postgresql/data]

说明

pg_ctl is a utility for initializing, starting, stopping, and controlling a PostgreSQL database server. It's the preferred method for managing PostgreSQL services.

参数

start
Start the server.
stop
Stop the server.
restart
Stop then start.
reload
Reload configuration.
status
Check server status.
-D _directory_
Data directory.
-m _mode_
Shutdown mode (smart, fast, immediate).
-l _file_
Log file.
-w
Wait for completion.

FAQ

What is the pg_ctl command used for?

pg_ctl is a utility for initializing, starting, stopping, and controlling a PostgreSQL database server. It's the preferred method for managing PostgreSQL services.

How do I run a basic pg_ctl example?

Run `pg_ctl start -D [/var/lib/postgresql/data]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does start do in pg_ctl?

Start the server.