问题描述
我的 pgbouncer.ini 文件:
[databases]
* = host=127.0.0.1 port=5432 auth_user=pgbouncer_auth
[pgbouncer]
listen_port = 6432
listen_addr = 127.0.0.1
auth_type = md5
auth_file = ./pgbouncer_user.txt
auth_user = pgbouncer_auth
auth_query = SELECT usename,passwd FROM user_search($1)
logfile = pgbouncer.log
pidfile = pgbouncer.pid
admin_users = aakashverma,postgres
我正在使用的命令
psql -p 6432 -U aakashverma -d postgres
服务器的调试信息:
2021-05-24 09:52:53.001 India Standard Time [19124] LOG S-028fcb48: postgres/pgbouncer_auth@127.0.0.1:5432 closing because: unexpected response from login query (age=0s)
2021-05-24 09:52:53.015 India Standard Time [19124] LOG C-028c57a0: postgres/(nouser)@127.0.0.1:56255 closing because: unexpected response from login query (age=0s)
2021-05-24 09:52:53.027 India Standard Time [19124] WARNING C-028c57a0: postgres/(nouser)@127.0.0.1:56255 pooler error: unexpected response from login query
2021-05-24 09:53:47.414 India Standard Time [19124] LOG stats: 0 xacts/s,0 queries/s,in 0 B/s,out 4 B/s,xact 0 us,query 0 us,wait 2467 us
2021-05-24 09:54:47.409 India Standard Time [19124] LOG stats: 0 xacts/s,out 0 B/s,wait 0 us
2021-05-24 09:55:47.411 India Standard Time [19124] LOG stats: 0 xacts/s,wait 0 us
我哪里出错了? postgres/(nouser)
似乎暗示了一些暗示。
解决方法
好的,所以问题是我试图以 admin_users
(aakashverma) 之一的身份登录,但我没有在 pgbouncer_user.txt
文件 - 我的 auth_file
中提到它们。我最初在那个文件中只有我的 auth_user
。
在文件的每一行中提及它们(因为我使用的是 auth_query
,所以只要用户名就足够了)
"pgbouncer_auth" "md58b235183e543896e3521c8a29a2272e1"
"aakashverma"
"postgres"