Thread: Unable to connect to Postgres13 server from psql client built on master
Unable to connect to Postgres13 server from psql client built on master
From
sirisha chamarthi
Date:
Hi hackers.
I am unable to connect to my Postgres server (version 13 running) in Azure Postgres from the PSQL client built on the latest master. However, I am able to connect to the Postgres 15 server running locally on the machine. I installed an earlier version of the PSQL client (v 12) and was able to connect to both the Azure PG instance as well as the local instance. Can this be a bug in the master? I tried looking at the server logs in Azure but couldn't get anything meaningful from those. Any tips on how I can debug psql client further?
My local server is running with trust authentication and the remote server is running with md5 in the pg_hba.conf. I am not sure if this changes the psql behavior somehow.
root@userspgdev:/usr/local/pgsql# ./psql -U postgres -h inst.postgres.database.azure.com -d postgres
bash: ./psql: No such file or directory
root@userspgdev:/usr/local/pgsql# psql -U postgres -h inst.postgres.database.azure.com -d postgres
Password for user postgres:
psql (12.9 (Ubuntu 12.9-0ubuntu0.20.04.1), server 13.6)
WARNING: psql major version 12, server major version 13.
Some psql features might not work.
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.
postgres=> \q
bin/psql -U postgres -h inst.postgres.database.azure.com -d postgres
psql: error: connection to server at "inst.postgres.database.azure.com" (20.116.167.xx), port 5432 failed: FATAL: no pg_hba.conf entry for host "20.125.61.xx", user "postgres", database "postgres", SSL off
Also, wondering why no error is emitted by the psql client when the connection attempt fails?
Thanks,
Sirisha
Re: Unable to connect to Postgres13 server from psql client built on master
From
Julien Rouhaud
Date:
Hi, On Tue, Apr 12, 2022 at 12:47:54AM -0700, sirisha chamarthi wrote: > > I am unable to connect to my Postgres server (version 13 running) in Azure > Postgres from the PSQL client built on the latest master. However, I am > able to connect to the Postgres 15 server running locally on the machine. I > installed an earlier version of the PSQL client (v 12) and was able to > connect to both the Azure PG instance as well as the local instance. Can > this be a bug in the master? I tried looking at the server logs in Azure > but couldn't get anything meaningful from those. Any tips on how I can > debug psql client further? > > root@userspgdev:/usr/local/pgsql# psql -U postgres -h > inst.postgres.database.azure.com -d postgres > Password for user postgres: > psql (12.9 (Ubuntu 12.9-0ubuntu0.20.04.1), server 13.6) > WARNING: psql major version 12, server major version 13. > Some psql features might not work. > SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: > 256, compression: off) > Type "help" for help. > > postgres=> \q > > bin/psql -U postgres -h inst.postgres.database.azure.com -d postgres > psql: error: connection to server at "inst.postgres.database.azure.com" > (20.116.167.xx), port 5432 failed: FATAL: no pg_hba.conf entry for host > "20.125.61.xx", user "postgres", database "postgres", SSL off It's hard to be sure without the pg_hba.conf file, but the most likely explanation is that your remote server only accept connection with SSL and you haven't built your local binaries with SSL support.