yugck
yugck

Reputation: 11

PgBouncer - Server DNS lookup failed

I am trying to test PgBouncer connection with pgbench on a PostgreSQL server. But I'm getting error as closing because: server DNS lookup failed and at pgbench getting this message:

pgbench -c 10 -t 10 -C -f C:\Users\Administrator\Downloads\query.sql -U postgres -p 6432 -n tags
Password:
pgbench: error: connection to server at "localhost" (::1), port 6432 failed: FATAL:  client_login_timeout (server down)

This is observed in PgBouncer log:

LOG C-01715ff0: tags/postgres@[::1]:52768 login attempt: db=tags user=postgres tls=no
WARNING DNS lookup failed: localhost: result=11001
LOG S-0174d218: tags/postgres@(bad-af):0 closing because: server DNS lookup failed (age=0s)

I'm running PostgreSQL-14.5 on Windows Server 2019

PgBouncer Config:

[databases]
postgres = host=localhost port=5435
tags = dbname=postgres host=localhost port=5435 user=postgres password=Admin@!23 auth_user=postgres

[pgbouncer]
logfile = C:\Program Files (x86)\PgBouncer\log\pgbouncer.log
pidfile = C:\Program Files (x86)\PgBouncer\log\pgbouncer.pid
listen_addr = *
listen_port = 6432
auth_type = md5
auth_file = C:\Program Files (x86)\PgBouncer\etc\userlist.txt
admin_users = postgres
stats_users = postgres
pool_mode = session
max_client_conn = 100
default_pool_size = 20

I tried solutions suggested in this post, like, setting listen_addresses = '*' in postgresql.conf but could not get the issue resolved. I also searched over the internet for the solution & did not find any.
Am I missing anything or please suggest a solution to this issue. Thanks in advance.

Upvotes: 0

Views: 1695

Answers (1)

yugck
yugck

Reputation: 11

I can connect to Postgres DB after setting [databases] configuration in pgbouncer.ini like this : tags = host=127.0.0.1 port=5435 auth_user=postgres dbname=postgres.

Turns out the issue was with localhost not added in pg_hba.conf.

Upvotes: 0

Related Questions