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

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.

主站蜘蛛池模板: 长宁县| 凯里市| 洛川县| 大城县| 吉安县| 新巴尔虎右旗| 札达县| 信宜市| 绥阳县| 旬邑县| 泽普县| 潮州市| 潜山县| 乐都县| 宜都市| 亳州市| 鄂尔多斯市| 突泉县| 固原市| 交口县| 宜城市| 镇远县| 华安县| 敦煌市| 义乌市| 德兴市| 九江市| 那曲县| 汉阴县| 四子王旗| 交城县| 土默特右旗| 肇州县| 泰顺县| 内乡县| 桐柏县| 桦川县| 梅州市| 苍梧县| 镇坪县| 沭阳县|