pgbouncer 服务器 (440a:90a0:302:4525:lda0:1:2:3)
弹跳器.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
测试连接:
-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?
网络端口:
sudo lsof -i -P -n | grep LISTEN | grep 6432
pgbouncer 160039 postgres 7u IPv4 39990293 0t0 TCP 127.0.0.1:6432 (LISTEN)
postgresql 服务器 (340b:c210:402:4545:3a1a:1:2:3)
Telnet pgbouncer 服务器与 6432 端口:
$ 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
尝试连接到 pgbouncer 服务器的 5432 端口(安装在 pgbouncer 服务器上的 postgresql 服务器):
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 '^]'.
为什么不能在 postgresql 服务器上接受 6432 端口(340b:c210:402:4545:3a1a:1:2:3)?
你的 PgBouncer 没有监听 IPv6 地址,因为这条线告诉它:
您应该将其更改为包含 IPv6 地址的内容,例如
或者也许(在所有接口上监听):
旁注:您可能不应该发布您的真实地址,即使“440a:90a0:302:4525:lda0:1:2:3”不是有效的 ipv6 地址 :-)