Create A New Cluster in Postgres V16
Create A New Cluster in Postgres V16
O nce you complete the PostgreSQL installation. You will get the default cluster with data location
/var/lib and port number 5432. If you want to configure the new cluster as per your requirements like
specific port number and storage location you can configure it. In this section, we are deploying the new
cluster with port 5433 and storage location /u01.
Deployment diagram:
Infrastructure Details:
HOSTNAME: PG_V16.example.com
OS version Red Hat Enterprise Linux release 8.6 (Ootpa)
PG Version PostgreSQL 16.1
Port number 5433
Cluster location /u01/app/postgres/product/v16
• Prerequisite Steps
- Validate cluster is up and running, current cluster port number
- Create the directory to store new cluster configuration and database files and folder
- Provide appropriate permission to Postgres user on the newly created folder
• Create and initialize the cluster
• Validation
Step-1 Prerequisite Steps
postgres=#
- Create the directory to store new cluster configuration and database files and folder
[postgres@PG-V16 ~]$
- Let's make some changes in Postgresql.conf file like port which is not in use. In this
deployment, I choose the 5433 port.
-
[postgres@PG-V16 app]$ cd /u01/app/postgres/product/v16
[postgres@PG-V16 v16]$ ls -ltr postgresql.conf
-rw-------. 1 postgres postgres 29705 Dec 31 17:16 postgresql.conf
[postgres@PG-V16 v16]$
Step-3 Validation
- Connect the newly created cluster using the default user and password which we entered
in step-2
[postgres@PG-V16 v16]$ psql -p 5433 -d postgres -U postgres
psql (16.1)
Type "help" for help.
postgres=#