From: Jain, Ankit <Ankit.Jain@snapon.com>
To: Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: depesz@depesz.com <depesz@depesz.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: RE: cant connect to localhost:5432 (but unix socket ok)
Date: Fri, 5 Feb 2021 13:16:26 +0000
Message-ID: <3899e8683a8c4de9ad910ee44ef6796f@snapon.com> (raw)
In-Reply-To: <CALyyT7TVVZ3hQfxZ0=UuxvQGHKGeaX5NQPpqD5g1Lese2mjBsA@mail.gmail.com>
References: <CALyyT7TQMb2K-9+ydKaRUc-7gBWSvGgzaoTFeE0M7Qq1QmdWog@mail.gmail.com>
<20210204142627.GA22609@depesz.com>
<CALyyT7TKt8kgBU2qOhLFvAS11YNbrSq=Vsgj-02hBa+0KNQ88g@mail.gmail.com>
<4093909.1612450232@sss.pgh.pa.us>
<CALyyT7TjipKJN_zm4ON_e-3YPMk9TyVG4vg3yA1wMXNVN0dEqw@mail.gmail.com>
<CALyyT7QvS_NnXb6hOiY2XiG86QjDuf9vBWWnONHvQ0senJPbgg@mail.gmail.com>
<CALyyT7TVVZ3hQfxZ0=UuxvQGHKGeaX5NQPpqD5g1Lese2mjBsA@mail.gmail.com>
Did you try modifying the firewall settings ?
Add postgres service to the firewall. If that doesn’t work, explicitly open the port 5433 in the firewall.
From: Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com>
Sent: Thursday, February 4, 2021 10:08 AM
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: depesz@depesz.com; pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: cant connect to localhost:5432 (but unix socket ok)
CAUTION: This email originated from outside of Snap-on. Do not click on links or open attachments unless you have validated the sender, even if it is a known contact. Contact the sender by phone to validate the contents.
On Thu, Feb 4, 2021 at 3:04 PM Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com<mailto:joao.miguel.c.ferreira@gmail.com>> wrote:
On Thu, Feb 4, 2021 at 3:02 PM Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com<mailto:joao.miguel.c.ferreira@gmail.com>> wrote:
Hi Tom
On Thu, Feb 4, 2021 at 2:50 PM Tom Lane <tgl@sss.pgh.pa.us<mailto:tgl@sss.pgh.pa.us>> wrote:
Joao Miguel Ferreira <joao.miguel.c.ferreira@gmail.com<mailto:joao.miguel.c.ferreira@gmail.com>> writes:
> On Thu, Feb 4, 2021 at 2:26 PM hubert depesz lubaczewski <depesz@depesz.com<mailto:depesz@depesz.com>>
> wrote:
>>> My database is not listening on TCP/localhost, desptite it is listening
>>>> on the unix socket. How can I investigate this?
> it's on 5433:
Hmm, something odd there, because a port number mismatch should have
resulted in psql failing to connect via unix socket either. Maybe
you have more than one active postmaster?
"ps xauwww | grep postgres" shows only one postgres process (and a few vaccum related)
here is the full list:
root@deb10tp:~# ps xauww | grep postgres
postgres 825 0.0 0.1 213472 14980 ? S 09:59 0:01 /usr/lib/postgresql/11/bin/postgres -D /var/lib/postgresql/11/main -c config_file=/etc/postgresql/11/main/postgresql.conf
postgres 847 0.0 0.0 213572 5660 ? Ss 09:59 0:00 postgres: 11/main: checkpointer
postgres 848 0.0 0.0 213472 3808 ? Ss 09:59 0:00 postgres: 11/main: background writer
postgres 849 0.0 0.0 213472 3688 ? Ss 09:59 0:00 postgres: 11/main: walwriter
postgres 850 0.0 0.0 214012 5628 ? Ss 09:59 0:01 postgres: 11/main: autovacuum launcher
postgres 852 0.0 0.4 102172 34612 ? Ss 09:59 0:10 postgres: 11/main: stats collector
postgres 853 0.0 0.0 213880 4260 ? Ss 09:59 0:00 postgres: 11/main: logical replication launcher
root 9652 0.0 0.0 6208 884 pts/1 S+ 15:06 0:00 grep postgres
root@deb10tp:~#
yes, I see your point. makes sense. the unix socket is actually also on 5433
root@deb10tp:~# grep -nr 543 /etc/postgresql
/etc/postgresql/11/main/postgresql.conf:63:port = 5433
root@deb10tp:~# find /var/run/postgresql/ | grep 543
/var/run/postgresql/.s.PGSQL.5433
/var/run/postgresql/.s.PGSQL.5433.lock
root@deb10tp:~#
Anyway, given these settings, "psql -p 5433 -h localhost" should
connect. If you still get "connection refused" then you need to
look at the kernel firewall (packet filter) settings.
yes, with "-p 5433" I can connect
regards, tom lane
thanks
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: Ankit.Jain@snapon.com, joao.miguel.c.ferreira@gmail.com, tgl@sss.pgh.pa.us, depesz@depesz.com
Subject: Re: cant connect to localhost:5432 (but unix socket ok)
In-Reply-To: <3899e8683a8c4de9ad910ee44ef6796f@snapon.com>
References: <CALyyT7TQMb2K-9+ydKaRUc-7gBWSvGgzaoTFeE0M7Qq1QmdWog@mail.gmail.com> <20210204142627.GA22609@depesz.com> <CALyyT7TKt8kgBU2qOhLFvAS11YNbrSq=Vsgj-02hBa+0KNQ88g@mail.gmail.com> <4093909.1612450232@sss.pgh.pa.us> <CALyyT7TjipKJN_zm4ON_e-3YPMk9TyVG4vg3yA1wMXNVN0dEqw@mail.gmail.com> <CALyyT7QvS_NnXb6hOiY2XiG86QjDuf9vBWWnONHvQ0senJPbgg@mail.gmail.com> <CALyyT7TVVZ3hQfxZ0=UuxvQGHKGeaX5NQPpqD5g1Lese2mjBsA@mail.gmail.com> <3899e8683a8c4de9ad910ee44ef6796f@snapon.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