pgbouncer server (440a:90a0:302:4525:lda0:1:2:3)
pgbouncer.ini
[databases]
app_db = host=pg_server port=5432 dbname=app_db
[pgbouncer]
listen_port = 6432
listen_addr = 127.0.0.1
auth_type = md5
auth_file = userlist.txt
logfile = pgbouncer.log
pidfile = pgbouncer.pid
admin_users = someuser
Test connection:
-bash-4.2$ psql -p 6432 -h pg_server -U postgres app_db
psql: could not connect to server: Connection refused
Is the server running on host "pg_server" (340b:c210:402:4545:3a1a:1:2:3) and accepting
TCP/IP connections on port 6432?
Network ports:
sudo lsof -i -P -n | grep LISTEN | grep 6432
pgbouncer 160039 postgres 7u IPv4 39990293 0t0 TCP 127.0.0.1:6432 (LISTEN)
postgresql server (340b:c210:402:4545:3a1a:1:2:3)
Telnet pgbouncer server with 6432 port:
$ telnet -6 440a:90a0:302:4525:lda0:1:2:3 6432
Trying 440a:90a0:302:4525:lda0:1:2:3...
telnet: connect to address 440a:90a0:302:4525:lda0:1:2:3: Connection refused
Try to connect to pgbouncer server 5432 port(postgresql server installed on pgbouncer server):
telnet -6 440a:90a0:302:4525:lda0:1:2:3 5432
Trying 440a:90a0:302:4525:lda0:1:2:3...
Connected to 440a:90a0:302:4525:lda0:1:2:3.
Escape character is '^]'.
Why can't accept 6432 port on postgresql server(340b:c210:402:4545:3a1a:1:2:3)?
Best Answer
Your PgBouncer is not listening on IPv6 address because this line tells it so:
You should change it to something which includes IPv6 addresses, like
or maybe (to listen on all interfaces):
Side note: you should probably not publish your real addresses, even if "440a:90a0:302:4525:lda0:1:2:3" is not a valid ipv6 address :-)