我正在尝试在 2 个以上的 Web 服务器上运行 pgpool,这些服务器也有一个 rails 应用程序等。这个想法是通过 slony 或流进行复制,并通过 pgpool 进行故障转移。将查询平衡到 replca 和 Web 服务器连接池也很好,但重要的是让 master_slave 和故障转移正常工作。
我从 Ubuntu 10.04 LTS 上的 apt 包安装了 pgpool 版本 3.4.1(lainihi)。db01 是 master 并通过 slony 复制到 db02。我的 pgpool.conf 看起来像这样:
# configure frontend
listen_addresses = 'localhost'
port = 5432
# configure the backends
backend_host_name = 'db01'
backend_port = 5432
secondary_backend_host_name = 'db02'
secondary_backend_port = 5432
# uncomment this and pgpool fails to connect
#master_slave_mode = true
#master_slave_sub_mode = 'slony'
它现在在“原始模式”下工作,我想知道我是否会从 master_slave 获得很多?无论如何,如果我取消注释 master_slave=true 我在连接时会得到以下信息:
# psql -h localhost -U XXX -W
Password for user XXX:
psql: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
在 pgpool 日志中,我看到以下内容
2011-01-13 02:03:17 DEBUG: pid 24144: I am 24144 accept fd 6
2011-01-13 02:03:17 DEBUG: pid 24144: Protocol Major: 1234 Minor: 5679 database: user:
2011-01-13 02:03:17 DEBUG: pid 24144: SSLRequest: sent N; retry startup
2011-01-13 02:03:17 DEBUG: pid 24144: Protocol Major: 3 Minor: 0 database: XXX user: XXX
2011-01-13 02:03:17 DEBUG: pid 24147: I am 24147 accept fd 6
2011-01-13 02:03:17 DEBUG: pid 24147: Protocol Major: 3 Minor: 0 database: XXX user: XXX
2011-01-13 02:03:17 DEBUG: pid 24144: pool_read_message_length: lenghth: 12
2011-01-13 02:03:17 DEBUG: pid 24144: trying md5 authentication
2011-01-13 02:03:17 DEBUG: pid 24144: master: 1 salt: 8bcce867
2011-01-13 02:03:17 DEBUG: pid 24147: pool_read_message_length: lenghth: 12
2011-01-13 02:03:17 DEBUG: pid 24147: trying md5 authentication
2011-01-13 02:03:17 DEBUG: pid 24147: master: 1 salt: bb5f7a63
2011-01-13 02:03:17 DEBUG: pid 24144: master: 0 salt: 5abb8e55
2011-01-13 02:03:17 DEBUG: pid 24144: do_md5: backend does not return R while processing MD5 authentication E
2011-01-13 02:03:17 ERROR: pid 24144: pool_do_auth: backend does not return authenticaton ok
2011-01-13 02:03:17 DEBUG: pid 24147: master: 0 salt: 4c1e5953
2011-01-13 02:03:17 DEBUG: pid 24147: do_md5: backend does not return R while processing MD5 authentication E
2011-01-13 02:03:17 ERROR: pid 24147: pool_do_auth: backend does not return authenticaton ok
似乎 pgpool 无法通过后端进行身份验证,但我可以使用 psql 从每个客户端连接到每个后端服务器就好了,正如我所说 pgpool 在“原始模式”下工作。
任何帮助配置 pgpool 将不胜感激。它看起来是一个很好的解决方案,但设置它比预期的要困难。
TIA,
丹尼斯