【发布时间】:2019-07-25 01:08:36
【问题描述】:
我正在尝试设置一个 pgbouncer 池,该池使用包含用户和密码的池定义连接到数据库。
随后,每个客户端应用程序应使用不同的用户和密码进行连接。这个想法是一个池由多个客户端用户共享。
这可能吗?
这是我的设置: pgbouncer.ini
[databases]
testpool = host=testpool.mycompany.com dbname=db1 port=544 user=company_dbo password=company123 max_db_connections=20
[pgbouncer]
auth_type = plain
auth_file = /etc/pgbouncer/users.txt
users.txt
"test_user" "test123"
当我尝试连接时出现以下错误
$ export PGPASSWORD='test123';psql -h localhost -U test_user -d db1 -p 5442
psql: ERROR: password authentication failed for user "test_user"
日志说
2019-03-03 16:04:02.668 1 LOG C-0x2022000: db1/test_user@172.17.0.1:33204 login attempt: db=db1 user=test_user tls=no
2019-03-03 16:04:02.719 1 LOG S-0x2026fd0: db1/test_user@10.1.0.118:5442 new connection to server (from 172.17.0.2:58920)
2019-03-03 16:04:02.762 1 WARNING server login failed: FATAL password authentication failed for user "test_user"
似乎 pgbouncer 尝试使用客户端用户和密码登录数据库,而不是在 [databases] 部分中指定的用户和密码。
【问题讨论】:
标签: postgresql connection-pooling pool pgbouncer