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

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.

主站蜘蛛池模板: 白河县| 鹿邑县| 尼木县| 香河县| 沂南县| 奎屯市| 新疆| 昌都县| 隆安县| 邢台县| 平果县| 阜新| 怀化市| 务川| 遂昌县| 阿勒泰市| 海伦市| 凌云县| 荆州市| 台江县| 和静县| 汾西县| 海安县| 同江市| 黔西县| 会东县| 称多县| 尼木县| 和田县| 和龙市| 海原县| 玉屏| 满洲里市| 绥滨县| 铜陵市| 阜新市| 墨玉县| 石家庄市| 大同县| 呼玛县| 大足县|