From: hubert depesz lubaczewski <depesz@depesz.com>
To: Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: cant connect to localhost:5432 (but unix socket ok)
Date: Thu, 4 Feb 2021 15:26:27 +0100
Message-ID: <20210204142627.GA22609@depesz.com> (raw)
In-Reply-To: <CALyyT7TQMb2K-9+ydKaRUc-7gBWSvGgzaoTFeE0M7Qq1QmdWog@mail.gmail.com>
References: <CALyyT7TQMb2K-9+ydKaRUc-7gBWSvGgzaoTFeE0M7Qq1QmdWog@mail.gmail.com>
On Thu, Feb 04, 2021 at 02:20:10PM +0000, Joao Miguel Ferreira wrote:
> My database is not listening on TCP/localhost, desptite it is listening on the unix socket. How can I investigate this?
> I could have done something that is out of my understanding because I have been loading some big pg_dumpall files that might contain
> administrative changes that I am not fully aware of.
There are couple of potential issues:
1. it might listen on different port than 5432. What does "show port;"
show in psql?
2. it could be that there is a firewall (weird, but possible)
3. it could be that it's listening on another address(es) than
127.0.0.1 / ::1 - what is output of "show listen_addresses;"?
4. Verify that it really does listen on something. As root run:
ss -ntlp | grep postgres
depesz
> Here are some details about the connection issue:
> root@deb10tp:~# id
> uid=0(root) gid=0(root) groups=0(root)
> root@deb10tp:~# su postgres
> postgres@deb10tp:/root$ id
> uid=116(postgres) gid=126(postgres) groups=126(postgres),125(ssl-cert)
> postgres@deb10tp:/root$ cd /
> postgres@deb10tp:/$ psql -h localhost
> psql: could not connect to server: Connection refused
> Is the server running on host "localhost" (::1) and accepting
> TCP/IP connections on port 5432?
> could not connect to server: Connection refused
> Is the server running on host "localhost" (127.0.0.1) and accepting
> TCP/IP connections on port 5432?
> postgres@deb10tp:/$ psql
> psql (11.9 (Debian 11.9-0+deb10u1))
> Type "help" for help.
> postgres=#
> Thank you
> Joao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: depesz@depesz.com, joao.miguel.c.ferreira@gmail.com
Subject: Re: cant connect to localhost:5432 (but unix socket ok)
In-Reply-To: <20210204142627.GA22609@depesz.com>
References: <CALyyT7TQMb2K-9+ydKaRUc-7gBWSvGgzaoTFeE0M7Qq1QmdWog@mail.gmail.com> <20210204142627.GA22609@depesz.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox