3

I need to run queries against postgres. Postgres runs on a kubernetes PODs (HA architecture). In the old system this was done by copying a script onto the POD and run it locally. If I try that now, I get:

psql: FATAL: no pg_hba.conf entry for host "[local]" my_RO_user

From some research it seems better-practice to run my query from another machine. I can find the master POD. What would I need as connect-string and query-string?

Note that /pgdata/pg11/pg_hba.conf contains:

# Do not edit this file manually!
# It will be overwritten by Patroni!
local all "postgres" peer
hostssl replication "_crunchyrepl" all cert
hostssl "postgres" "_crunchyrepl" all cert
host all "_crunchyrepl" all reject
host all "ccp_monitoring" "127.0.0.0/8" md5
host all "ccp_monitoring" "::1/128" md5
local all postgres peer
hostssl replication _crunchyrepl all cert
hostssl postgres _crunchyrepl all cert
host all _crunchyrepl all reject
hostssl all all all md5
host platform_analytics_wh mstr_pa all password

The database is analysisdb, the user is rouser, and the database listens on port 5432.

Can anyone suggest a way forward? Either fix that pg_hba error, or clarify how to query remotely?

0

1 Answer 1

3

Given on your information, if the PostgreSQL pod listens on IP address 1.2.3.4, the connect string would be

host=1234 port=5432 user=rouser password=mypassword dbname=analysisdb sslmode=require

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.