In the previous recipe, you saw that there is just one straightforward command for starting a PostgreSQL cluster. In some relational databases, there are multiple shutdown modes for different situations. Similarly, there are three modes in which a shutdown can be performed, as follows:
- Smart mode
- Fast mode
- Immediate mode
We shall discuss the steps involved in performing a shutdown using these three modes in PostgreSQL.
Getting ready
To shut down Postgres using a specific model, you can use the -m flag. You shall see this flag being passed to pg_ctl in the steps discussed in this recipe.
Make sure to set the PATH variable to the following (can be added to .bash_profile) in order to use the pg_ctl utility without adding its full path:
export PATH=/usr/pgsql-13/bin:$PATH
How to do it...
There are three modes that can be used for performing shutdowns. We will explore all of them here:
- Smart mode: The following two commands...