官术网_书友最值得收藏!

Stopping the server quickly

There are different modes available to stop the PostgreSQL server. Here we will talk about the mode in which we can stop the server quickly.

Getting ready

The pg_ctl command is used in combination with the stop option in order to stop the PostgreSQL server.

How to do it...

We can use the following command to stop the server quickly on Red Hat-based Linux distributions and other Unix-based systems:

pg_ctl -D /var/lib/pgsql/9.6/data -m fast stop

Here, /var/lib/pgsql/9.6/data is the location of the data directory.

How it works...

The -m fast option must be used in order to shut down as quickly as possible. In case of a normal shutdown, PostgreSQL will wait for all users to finish their transactions before halting and on a busy system this can sometimes take a very long time.

While initiating a fast stop with the -m fast option of the pg_ctl command, all the users will have their transactions aborted and all connections are disconnected. However, this is a clean shutdown because all the active transactions are aborted followed, by a system checkpoint before the server closes.

Also, it will verify various checks, such as whether PostgreSQL has started in a single user mode or whether the cluster is running in backup mode while shutting down the database, and will interact with the user by throwing the required notification messages.

主站蜘蛛池模板: 辽宁省| 栾城县| 吉隆县| 苏尼特左旗| 剑阁县| 佛山市| 炎陵县| 淮安市| 读书| 湖南省| 分宜县| 迭部县| 霍山县| 吐鲁番市| 黄陵县| 图们市| 阿坝县| 崇阳县| 阿拉善盟| 平塘县| 东城区| 林西县| 洪江市| 梧州市| 习水县| 姚安县| 南开区| 呼玛县| 来凤县| 长乐市| 钦州市| 衢州市| 江源县| 太保市| 东莞市| 兴文县| 沅陵县| 龙井市| 定襄县| 聂拉木县| 威远县|