![]() ![]() Logrotate mode rotates the server log file. ![]() Promote mode commands the standby server that is running in the specified data directory to end standby mode and begin read-write operations. If an accessible data directory is not specified, pg_ctl returns an exit status of 4. If the server is not running, pg_ctl returns an exit status of 3. If it is, the server's PID and the command line options that were used to invoke it are displayed. Status mode checks whether a server is running in the specified data directory. This allows changing configuration-file options that do not require a full server restart to take effect. Reload mode simply sends the postgres server process a SIGHUP signal, causing it to reread its configuration files ( nf, pg_hba.conf, etc.). If relative paths were used on the command line during server start, restart might fail unless pg_ctl is executed in the same current directory as it was during server start. This allows changing the postgres command-line options, or changing configuration-file options that cannot be changed without restarting the server. Restart mode effectively executes a stop followed by a start. This choice will lead to a crash-recovery cycle during the next server start. “ Immediate” mode will abort all server processes immediately, without a clean shutdown. All active transactions are rolled back and clients are forcibly disconnected, then the server is shut down. ![]() “ Fast” mode (the default) does not wait for clients to disconnect. If the server is in hot standby, recovery and streaming replication will be terminated once all clients have disconnected. “ Smart” mode disallows new connections, then waits for all existing clients to disconnect. Three different shutdown methods can be selected with the -m option. Stop mode shuts down the server that is running in the specified data directory. Use of either -l or output redirection is recommended. These default behaviors can be changed by using -l to append the server's output to a log file. On Windows, by default the server's standard output and standard error are sent to the terminal. The standard output of pg_ctl should then be redirected to a file or piped to another process such as a log rotating program like rotatelogs otherwise postgres will write its output to the controlling terminal (from the background) and will not leave the shell's process group. On Unix-like systems, by default, the server's standard output and standard error are sent to pg_ctl's standard output (not standard error). The server is started in the background, and its standard input is attached to /dev/null (or nul on Windows). The init or initdb mode creates a new PostgreSQL database cluster, that is, a collection of databases that will be managed by a single server instance. It also provides convenient options for controlled shutdown. Although the server can be started manually, pg_ctl encapsulates tasks such as redirecting log output and properly detaching from the terminal and process group. Pg_ctl is a utility for initializing a PostgreSQL database cluster, starting, stopping, or restarting the PostgreSQL database server ( postgres), or displaying the status of a running server. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |