2012-11-01 18 views
4

我在配置爲主熱備份的兩臺PostgreSQL 9.1中使用pgpool-II 3.2.1。pgpool-II身份驗證失敗

當試圖從pgAdmin的驗證,我得到:

Error connecting to the server: FATAL: password authentication failed for user "postgres" 

在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 

什麼是真正奇怪的是,從日誌的MD5哈希有所以每個請求改變與我在/ usr/local/etc/pool_passwd和/usr/local/etc/pcp.conf中設置的設置相比,沒有什麼意義。

您能幫我發現配置問題嗎?

回答

3

這取決於你如何使用「pg_md5」 ......如果你不包括用戶名,那麼就會產生錯誤的MD5,因爲沒有:您可以通過運行下面的SQL查詢得到的DB MD5

root:/usr/local/etc# pg_md5 password1 
7c6a180b36896a0a8c02787eeafb0e4c 

但是,如果你使用正確的語法,那麼你會得到正確的條目會自動把你的pool_password文件:懷疑公司在鹽使用

root:/usr/local/etc# pg_md5 -m -u greg password1 
[email protected]:/usr/local/etc# grep greg: pool_passwd 
greg:md53c5b45b54c89f8af9074a2ad371e2c12 
+0

將「md5」作爲哈希的前綴是否有效? – shadfc

+0

@shadfc:是的,絕對 - 它是PostgreSQL中的標準加密密碼格式 – filiprem

5

發現問題!其與pgpool一起運

pg_md5產生一個不正確的MD5(當我用它)。在我用PostgreSQL數據庫中的md5替換它之後,它工作了。

select passwd from pg_shadow where usename = 'username'; 
+0

注意,我必須使用'單引號'圍繞我的** usernam e **和**密碼**或pg_md5正在生成錯誤的散列。它在添加引號後工作。在大多數情況下,這可能是錯誤的。 –