How to tell which Postgres is being used? And Ubuntu upgrade? #6223
Replies: 2 comments 3 replies
-
What does Only postgresql-10 is in the standard package repos for Ubuntu 18.04, but it is possible to have multiple versions running concurrently, as systemd uses a template unit file
(See If you do have multiple versions running, then they must be listening on different ports and/or Unix domain sockets. Netbox will choose which one to connect to based on what's in The default port is 5432. Use
I haven't yet; I will probably do so with python 3.6 support is dropped (Netbox 2.12). I don't see any major problem, since Netbox's python dependencies are self-contained in a virtualenv; running If the server does have a bunch of legacy versions of postgres installed, or has already been through several in-place upgrades, then maybe you're better off with a fresh install of 20.04 and Netbox, and migrate the database contents. |
Beta Was this translation helpful? Give feedback.
-
The default way Debian-based systems handle new Postgres versions is to
create a new cluster with the new version, and leave the old one running
on a different port, without migrating data. If you haven't performed a
data migration specifically, your data is most likely in one of the
older version clusters.
You can find out which clusters are running which versions on which
ports with:
sudo pg_lsclusters
To pull the data forward, you need to drop any clusters called 'main' on
the version you want to move to (`pg_dropcluster --stop <version>
main`). Obviously this will cause data loss if you get it wrong, so do a
backup. Once the conflicting cluster is removed, you can use the Debian
upgrade script:
sudo pg_upgradecluster -v <target version> <current version> main
Once this is complete and you've verified the new version is working,
drop the old cluster as the script instructs.
…On 2021-04-20 8:54 a.m., Dirk Melvin wrote:
Thank you very much for the quick reply!
I think from the various commands you mentioned above that it is v12
being actively used.
***@***.***:/etc/postgresql/9.1/main# dpkg-query -l | grep postgres
ii pgdg-keyring 2018.2 all keyring for apt.postgresql.org
ii postgresql-12 12.6-1.pgdg18.04+1 amd64 The World's Most Advanced
Open Source Relational Database
ii postgresql-9.1 9.1.24-7.pgdg18.04+1 amd64 object-relational SQL
database, version 9.1 server
ii postgresql-9.2 9.2.24-4.pgdg18.04+1 amd64 object-relational SQL
database, version 9.2 server
ii postgresql-9.3 9.3.25-3.pgdg18.04+1 amd64 object-relational SQL
database, version 9.3 server
ii postgresql-9.4 9.4.26-2.pgdg18.04+1 amd64 object-relational SQL
database, version 9.4 server
ii postgresql-9.5 9.5.25-1.pgdg18.04+1 amd64 The World's Most Advanced
Open Source Relational Database
ii postgresql-9.6 9.6.21-1.pgdg18.04+1 amd64 The World's Most Advanced
Open Source Relational Database
ii postgresql-client-12 12.6-1.pgdg18.04+1 amd64 front-end programs
for PostgreSQL 12
ii postgresql-client-9.1 9.1.24-7.pgdg18.04+1 amd64 front-end programs
for PostgreSQL 9.1
ii postgresql-client-9.2 9.2.24-4.pgdg18.04+1 amd64 front-end programs
for PostgreSQL 9.2
ii postgresql-client-9.3 9.3.25-3.pgdg18.04+1 amd64 front-end programs
for PostgreSQL 9.3
ii postgresql-client-9.4 9.4.26-2.pgdg18.04+1 amd64 front-end programs
for PostgreSQL 9.4
ii postgresql-client-9.5 9.5.25-1.pgdg18.04+1 amd64 front-end programs
for PostgreSQL 9.5
ii postgresql-client-9.6 9.6.21-1.pgdg18.04+1 amd64 front-end programs
for PostgreSQL 9.6
ii postgresql-client-common 225.pgdg18.04+1 all manager for multiple
PostgreSQL client versions
ii postgresql-common 225.pgdg18.04+1 all PostgreSQL database-cluster
manager
ii postgresql-contrib-9.1 9.1.24-7.pgdg18.04+1 amd64 additional
facilities for PostgreSQL
ii postgresql-contrib-9.2 9.2.24-4.pgdg18.04+1 amd64 additional
facilities for PostgreSQL
ii postgresql-contrib-9.3 9.3.25-3.pgdg18.04+1 amd64 additional
facilities for PostgreSQL
ii postgresql-contrib-9.4 9.4.26-2.pgdg18.04+1 amd64 additional
facilities for PostgreSQL
ii postgresql-contrib-9.5 9.5.25-1.pgdg18.04+1 amd64 additional
facilities for PostgreSQL
ii postgresql-contrib-9.6 9.6.21-1.pgdg18.04+1 amd64 additional
facilities for PostgreSQL
ii postgresql-plpython3-9.1 9.1.24-7.pgdg18.04+1 amd64 PL/Python 3
procedural language for PostgreSQL 9.1
ii postgresql-plpython3-9.2 9.2.24-4.pgdg18.04+1 amd64 PL/Python 3
procedural language for PostgreSQL 9.2
ii postgresql-plpython3-9.3 9.3.25-3.pgdg18.04+1 amd64 PL/Python 3
procedural language for PostgreSQL 9.3
ii postgresql-plpython3-9.4 9.4.26-2.pgdg18.04+1 amd64 PL/Python 3
procedural language for PostgreSQL 9.4
ii postgresql-plpython3-9.5 9.5.25-1.pgdg18.04+1 amd64 PL/Python 3
procedural language for PostgreSQL 9.5
ii postgresql-plpython3-9.6 9.6.21-1.pgdg18.04+1 amd64 PL/Python 3
procedural language for PostgreSQL 9.6
***@***.***:/etc/postgresql/9.1/main# systemctl | grep postgres
postgresql.service loaded active exited PostgreSQL RDBMS
***@***.*** ***@***.***> loaded
active running PostgreSQL Cluster 12-main
***@***.*** ***@***.***>
loaded active running PostgreSQL Cluster 9.1-main
***@***.*** ***@***.***>
loaded active running PostgreSQL Cluster 9.2-main
***@***.*** ***@***.***>
loaded active running PostgreSQL Cluster 9.3-main
***@***.*** ***@***.***>
loaded active running PostgreSQL Cluster 9.4-main
***@***.*** ***@***.***>
loaded active running PostgreSQL Cluster 9.5-main
***@***.*** ***@***.***>
loaded active running PostgreSQL Cluster 9.6-main
system-postgresql.slice loaded active active system-postgresql.slice
***@***.***:/etc/postgresql/9.1/main# netstat -natp | grep :5432
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 1589/postgres
tcp 0 0 127.0.0.1:5432 127.0.0.1:50246 ESTABLISHED 8388/postgres: 12/m
tcp 0 0 127.0.0.1:53054 127.0.0.1:5432 ESTABLISHED 3096/python3
tcp 0 0 127.0.0.1:50022 127.0.0.1:5432 ESTABLISHED 3099/python3
tcp 0 0 127.0.0.1:5432 127.0.0.1:50256 ESTABLISHED 8389/postgres: 12/m
tcp 0 0 127.0.0.1:5432 127.0.0.1:49966 ESTABLISHED 8366/postgres: 12/m
tcp 0 0 127.0.0.1:50246 127.0.0.1:5432 ESTABLISHED 3098/python3
tcp 0 0 127.0.0.1:50098 127.0.0.1:5432 ESTABLISHED 3098/python3
tcp 0 0 127.0.0.1:5432 127.0.0.1:50094 ESTABLISHED 8385/postgres: 12/m
tcp 0 0 127.0.0.1:5432 127.0.0.1:50124 ESTABLISHED 8387/postgres: 12/m
tcp 0 0 127.0.0.1:49934 127.0.0.1:5432 ESTABLISHED 3097/python3
tcp 0 0 127.0.0.1:5432 127.0.0.1:49946 ESTABLISHED 8336/postgres: 12/m
tcp 0 0 127.0.0.1:49980 127.0.0.1:5432 ESTABLISHED 3096/python3
tcp 0 0 127.0.0.1:49970 127.0.0.1:5432 ESTABLISHED 3096/python3
tcp 0 0 127.0.0.1:50256 127.0.0.1:5432 ESTABLISHED 3098/python3
tcp 0 0 127.0.0.1:53058 127.0.0.1:5432 ESTABLISHED 3095/python3
tcp 0 0 127.0.0.1:49972 127.0.0.1:5432 ESTABLISHED 3099/python3
tcp 0 0 127.0.0.1:5432 127.0.0.1:49972 ESTABLISHED 8370/postgres: 12/m
tcp 0 0 127.0.0.1:50056 127.0.0.1:5432 ESTABLISHED 3098/python3
tcp 0 0 127.0.0.1:5432 127.0.0.1:50056 ESTABLISHED 8381/postgres: 12/m
tcp 0 0 127.0.0.1:49976 127.0.0.1:5432 ESTABLISHED 3099/python3
tcp 0 0 127.0.0.1:49986 127.0.0.1:5432 ESTABLISHED 3095/python3
tcp 0 0 127.0.0.1:5432 127.0.0.1:53054 ESTABLISHED 72878/postgres: 12/
tcp 0 0 127.0.0.1:50124 127.0.0.1:5432 ESTABLISHED 3099/python3
tcp 0 0 127.0.0.1:49946 127.0.0.1:5432 ESTABLISHED 3096/python3
tcp 0 0 127.0.0.1:5432 127.0.0.1:49976 ESTABLISHED 8374/postgres: 12/m
tcp 0 0 127.0.0.1:49966 127.0.0.1:5432 ESTABLISHED 3095/python3
tcp 0 0 127.0.0.1:50094 127.0.0.1:5432 ESTABLISHED 3097/python3
tcp 0 0 127.0.0.1:5432 127.0.0.1:53048 ESTABLISHED 72876/postgres: 12/
tcp 0 0 127.0.0.1:5432 127.0.0.1:49962 ESTABLISHED 8365/postgres: 12/m
tcp 0 0 127.0.0.1:5432 127.0.0.1:53058 ESTABLISHED 72879/postgres: 12/
tcp 0 0 127.0.0.1:5432 127.0.0.1:49970 ESTABLISHED 8367/postgres: 12/m
tcp 0 0 127.0.0.1:53048 127.0.0.1:5432 ESTABLISHED 3097/python3
tcp 0 0 127.0.0.1:5432 127.0.0.1:50098 ESTABLISHED 8386/postgres: 12/m
tcp 0 0 127.0.0.1:49962 127.0.0.1:5432 ESTABLISHED 3095/python3
tcp 0 0 127.0.0.1:5432 127.0.0.1:50022 ESTABLISHED 8379/postgres: 12/m
tcp 0 0 127.0.0.1:5432 127.0.0.1:49986 ESTABLISHED 8377/postgres: 12/m
tcp 0 0 127.0.0.1:5432 127.0.0.1:49980 ESTABLISHED 8375/postgres: 12/m
tcp 0 0 127.0.0.1:5432 127.0.0.1:49934 ESTABLISHED 8324/postgres: 12/m
***@***.***:/etc/postgresql/9.1/main# ss -natp | grep :5432
LISTEN 0 128 127.0.0.1:5432 0.0.0.0:* users:(("postgres",pid=1589,fd=5))
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:50246
users:(("postgres",pid=8388,fd=10))
ESTAB 0 0 127.0.0.1:53054 127.0.0.1:5432
users:(("gunicorn",pid=3096,fd=18))
ESTAB 0 0 127.0.0.1:50022 127.0.0.1:5432
users:(("gunicorn",pid=3099,fd=17))
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:50256
users:(("postgres",pid=8389,fd=10))
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:49966
users:(("postgres",pid=8366,fd=10))
ESTAB 0 0 127.0.0.1:50246 127.0.0.1:5432
users:(("gunicorn",pid=3098,fd=17))
ESTAB 0 0 127.0.0.1:50098 127.0.0.1:5432
users:(("gunicorn",pid=3098,fd=16))
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:50094
users:(("postgres",pid=8385,fd=10))
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:50124
users:(("postgres",pid=8387,fd=10))
ESTAB 0 0 127.0.0.1:49934 127.0.0.1:5432
users:(("gunicorn",pid=3097,fd=14))
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:49946
users:(("postgres",pid=8336,fd=10))
ESTAB 0 0 127.0.0.1:49980 127.0.0.1:5432
users:(("gunicorn",pid=3096,fd=17))
ESTAB 0 0 127.0.0.1:49970 127.0.0.1:5432
users:(("gunicorn",pid=3096,fd=16))
ESTAB 0 0 127.0.0.1:50256 127.0.0.1:5432
users:(("gunicorn",pid=3098,fd=18))
ESTAB 0 0 127.0.0.1:53058 127.0.0.1:5432
users:(("gunicorn",pid=3095,fd=14))
ESTAB 0 0 127.0.0.1:49972 127.0.0.1:5432
users:(("gunicorn",pid=3099,fd=14))
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:49972
users:(("postgres",pid=8370,fd=10))
ESTAB 0 0 127.0.0.1:50056 127.0.0.1:5432
users:(("gunicorn",pid=3098,fd=14))
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:50056
users:(("postgres",pid=8381,fd=10))
ESTAB 0 0 127.0.0.1:49976 127.0.0.1:5432
users:(("gunicorn",pid=3099,fd=16))
ESTAB 0 0 127.0.0.1:49986 127.0.0.1:5432
users:(("gunicorn",pid=3095,fd=18))
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:53054
users:(("postgres",pid=72878,fd=10))
ESTAB 0 0 127.0.0.1:50124 127.0.0.1:5432
users:(("gunicorn",pid=3099,fd=19))
ESTAB 0 0 127.0.0.1:49946 127.0.0.1:5432
users:(("gunicorn",pid=3096,fd=14))
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:49976
users:(("postgres",pid=8374,fd=10))
ESTAB 0 0 127.0.0.1:49966 127.0.0.1:5432
users:(("gunicorn",pid=3095,fd=17))
ESTAB 0 0 127.0.0.1:50094 127.0.0.1:5432
users:(("gunicorn",pid=3097,fd=13))
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:53048
users:(("postgres",pid=72876,fd=10))
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:49962
users:(("postgres",pid=8365,fd=10))
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:53058
users:(("postgres",pid=72879,fd=10))
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:49970
users:(("postgres",pid=8367,fd=10))
ESTAB 0 0 127.0.0.1:53048 127.0.0.1:5432
users:(("gunicorn",pid=3097,fd=16))
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:50098
users:(("postgres",pid=8386,fd=10))
ESTAB 0 0 127.0.0.1:49962 127.0.0.1:5432
users:(("gunicorn",pid=3095,fd=16))
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:50022
users:(("postgres",pid=8379,fd=10))
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:49986
users:(("postgres",pid=8377,fd=10))
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:49980
users:(("postgres",pid=8375,fd=10))
ESTAB 0 0 127.0.0.1:5432 127.0.0.1:49934
users:(("postgres",pid=8324,fd=10))
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#6223 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALHILJNHIGHOPRR36MMWTLTJWPTHANCNFSM43IMXTCA>.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Running Ubuntu 18.04...have Postgres 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, and 12 installed apparently.
How do I tell which version is actually being used by Netbox?
Also, has anyone updated Ubuntu from 18.04 to 20.04 with Netbox already installed/running on the 18.04 OS?
Beta Was this translation helpful? Give feedback.
All reactions