I have a problem similar to https://dba.stackexchange.com/questions/185622/how-do-i-change-postgresql-to-be-listening-on-port-5432 , though not necessarily exactly the same.
If port is defined as 5432 in /etc/postgresql/14/main/postgresql.conf, Postgres binds to 127.0.0.1:5433. If I change the port to some other different number, e.g. 5431 it indeed changes to listening on that port. I have checked with lsof and netstat that when Pgsql is down, nothing listens on that port.
How can I fix that?
Platform: Ubuntu 22.04.
UPDATE:
# pg_lsclusters Ver Cluster Port Status Owner Data directory Log file 14 main 5431 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log # find / -name postmaster 2>/dev/null /usr/lib/postgresql/14/bin/postmaster /usr/lib/postgresql/14/lib/bitcode/postgres/postmaster
straceandltrace. Make sure you are changing the right configuration file.pg_lsclustersalsosudo find / -name postmasterand post resultssudo lsof -n | fgrep '(LISTEN)' | grep -P 'postgresql|\D5432\D'will be informative. orsudo systemctl restart postgresqlmay produce something informative in/var/log/postgresql/postgresql-14-main.log. also if you don't actually care what the cause is you could try rebooting.