The umask is set to 077, so access to the log file is disallowed to other users by default. If the file does not exist, it is created. l filenameĪppend the server log output to filename. If this option is omitted, the environment variable PGDATA is used. Specifies the file system location of the database configuration files. This is useful in debugging or diagnosing problems by allowing a stack trace to be obtained from a failed server process. This undoes the effects of the register command.Īttempt to allow server crashes to produce core files, on platforms where this is possible, by lifting any soft resource limit placed on core files. Unregister mode unregisters a system service on Microsoft Windows. The -S option allows selection of service start type, either “ auto” (start service automatically on system startup) or “ demand” (start service on demand). Register mode registers the PostgreSQL server as a system service on Microsoft Windows. Use -help to see a list of supported signal names. This is primarily valuable on Microsoft Windows which does not have a built-in kill command. Kill mode sends a signal to a specified process. 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 and will terminate an online backup in progress. 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 and any online backup to finish. 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. |