Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
17.5. Shutting Down the Server
Prev UpChapter 17. Server Setup and OperationHome Next

17.5. Shutting Down the Server#

There are several ways to shut down the database server. Under the hood, they all reduce to sending a signal to the supervisorpostgres process.

If you are using a pre-packaged version ofPostgreSQL, and you used its provisions for starting the server, then you should also use its provisions for stopping the server. Consult the package-level documentation for details.

When managing the server directly, you can control the type of shutdown by sending different signals to thepostgres process:

SIGTERM

This is theSmart Shutdown mode. After receivingSIGTERM, the server disallows new connections, but lets existing sessions end their work normally. It shuts down only after all of the sessions terminate. If the server is in recovery when a smart shutdown is requested, recovery and streaming replication will be stopped only after all regular sessions have terminated.

SIGINT

This is theFast Shutdown mode. The server disallows new connections and sends all existing server processesSIGTERM, which will cause them to abort their current transactions and exit promptly. It then waits for all server processes to exit and finally shuts down.

SIGQUIT

This is theImmediate Shutdown mode. The server will sendSIGQUIT to all child processes and wait for them to terminate. If any do not terminate within 5 seconds, they will be sentSIGKILL. The supervisor server process exits as soon as all child processes have exited, without doing normal database shutdown processing. This will lead to recovery (by replaying the WAL log) upon next start-up. This is recommended only in emergencies.

Thepg_ctl program provides a convenient interface for sending these signals to shut down the server. Alternatively, you can send the signal directly usingkill on non-Windows systems. ThePID of thepostgres process can be found using theps program, or from the filepostmaster.pid in the data directory. For example, to do a fast shutdown:

$kill -INT `head -1 /usr/local/pgsql/data/postmaster.pid`

To terminate an individual session while allowing other sessions to continue, usepg_terminate_backend() (seeTable 9.94) or send aSIGTERM signal to the child process associated with the session.


Prev Up Next
17.4. Managing Kernel Resources Home 17.6. Upgrading aPostgres Pro Cluster
pdfepub
Go to Postgres Pro Standard 17
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp