2016-10-21 42 views
1

我試圖設置使用pgbouncer 1.7.2對PostgreSQL 9.6 connectional池在Windows 10服務器無法連接到pgbouncer(PostgreSQL的)

嘗試連接在cmd

psql -p 6432 -h 127.0.0.1 postgres pgbouncer 

到pgbouncer給出錯誤:

psql: server closed the connection unexpectedly Server terminated abnormally before or while processing 

端口6432正在偵聽並正在尋找pg_log中沒有錯誤。

這裏是我的pgbouncer.ini配置文件:

[databases] 

    mydb = host=127.0.0.1 port=5432 dbname=mydb 

    [pgbouncer] 

    logfile = pgbouncer.log 
    pidfile = pgbouncer.pid 

    listen_addr = * 
    listen_port = 6432 

    auth_type = md5 
    auth_file = C:/Program Files/pgbouncer-1.7.2-win32/etc/pgbouncer/userlist.txt 

    admin_users = postgres, lisam 

    stats_users = stats, root 

凡users.txt包含 「Postgres的」 「some_password」

在pgbouncer引導它說:

因爲PostgreSQL 9.0,文本文件不再使用。因此需要生成auth文件。有關示例腳本,請參閱./etc/mkauth.py以從pg_shadow表生成auth文件。 PostgreSQL的MD5隱藏的密碼格式: 「MD5」 + MD5(密碼+用戶名)

有誰知道如何手動生成的權威性文件?

任何幫助將不勝感激。

感謝,

麗莎

+0

你可以'選擇'md5'|| md5('password'||'username')'獲得md5值 –

回答

1

可以使用Postgres的MD5函數,例如:

postgres=# select usename,concat('md5',md5('postregs user password'||usename)) from pg_user where usename='postgres'; 
usename |    concat 
----------+------------------------------------- 
postgres | md584f1938f5f80a2f6ba95cea7875ad602 
(1 row) 

,這將意味着你768,16添加

"postgres" "md584f1938f5f80a2f6ba95cea7875ad602" 

C:/Program Files/pgbouncer-1.7.2-win32/etc/pgbouncer/userlist.txt

+0

感謝您的幫助! –