Sunday, 21 January 2024

PostgreSQL 15 Installation

I have installed the PostgreSQL-15 on my Linux machine 

Kindly use below link for the installation 

https://www.postgresql.org/download/linux/redhat/



PostgreSQL Yum Repository

The PostgreSQL Yum Repository will integrate with your normal systems and patch management, and provide automatic updates for all supported versions of PostgreSQL throughout the support lifetime of PostgreSQL.

The PostgreSQL Yum Repository currently supports:

  • Red Hat Enterprise Linux
  • Rocky Linux
  • AlmaLinux
  • CentOS (7 and 6 only)
  • Oracle Linux
  • Fedora*


4. Copy, paste and run the relevant parts of the setup script


  1. sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
    
    # Install PostgreSQL:
    sudo yum install -y postgresql15-server
    
    # Optionally initialize the database and enable automatic start:
    sudo /usr/pgsql-15/bin/postgresql-15-setup initdb
    sudo systemctl enable postgresql-15
    sudo systemctl start postgresql-15

I followed the above steps marked in blue.


[root@rac7 ~]# 
[root@rac7 ~]# sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
Loaded plugins: langpacks, ulninfo
pgdg-redhat-repo-latest.noarch.rpm                                                                                   |  10 kB  00:00:00     
Examining /var/tmp/yum-root-cf0rnV/pgdg-redhat-repo-latest.noarch.rpm: pgdg-redhat-repo-42.0-38PGDG.noarch
Marking /var/tmp/yum-root-cf0rnV/pgdg-redhat-repo-latest.noarch.rpm as an update to pgdg-redhat-repo-42.0-8.noarch
Resolving Dependencies
--> Running transaction check
---> Package pgdg-redhat-repo.noarch 0:42.0-8 will be updated
---> Package pgdg-redhat-repo.noarch 0:42.0-38PGDG will be an update
--> Finished Dependency Resolution
ol7_UEKR5/x86_64                                                                                                     | 3.0 kB  00:00:00     
ol7_UEKR5/x86_64/updateinfo                                                                                          | 429 kB  00:00:00     
ol7_UEKR5/x86_64/primary_db                                                                                          |  75 MB  00:00:20     
ol7_latest/x86_64                                                                                                    | 3.6 kB  00:00:00     
ol7_latest/x86_64/updateinfo                                                                                         | 3.6 MB  00:00:00     
ol7_latest/x86_64/primary_db                                                                                         |  49 MB  00:00:11     
https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7Server-x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7Server-x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
pgdg12/7Server/x86_64                                                                                                | 3.6 kB  00:00:00     
pgdg12/7Server/x86_64/group_gz                                                                                       |  246 B  00:00:00     
pgdg12/7Server/x86_64/primary_db                                                                                     | 408 kB  00:00:00     
https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-7Server-x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7Server-x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7Server-x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
Dependencies Resolved
============================================================================================================================================
 Package                          Arch                   Version                      Repository                                       Size
============================================================================================================================================
Updating:
 pgdg-redhat-repo                 noarch                 42.0-38PGDG                  /pgdg-redhat-repo-latest.noarch                  12 k
Transaction Summary
============================================================================================================================================
Upgrade  1 Package
Total size: 12 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 19 pre-existing rpmdb problem(s), 'yum check' output follows:
compat-gcc-44-c++-4.4.7-8.el7.x86_64 has missing requires of compat-gcc-44 = ('0', '4.4.7', '8.el7')
1:compat-glibc-headers-2.12-4.el7.x86_64 has missing requires of compat-glibc = ('1', '2.12', '4.el7')
gcc-4.8.5-36.0.1.el7.x86_64 has missing requires of cpp = ('0', '4.8.5', '36.0.1.el7')
gcc-c++-4.8.5-36.0.1.el7.x86_64 has missing requires of libstdc++-devel = ('0', '4.8.5', '36.0.1.el7')
gcc-gfortran-4.8.5-36.0.1.el7.x86_64 has missing requires of libgfortran = ('0', '4.8.5', '36.0.1.el7')
gcc-gfortran-4.8.5-36.0.1.el7.x86_64 has missing requires of libgfortran.so.3()(64bit)
gcc-gfortran-4.8.5-36.0.1.el7.x86_64 has missing requires of libquadmath = ('0', '4.8.5', '36.0.1.el7')
gcc-gfortran-4.8.5-36.0.1.el7.x86_64 has missing requires of libquadmath-devel = ('0', '4.8.5', '36.0.1.el7')
gcc-gnat-4.8.5-36.0.1.el7.x86_64 has missing requires of libgnat = ('0', '4.8.5', '36.0.1.el7')
gcc-gnat-4.8.5-36.0.1.el7.x86_64 has missing requires of libgnat-devel = ('0', '4.8.5', '36.0.1.el7')
gcc-objc-4.8.5-36.0.1.el7.x86_64 has missing requires of libobjc = ('0', '4.8.5', '36.0.1.el7')
gcc-objc-4.8.5-36.0.1.el7.x86_64 has missing requires of libobjc.so.4()(64bit)
glib2-2.56.1-2.el7.x86_64 is a duplicate with glib2-2.46.2-4.el7.x86_64
glibc-2.17-260.0.9.el7.x86_64 is a duplicate with glibc-2.17-157.el7.x86_64
glibc-common-2.17-260.0.9.el7.x86_64 is a duplicate with glibc-common-2.17-157.el7.x86_64
glibc-devel-2.17-157.el7.x86_64 has missing requires of glibc-headers = ('0', '2.17', '157.el7')
libstdc++-4.8.5-36.0.1.el7.x86_64 is a duplicate with libstdc++-4.8.5-11.el7.x86_64
libstdc++-devel-4.8.5-11.el7.i686 has missing requires of libstdc++(x86-32) = ('0', '4.8.5', '11.el7')
libstdc++-devel-4.8.5-11.el7.i686 has missing requires of libstdc++.so.6
  Updating   : pgdg-redhat-repo-42.0-38PGDG.noarch                                                                                      1/2 
  Cleanup    : pgdg-redhat-repo-42.0-8.noarch                                                                                           2/2 
  Verifying  : pgdg-redhat-repo-42.0-38PGDG.noarch                                                                                      1/2 
  Verifying  : pgdg-redhat-repo-42.0-8.noarch                                                                                           2/2 
Updated:
  pgdg-redhat-repo.noarch 0:42.0-38PGDG                                                                                                     
Complete!
[root@rac7 ~]# 


=========================================================================
[root@rac7 ~]# 
[root@rac7 ~]# sudo yum install -y postgresql15-server
Loaded plugins: langpacks, ulninfo
pgdg-common/7Server/x86_64/signature                                                                                 |  665 B  00:00:00     
Retrieving key from file:///etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL7
Importing GPG key 0x73E3B907:
 Userid     : "PostgreSQL RPM Repository <pgsql-pkg-yum@lists.postgresql.org>"
 Fingerprint: f245 f0bf 96ac 1827 44ca ff2e 64fa ce11 73e3 b907
 Package    : pgdg-redhat-repo-42.0-38PGDG.noarch (installed)
 From       : /etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL7
pgdg-common/7Server/x86_64/signature                                                                                 | 2.9 kB  00:00:00 !!! 
pgdg13/7Server/x86_64/signature                                                                                      |  665 B  00:00:00     
Retrieving key from file:///etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL7
Importing GPG key 0x73E3B907:
 Userid     : "PostgreSQL RPM Repository <pgsql-pkg-yum@lists.postgresql.org>"
 Fingerprint: f245 f0bf 96ac 1827 44ca ff2e 64fa ce11 73e3 b907
 Package    : pgdg-redhat-repo-42.0-38PGDG.noarch (installed)
 From       : /etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL7
pgdg13/7Server/x86_64/signature                                                                                      | 3.6 kB  00:00:00 !!! 
pgdg14/7Server/x86_64/signature                                                                                      |  665 B  00:00:00     
Retrieving key from file:///etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL7
Importing GPG key 0x73E3B907:
 Userid     : "PostgreSQL RPM Repository <pgsql-pkg-yum@lists.postgresql.org>"
 Fingerprint: f245 f0bf 96ac 1827 44ca ff2e 64fa ce11 73e3 b907
 Package    : pgdg-redhat-repo-42.0-38PGDG.noarch (installed)
 From       : /etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL7
pgdg14/7Server/x86_64/signature                                                                                      | 3.6 kB  00:00:00 !!! 
pgdg15/7Server/x86_64/signature                                                                                      |  665 B  00:00:00     
Retrieving key from file:///etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL7
Importing GPG key 0x73E3B907:
 Userid     : "PostgreSQL RPM Repository <pgsql-pkg-yum@lists.postgresql.org>"
 Fingerprint: f245 f0bf 96ac 1827 44ca ff2e 64fa ce11 73e3 b907
 Package    : pgdg-redhat-repo-42.0-38PGDG.noarch (installed)
 From       : /etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL7
pgdg15/7Server/x86_64/signature                                                                                      | 3.6 kB  00:00:00 !!! 
(1/7): pgdg14/7Server/x86_64/group_gz                                                                                |  245 B  00:00:00     
(2/7): pgdg15/7Server/x86_64/group_gz                                                                                |  247 B  00:00:00     
(3/7): pgdg13/7Server/x86_64/group_gz                                                                                |  246 B  00:00:01     
(4/7): pgdg15/7Server/x86_64/primary_db                                                                              | 156 kB  00:00:00     
(5/7): pgdg13/7Server/x86_64/primary_db                                                                              | 333 kB  00:00:02     
(6/7): pgdg14/7Server/x86_64/primary_db                                                                              | 250 kB  00:00:02     
(7/7): pgdg-common/7Server/x86_64/primary_db                                                                         | 202 kB  00:00:03     
Resolving Dependencies
--> Running transaction check
---> Package postgresql15-server.x86_64 0:15.5-1PGDG.rhel7 will be installed
--> Processing Dependency: postgresql15-libs(x86-64) = 15.5-1PGDG.rhel7 for package: postgresql15-server-15.5-1PGDG.rhel7.x86_64
--> Processing Dependency: postgresql15(x86-64) = 15.5-1PGDG.rhel7 for package: postgresql15-server-15.5-1PGDG.rhel7.x86_64
--> Processing Dependency: libzstd.so.1()(64bit) for package: postgresql15-server-15.5-1PGDG.rhel7.x86_64
--> Processing Dependency: libpq.so.5()(64bit) for package: postgresql15-server-15.5-1PGDG.rhel7.x86_64
--> Running transaction check
---> Package libzstd.x86_64 0:1.4.4-1.el7 will be installed
---> Package postgresql15.x86_64 0:15.5-1PGDG.rhel7 will be installed
---> Package postgresql15-libs.x86_64 0:15.5-1PGDG.rhel7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================================================
 Package                                Arch                      Version                                Repository                    Size
============================================================================================================================================
Installing:
 postgresql15-server                    x86_64                    15.5-1PGDG.rhel7                       pgdg15                       5.8 M
Installing for dependencies:
 libzstd                                x86_64                    1.4.4-1.el7                            ol7_UEKR5                    259 k
 postgresql15                           x86_64                    15.5-1PGDG.rhel7                       pgdg15                       1.6 M
 postgresql15-libs                      x86_64                    15.5-1PGDG.rhel7                       pgdg15                       285 k
Transaction Summary
============================================================================================================================================
Install  1 Package (+3 Dependent packages)
Total download size: 7.9 M
Installed size: 34 M
Downloading packages:
warning: /var/cache/yum/x86_64/7Server/ol7_UEKR5/packages/libzstd-1.4.4-1.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Public key for libzstd-1.4.4-1.el7.x86_64.rpm is not installed
(1/4): libzstd-1.4.4-1.el7.x86_64.rpm                                                                                | 259 kB  00:00:00     
warning: /var/cache/yum/x86_64/7Server/pgdg15/packages/postgresql15-libs-15.5-1PGDG.rhel7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 73e3b907: NOKEY
Public key for postgresql15-libs-15.5-1PGDG.rhel7.x86_64.rpm is not installed
(2/4): postgresql15-libs-15.5-1PGDG.rhel7.x86_64.rpm                                                                 | 285 kB  00:00:01     
(3/4): postgresql15-15.5-1PGDG.rhel7.x86_64.rpm                                                                      | 1.6 MB  00:00:02     
(4/4): postgresql15-server-15.5-1PGDG.rhel7.x86_64.rpm                                                               | 5.8 MB  00:00:12     
--------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                       587 kB/s | 7.9 MB  00:00:13     
Retrieving key from file:///etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL7
Importing GPG key 0x73E3B907:
 Userid     : "PostgreSQL RPM Repository <pgsql-pkg-yum@lists.postgresql.org>"
 Fingerprint: f245 f0bf 96ac 1827 44ca ff2e 64fa ce11 73e3 b907
 Package    : pgdg-redhat-repo-42.0-38PGDG.noarch (installed)
 From       : /etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY-RHEL7
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
Importing GPG key 0xEC551F03:
 Userid     : "Oracle OSS group (Open Source Software group) <build@oss.oracle.com>"
 Fingerprint: 4214 4123 fecf c55b 9086 313d 72f9 7b74 ec55 1f03
 Package    : 7:oraclelinux-release-7.6-1.0.15.el7.x86_64 (@anaconda/7.6)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libzstd-1.4.4-1.el7.x86_64                                                                                               1/4 
  Installing : postgresql15-libs-15.5-1PGDG.rhel7.x86_64                                                                                2/4 
  Installing : postgresql15-15.5-1PGDG.rhel7.x86_64                                                                                     3/4 
  Installing : postgresql15-server-15.5-1PGDG.rhel7.x86_64                                                                              4/4 
  Verifying  : postgresql15-15.5-1PGDG.rhel7.x86_64                                                                                     1/4 
  Verifying  : postgresql15-server-15.5-1PGDG.rhel7.x86_64                                                                              2/4 
  Verifying  : postgresql15-libs-15.5-1PGDG.rhel7.x86_64                                                                                3/4 
  Verifying  : libzstd-1.4.4-1.el7.x86_64                                                                                               4/4 
Installed:
  postgresql15-server.x86_64 0:15.5-1PGDG.rhel7                                                                                             
Dependency Installed:
  libzstd.x86_64 0:1.4.4-1.el7          postgresql15.x86_64 0:15.5-1PGDG.rhel7          postgresql15-libs.x86_64 0:15.5-1PGDG.rhel7         
Complete!
[root@rac7 ~]# 
[root@rac7 ~]# 


[root@rac7]# id postgres
uid=26(postgres) gid=26(postgres) groups=26(postgres)

Note:- Once installation is done, postgres OS level user is already created by installation process.





B
elow directories structures are created :-

$]  cd /usr/pgsql-15






bin, lib and share folders are created ....

Let us see what are the files inside BIN location






Files inside lib location :-








[root@rac7 ~]# 
[root@rac7 ~]# sudo /usr/pgsql-15/bin/postgresql-15-setup initdb
Initializing database ... OK
[root@rac7 ~]# 
[root@rac7 ~]# 
[root@rac7 ~]# sudo systemctl enable postgresql-15
Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql-15.service to /usr/lib/systemd/system/postgresql-15.service.
[root@rac7 ~]# 
[root@rac7 ~]# 
[root@rac7 ~]# sudo systemctl start postgresql-15
Job for postgresql-15.service failed because the control process exited with error code. See "systemctl status postgresql-15.service" and "journalctl -xe" for details.
[root@rac7 ~]# 
[root@rac7 ~]# 




[root@rac7]# id postgres
uid=26(postgres) gid=26(postgres) groups=26(postgres)

Note:Once installation is done, postgres OS level user is already created by installation process.


[root@rac7 ~]# mkdir -p /u02/PostgreSQL/15
[root@rac7 ~]#
[root@rac7 ~]#
[root@rac7 ~]# chown -R postgres:postgres /u02/PostgreSQL/15
[root@rac7 ~]#
[root@rac7 ~]# chmod 700 -R /u02/PostgreSQL/15
[root@rac7 ~]#


Switch to postgres - user ---->>>>>


[root@rac7]#  su - postgres


Default directory created --> /var/lib/pgsql -- 


[root@rac201 ~]# su - postgres
[postgres@rac201 ~]$
[postgres@rac201 ~]$ pwd
/var/lib/pgsql


[postgres@rac7 ~]$
[postgres@rac7~]$ ps -ef| grep postgres

postgres    6087       1  0 19:09 ?        00:00:00 /usr/pgsql-15/bin/postmaster -D /var/lib/pgsql/15/data/
postgres    6089    6087  0 19:09 ?        00:00:00 postgres: logger
postgres    6090    6087  0 19:09 ?        00:00:00 postgres: checkpointer
postgres    6091    6087  0 19:09 ?        00:00:00 postgres: background writer
postgres    6093    6087  0 19:09 ?        00:00:00 postgres: walwriter
postgres    6094    6087  0 19:09 ?        00:00:00 postgres: autovacuum launcher
postgres    6095    6087  0 19:09 ?        00:00:00 postgres: logical replication launcher
root        6518    5476  0 19:19 pts/2    00:00:00 su - postgres
postgres    6519    6518  0 19:19 pts/2    00:00:00 -bash
root        7188    6847  0 19:32 pts/2    00:00:00 su - postgres
postgres    7189    7188  0 19:32 pts/2    00:00:00 -bash
postgres    7280    7189  0 19:33 pts/2    00:00:00 ps -ef
postgres    7281    7189  0 19:33 pts/2    00:00:00 grep --color=auto postgres



postgres=# \l
                                                 List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    | ICU Locale | Locale Provider |   Access privileges
-----------+----------+----------+-------------+-------------+------------+-----------------+-----------------------
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            |
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            | =c/postgres          +
           |          |          |             |             |            |                 | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            | =c/postgres          +
           |          |          |             |             |            |                 | postgres=CTc/postgres
(3 rows)



Let's initdb the New postgresql:-


-bash-4.2$ 

-bash-4.2$ /usr/pgsql-15/bin/initdb -D /u02/PostgreSQL/15

The files belonging to this database system will be owned by user "postgres".

This user must also own the server process.


The database cluster will be initialized with locale "en_US.UTF-8".

The default database encoding has accordingly been set to "UTF8".

The default text search configuration will be set to "english".


Data page checksums are disabled.


fixing permissions on existing directory /u02/PostgreSQL/15 ... ok

creating subdirectories ... ok

selecting dynamic shared memory implementation ... posix

selecting default max_connections ... 100

selecting default shared_buffers ... 128MB

selecting default time zone ... Asia/Kolkata

creating configuration files ... ok

running bootstrap script ... ok

performing post-bootstrap initialization ... ok

syncing data to disk ... ok


initdb: warning: enabling "trust" authentication for local connections

initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.


Success. You can now start the database server using:


    /usr/pgsql-15/bin/pg_ctl -D /u02/PostgreSQL/15 -l logfile start


-bash-4.2$ 

-bash-4.2$ /usr/pgsql-15/bin/pg_ctl -D /u02/PostgreSQL/15 -l logfile start

waiting for server to start.... stopped waiting

pg_ctl: could not start server

Examine the log output.




-bash-4.2$ 

-bash-4.2$ ls -lrt

total 132

-rw------- 1 postgres postgres     3 Jan 21 01:16 PG_VERSION

drwx------ 2 postgres postgres  4096 Jan 21 01:16 pg_twophase

drwx------ 2 postgres postgres  4096 Jan 21 01:16 pg_tblspc

drwx------ 2 postgres postgres  4096 Jan 21 01:16 pg_stat_tmp

drwx------ 2 postgres postgres  4096 Jan 21 01:16 pg_snapshots

drwx------ 2 postgres postgres  4096 Jan 21 01:16 pg_serial

drwx------ 2 postgres postgres  4096 Jan 21 01:16 pg_replslot

drwx------ 2 postgres postgres  4096 Jan 21 01:16 pg_notify

drwx------ 4 postgres postgres  4096 Jan 21 01:16 pg_multixact

drwx------ 2 postgres postgres  4096 Jan 21 01:16 pg_dynshmem

drwx------ 2 postgres postgres  4096 Jan 21 01:16 pg_commit_ts

-rw------- 1 postgres postgres 29458 Jan 21 01:16 postgresql.conf

-rw------- 1 postgres postgres    88 Jan 21 01:16 postgresql.auto.conf

-rw------- 1 postgres postgres  1636 Jan 21 01:16 pg_ident.conf

-rw------- 1 postgres postgres  4789 Jan 21 01:16 pg_hba.conf

drwx------ 2 postgres postgres  4096 Jan 21 01:16 pg_xact

drwx------ 3 postgres postgres  4096 Jan 21 01:16 pg_wal

drwx------ 2 postgres postgres  4096 Jan 21 01:16 pg_subtrans

drwx------ 2 postgres postgres  4096 Jan 21 01:16 global

drwx------ 5 postgres postgres  4096 Jan 21 01:16 base

drwx------ 4 postgres postgres  4096 Jan 21 01:16 pg_logical

drwx------ 2 postgres postgres  4096 Jan 21 01:16 pg_stat

drwx------ 2 postgres postgres  4096 Jan 21 01:16 log

-rw------- 1 postgres postgres   187 Jan 21 01:16 logfile

-rw------- 1 postgres postgres    30 Jan 21 01:16 current_logfiles

-bash-4.2$ pwd

/u02/PostgreSQL/15

-bash-4.2$ cat logfile

2024-01-21 01:16:40.567 IST [30062] LOG:  redirecting log output to logging collector process

2024-01-21 01:16:40.567 IST [30062] HINT:  Future log output will appear in directory "log".

-bash-4.2$ 

-bash-4.2$ cat current_logfiles

stderr log/postgresql-Sun.log

-bash-4.2$ 

-bash-4.2$ cd log

-bash-4.2$ ls -lrt

total 4

-rw------- 1 postgres postgres 638 Jan 21 01:16 postgresql-Sun.log

-bash-4.2$ 

-bash-4.2$ 

-bash-4.2$ cat postgresql-Sun.log

2024-01-21 01:16:40.567 IST [30062] LOG:  starting PostgreSQL 15.5 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit

2024-01-21 01:16:40.567 IST [30062] LOG:  could not bind IPv4 address "127.0.0.1": Address already in use

2024-01-21 01:16:40.567 IST [30062] HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.

2024-01-21 01:16:40.567 IST [30062] WARNING:  could not create listen socket for "localhost"

2024-01-21 01:16:40.567 IST [30062] FATAL:  could not create any TCP/IP sockets

2024-01-21 01:16:40.568 IST [30062] LOG:  database system is shut down

-bash-4.2$ 



-bash-4.2$ vi postgresql.conf ----> Changed the port number in conf file

 port = 5454




-bash-4.2$ 

-bash-4.2$ /usr/pgsql-15/bin/pg_ctl -D /u02/PostgreSQL/15 -l logfile start

waiting for server to start.... done

server started

-bash-4.2$ 




postgres  25085  25061  0 00:43 pts/0    00:00:00 -bash

postgres  30824      1  0 01:22 ?        00:00:00 /usr/pgsql-15/bin/postgres -D /u02/PostgreSQL/15

postgres  30826  30824  0 01:22 ?        00:00:00 postgres: logger 

postgres  30827  30824  0 01:22 ?        00:00:00 postgres: checkpointer 

postgres  30828  30824  0 01:22 ?        00:00:00 postgres: background writer 

postgres  30830  30824  0 01:22 ?        00:00:00 postgres: walwriter 

postgres  30831  30824  0 01:22 ?        00:00:00 postgres: autovacuum launcher 

postgres  30832  30824  0 01:22 ?        00:00:00 postgres: logical replication launcher 

postgres  31062  25085  0 01:24 pts/0    00:00:00 ps -ef

postgres  31063  25085  0 01:24 pts/0    00:00:00 grep --color=auto postgres



-bash-4.2$ 

-bash-4.2$ psql -p 5454

psql (10.9, server 15.5)

WARNING: psql major version 10, server major version 15.

         Some psql features might not work.

Type "help" for help.


postgres=# 

postgres=# 

postgres=# select version();

                                                 version                                                 

---------------------------------------------------------------------------------------------------------

 PostgreSQL 15.5 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit

(1 row)


postgres=# 

postgres=# show server_version;

 server_version 

----------------

 15.5

(1 row)


postgres=# show data_directory;

   data_directory   

--------------------

 /u02/PostgreSQL/15

(1 row)




No comments:

Post a Comment

Master and Slave - Sync check - PostgreSQL

  1) Run the below Query on Primary:- SELECT     pid,     usename,     application_name,     client_addr,     state,     sync_state,     sen...