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

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.

主站蜘蛛池模板: 中方县| 庆安县| 鄂尔多斯市| 万荣县| 塔河县| 绥芬河市| 阳泉市| 屏东市| 乡城县| 吴堡县| 姚安县| 富源县| 红原县| 中江县| 连城县| 玉环县| 丹凤县| 清流县| 龙陵县| 玉田县| 上饶市| 思南县| 凌源市| 平安县| 建瓯市| 唐河县| 榆林市| 乌拉特后旗| 溆浦县| 乐清市| 海南省| 开远市| 海盐县| 孙吴县| 安仁县| 黔江区| 甘谷县| 轮台县| 高阳县| 两当县| 隆子县|