postgresql pgpool-II 认证失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13179628/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
pgpool-II authentication failure
提问by ftraian
I am using pgpool-II 3.2.1 in from of two PostgreSQL 9.1 configured as master-hot standby.
我在两个配置为主热备用的 PostgreSQL 9.1 中使用 pgpool-II 3.2.1。
When trying to authenticate from PGAdmin I get:
尝试从 PGAdmin 进行身份验证时,我得到:
Error connecting to the server: FATAL: password authentication failed for user "postgres"
In pgpool logs I see:
在 pgpool 日志中,我看到:
2012-11-01 14:40:13 LOG: pid 3023: connection received: host=89.xxx.xxx.xxx port=57150
2012-11-01 14:40:13 DEBUG: pid 3023: Protocol Major: 1234 Minor: 5679 database: user:
2012-11-01 14:40:13 DEBUG: pid 3023: SSLRequest from client
2012-11-01 14:40:13 DEBUG: pid 3023: pool_ssl: SSL requested but SSL support is not available
2012-11-01 14:40:13 DEBUG: pid 3023: read_startup_packet: application_name: pgAdmin III - Browser
2012-11-01 14:40:13 DEBUG: pid 3023: Protocol Major: 3 Minor: 0 database: postgres user: postgres
2012-11-01 14:40:13 DEBUG: pid 3023: new_connection: connecting 0 backend
2012-11-01 14:40:13 DEBUG: pid 3023: new_connection: connecting 1 backend
2012-11-01 14:40:13 DEBUG: pid 3023: pool_ssl: SSL requested but SSL support is not available
2012-11-01 14:40:13 DEBUG: pid 3023: pool_ssl: SSL requested but SSL support is not available
2012-11-01 14:40:13 DEBUG: pid 3023: pool_read_message_length: slot: 0 length: 12
2012-11-01 14:40:13 DEBUG: pid 3023: pool_read_message_length: slot: 1 length: 12
2012-11-01 14:40:13 DEBUG: pid 3023: pool_do_auth: auth kind:5
2012-11-01 14:40:13 DEBUG: pid 3023: trying md5 authentication
2012-11-01 14:40:13 DEBUG: pid 3023: password does not match: frontend:md5286c9c7c4ac8a365170e0f448c99ad48 pgpool:md5cf0e9615c13af6243edfd11d2461d12e
2012-11-01 14:40:13 DEBUG: pid 3023: do_md5failed in slot 0
What is really strange is that the md5 hashes from logs change with each request so it doesn't really make sense comparing with the one I set in both /usr/local/etc/pool_passwd and /usr/local/etc/pcp.conf
真正奇怪的是,日志中的 md5 哈希值随每个请求而变化,因此与我在 /usr/local/etc/pool_passwd 和 /usr/local/etc/pcp.conf 中设置的哈希值相比并没有什么意义
Can you help me spot the configuration issue?
你能帮我找出配置问题吗?
采纳答案by ftraian
It depends on how you use "pg_md5"... if you're not including the username, then it will generate the wrong MD5 as no doubt that's used in the salt:
这取决于您如何使用“pg_md5”...如果您不包括用户名,那么它会生成错误的 MD5,因为毫无疑问,它在盐中使用:
root:/usr/local/etc# pg_md5 password1
7c6a180b36896a0a8c02787eeafb0e4c
But if you use the correct syntax, then you get the correct entry automatically put into your pool_password file:
但是,如果您使用正确的语法,那么您会自动将正确的条目放入 pool_password 文件中:
root:/usr/local/etc# pg_md5 -m -u greg password1
root@1:/usr/local/etc# grep greg: pool_passwd
greg:md53c5b45b54c89f8af9074a2ad371e2c12
回答by ftraian
Found the problem!
发现问题了!
pg_md5
which is shipped together with pgpool generated an incorrect md5 (when I used it). After I replaced it in the config with the md5 from the PostgreSQL DB it worked. You can get the DB md5 by running the following SQL query:
pg_md5
与 pgpool 一起提供的生成了不正确的 md5(当我使用它时)。在我用 PostgreSQL 数据库中的 md5 在配置中替换它后,它工作了。您可以通过运行以下 SQL 查询来获取 DB md5:
select passwd from pg_shadow where usename = 'username';