In today’s article, we will start the PostgreSQL Cluster with the Pg_ctl command.
What is the pg_ctl command?
PG_CTL is the command required to start, stop, restart and reload our cluster.
Let’s explain this a little.
The pg_ctl start command starts our cluster.
The pg_ctl stop command stops our cluster.
The pg_ctl restart command stops and restarts the cluster.
The pg_ctl reload command signals the postgres server process for some changes to be made in pg_hba.conf and postgresql.conf.I said some because some changes require a restart.
The pg_ctl promote command signals the specified process. Instructs the standby server running in the specified data directory to end the standby mode and start read-write operations.
This method is generally used in replication scenarios.
Replication, I can hear what you are saying, let me tell you right away:
It is the name given to the process of distributing data from the central database to local databases located at different points.
I will explain this in detail later and make an example.
Pg_ctl -D /var/lib/pgsql/13/data/ start
We start our postgresql as above and after doing this, our service will not start with the systemctl command.
To start with the systemctl command, we will need to change the configuration here, but we must be very careful while doing this.
We opened it with the vi editor, now we change the data path in the enviroment tab by giving the path we made initdb.
From here, we need to write our own data path to the place written in front of the enviroment.
After typing, we exit using the letters wq after making a colon.