You can do PostgreSQL service management in two ways.
Generally, restart or reload is required when changes are made to the postgresql.conf file.
You can find information on the right side of the parameters in the postgresql.conf file that require restart or reload.
For example, you can see the line for max_connection parameter below.
max_connections = 4000 # (change requires restart)
First Method:
You can do this using the systemctl command with the root user.
The PostgreSQL service name will depend on the version you are using.
If you are using version 9.6, the service name is “postgresql-9.6.service”
If you are using version 10.2, the service name will be “PostgreSQL-10.2.service”.
1 2 3 4 5 | systemctl stop postgresql-10.service systemctl start postgresql-10.service systemctl restart postgresql-10.service systemctl status postgresql-10.service systemctl reload postgresql-10.service |
Second Method:
You can use the pg_ctl command while in the postgres user. I usually prefer the 1st method.
The pgsql-10 value in the following commands will change according to your version.
1 2 3 4 5 | /usr/pgsql-10/bin/pg_ctl stop -D /postgres/pg_data /usr/pgsql-10/bin/pg_ctl start -D /postgres/pg_data /usr/pgsql-10/bin/pg_ctl restart -D /postgres/pg_data /usr/pgsql-10/bin/pg_ctl status -D /postgres/pg_data /usr/pgsql-10/bin/pg_ctl reload -D /postgres/pg_data |
Thanks for sharing step by step process. Very well explained.
You’re welcome