Different releases in the same server - Mailing list pgsql-general

From marco.ptz@tiscali.it
Subject Different releases in the same server
Date
Msg-id 7229c9037c2b263c23b4a9d48d7732a2@tiscali.it
Whole thread Raw
Responses Re: Different releases in the same server
Re: Different releases in the same server
List pgsql-general
Hi all,
we have recently started to manage a production server running a 9.6 postgres.

[root@xx ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

We have to upgrade to postgres 12.x but we have a few questions due the configuration found in the server.
Basically there are 3 different release present, 9.2, 9.6 ( running ), 12 (future upgrade target release):


[root@xx ~]# yum list installed | grep postgres
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
postgresql.x86_64 9.2.24-4.el7_8 @base/7.9.2009
postgresql-libs.x86_64 9.2.24-4.el7_8 @base/7.9.2009
postgresql12.x86_64 12.14-1PGDG.rhel7 @pgdg12
postgresql12-libs.x86_64 12.14-1PGDG.rhel7 @pgdg12
postgresql12-server.x86_64 12.14-1PGDG.rhel7 @pgdg12
postgresql96.x86_64 9.6.11-1PGDG.rhel7 @pgdg96
postgresql96-contrib.x86_64 9.6.11-1PGDG.rhel7 @pgdg96
postgresql96-libs.x86_64 9.6.11-1PGDG.rhel7 @pgdg96
postgresql96-server.x86_64 9.6.11-1PGDG.rhel7 @pgdg96

the running version is 9.6

[root@xx ~]# ps -ef| grep D
UID PID PPID C STIME TTY TIME CMD
postgres 1436 1 0 Apr18 ? 06:56:14 /usr/pgsql-9.6/bin/postmaster -D /var/lib/pgsql/9.6/data/

in the server is also installed the alternatives packages which is configured that way:


[root@xx ~]# alternatives --list
libnssckbi.so.x86_64 auto /usr/lib64/pkcs11/p11-kit-trust.so
ld auto /usr/bin/ld.bfd
mta manual /usr/sbin/sendmail.sendmail
pgsql-ld-conf auto /usr/pgsql-12/share/postgresql-12-libs.conf
pgsql-psql auto /usr/pgsql-12/bin/psql
pgsql-clusterdb auto /usr/pgsql-12/bin/clusterdb
pgsql-createdb auto /usr/pgsql-12/bin/createdb
pgsql-createlang auto /usr/pgsql-9.6/bin/createlang
pgsql-createuser auto /usr/pgsql-12/bin/createuser
pgsql-dropdb auto /usr/pgsql-12/bin/dropdb
pgsql-droplang auto /usr/pgsql-9.6/bin/droplang
pgsql-dropuser auto /usr/pgsql-12/bin/dropuser
pgsql-pg_basebackup auto /usr/pgsql-12/bin/pg_basebackup
pgsql-pg_dump auto /usr/pgsql-12/bin/pg_dump
pgsql-pg_dumpall auto /usr/pgsql-12/bin/pg_dumpall
pgsql-pg_restore auto /usr/pgsql-12/bin/pg_restore
pgsql-reindexdb auto /usr/pgsql-12/bin/reindexdb
pgsql-vacuumdb auto /usr/pgsql-12/bin/vacuumdb
pgsql-clusterdbman auto /usr/pgsql-12/share/man/man1/clusterdb.1
pgsql-createdbman auto /usr/pgsql-12/share/man/man1/createdb.1
pgsql-createlangman auto /usr/pgsql-9.6/share/man/man1/createlang.1
pgsql-createuserman auto /usr/pgsql-12/share/man/man1/createuser.1
pgsql-dropdbman auto /usr/pgsql-12/share/man/man1/dropdb.1
pgsql-droplangman auto /usr/pgsql-9.6/share/man/man1/droplang.1
pgsql-dropuserman auto /usr/pgsql-12/share/man/man1/dropuser.1
pgsql-pg_basebackupman auto /usr/pgsql-12/share/man/man1/pg_basebackup.1
pgsql-pg_dumpman auto /usr/pgsql-12/share/man/man1/pg_dump.1
pgsql-pg_dumpallman auto /usr/pgsql-12/share/man/man1/pg_dumpall.1
pgsql-pg_restoreman auto /usr/pgsql-12/share/man/man1/pg_restore.1
pgsql-psqlman auto /usr/pgsql-12/share/man/man1/psql.1
pgsql-reindexdbman auto /usr/pgsql-12/share/man/man1/reindexdb.1
pgsql-vacuumdbman auto /usr/pgsql-12/share/man/man1/vacuumdb.1
postgis-pgsql2shp auto /usr/pgsql-9.6/bin/pgsql2shp
postgis-shp2pgsql auto /usr/pgsql-9.6/bin/shp2pgsql


As far as I know, alternatives package uses path /etc/alternatives/ and create links from /usr/bin to /etc/alternatives
which in turn links to the binaries to the correct selected version (/usr/pgsql-9.6/bin OR /usr/pgsql-12/bin).
We have checked the current alternatives configuration, and it knows only about 9.6 and 12 relases:

[root@xx ~]# alternatives --display pgsql-psql
pgsql-psql - status is auto.
link currently points to /usr/pgsql-12/bin/psql
/usr/pgsql-9.6/bin/psql - priority 960
/usr/pgsql-12/bin/psql - priority 1200
Current `best' version is /usr/pgsql-12/bin/psql.


At present in /usr/bin there are not links as aspected for use with alternatives, but there are files belonging to
9.2 version except for pg_basebackup:

[root@xx ~]# ls -l /usr/bin/p*
lrwxrwxrwx. 1 root root 37 Apr 30 08:05 /usr/bin/pg_basebackup -> /etc/alternatives/pgsql-pg_basebackup
-rwxr-xr-x. 1 root root 28672 May 12 2020 /usr/bin/pg_config
-rwxr-xr-x. 1 root root 313120 May 12 2020 /usr/bin/pg_dump
-rwxr-xr-x. 1 root root 75672 May 12 2020 /usr/bin/pg_dumpall
-rwxr-xr-x. 1 root root 129872 May 12 2020 /usr/bin/pg_restore
-rwxr-xr-x. 1 root root 449272 May 12 2020 /usr/bin/psql


[root@xx ~]# /usr/bin/psql --version
psql (PostgreSQL) 9.2.24
[root@xx ~]# /usr/bin/pg_dump --version
pg_dump (PostgreSQL) 9.2.24


we have checked whit rpm and it seems that the 9.2 package is the only one that put files in /usr/bin:


relase 9.2
[root@xx local]# rpm -ql postgresql.x86_64
/usr/bin/clusterdb
/usr/bin/createdb
/usr/bin/createlang
/usr/bin/createuser
/usr/bin/dropdb
/usr/bin/droplang
/usr/bin/dropuser
/usr/bin/pg_config
/usr/bin/pg_dump
/usr/bin/pg_dumpall
/usr/bin/pg_restore
/usr/bin/psql
/usr/bin/reindexdb
/usr/bin/vacuumdb
/usr/lib64/pgsql

release 9.6
[root@xx local]# rpm -ql postgresql96-server.x86_64
/etc/pam.d/postgresql
/etc/sysconfig/pgsql
/usr/lib/systemd/system/postgresql-9.6.service
/usr/lib/tmpfiles.d/postgresql-9.6.conf
/usr/pgsql-9.6/bin/initdb
/usr/pgsql-9.6/bin/pg_controldata
/usr/pgsql-9.6/bin/pg_ctl
/usr/pgsql-9.6/bin/pg_resetxlog
/usr/pgsql-9.6/bin/postgres
/usr/pgsql-9.6/bin/postgresql96-check-db-dir
/usr/pgsql-9.6/bin/postgresql96-setup
/usr/pgsql-9.6/bin/postmaster

release 12
[root@xx local]# rpm -ql postgresql12-server.x86_64
/etc/pam.d/postgresql
/etc/sysconfig/pgsql
/usr/bin/postgresql-12-setup
/usr/lib/systemd/system/postgresql-12.service
/usr/lib/tmpfiles.d/postgresql-12.conf
/usr/pgsql-12/bin/initdb
/usr/pgsql-12/bin/pg_checksums
/usr/pgsql-12/bin/pg_controldata
/usr/pgsql-12/bin/pg_ctl
/usr/pgsql-12/bin/pg_resetwal
/usr/pgsql-12/bin/postgres
/usr/pgsql-12/bin/postgresql-12-check-db-dir
/usr/pgsql-12/bin/postgresql-12-setup
/usr/pgsql-12/bin/postmaster

Of course we will try to test in a VM created as a clone of the producion to verify any step (it is not our own server).
the quesions are:

Could we have trouble having 9.6 and 12 running in the same time (we will upgrade with pg_upgrade) in such server?
HOW can we to fix the presence of release 9.2 files in /usr/bin?
Will the simbolic links in /usr/bin be created by alternatives once the 9.2 release will be dropped/deinstalled/deleted?

Any suggestion is welcome
Thanks in advance

regards
Marco

pgsql-general by date:

Previous
From: William Edwards
Date:
Subject: Re: Sample pg_hba.conf allows local users to access all databases
Next
From: Christoph Moench-Tegeder
Date:
Subject: Re: Different releases in the same server