在 master_slave 模式下配置 pgpool 无法针对后端进行身份验证
我正在尝试在 2 个以上的 Web 服务器上运行 pgpool,这些服务器也有一个 Rails 应用程序等。这个想法是通过 slony 或流式传输进行复制,并通过 pgpool 进行故障转移。将查询平衡到 replca 和 Web 服务器连接池也很好,但重要的是让 master_slave 和故障转移正常工作。
我从 Ubuntu 10.04 LTS 上的 apt 软件包安装了 pgpool 版本 3.4.1(lainihi)。 db01 是主服务器,通过 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 的帮助将不胜感激。这看起来是一个很好的解决方案,但设置它比预期的要困难。
蒂亚,
丹尼斯
I am trying to run pgpool on 2+ web servers which also have a rails app, etc. The idea is to have replication via slony or streaming and failover via pgpool. It would also be nice to have queries balanced to the replca, and web server connections pooled but the important thing is to get master_slave and failover working.
I installed pgpool version 3.4.1(lainihi), from apt packages on Ubuntu 10.04 LTS. db01 is the master and gets replicated to db02 via slony. My pgpool.conf looks like this:
# 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'
It works right now in "raw mode" and I wonder if I will gain much with master_slave? Anyway if I uncomment the master_slave=true I get the folling when I connect:
# 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.
in the pgpool log I see the following
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
It seems like pgpool cannot authenticate with the backend, but I can connect to each backend server from each client with psql just fine, and as I said pgpool works in "raw mode".
Any help getting pgpool configured would be greatly appreciated. It looks like a great solution, but getting it set up has been more difficult than expected.
TIA,
Dennis
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最后自己解决了这个问题。事实证明,这个问题源于 pgpools 奇怪的版本控制和从 apt 安装。
问题的第一部分是 pgpool 从 pgpool 到 pgpool-II 进行了主要版本切换。 pgpool-II 不是一个分支或不兼容的兄弟,而是一个具有更多功能的后来的“point oh”修订版。 pgpool的最新版本是3.4.1,pgpool-II的最新版本是3.0.1。如果你看的不够仔细,你可能会认为 pgpool 3.4.1 > pgool-II 3.0.1 但事实并非如此。
问题的第二部分是 ubuntu(可能还有 debian)有两个适用于上述 pgpool 和 pgpool2 的 apt 软件包。当然 pgpool2 是 pgpool-II。如果有一种方法可以在包中说“另请参阅”,这样安装 pgpool 的人就知道 pgpool2 包的存在,那就太好了。
一旦我获得了 pgpool-II 的源代码并自己编译了它(启用了 apt 软件包中未启用的 SSL),主从开关就按照广告中的那样工作了。
Finally solved this myself. Turns out the issue stems from pgpools strange versioning and installing from apt.
First part of the problem was that pgpool made a major version switch from pgpool to pgpool-II. pgpool-II is not a fork or an incompatible sibling, but a later "point oh" revision with more capabilities. The latest version of pgpool is 3.4.1 and the latest version of pgpool-II is 3.0.1. If you are not looking carefully enough you might think that pgpool 3.4.1 > pgool-II 3.0.1 but this is not the case.
Second part of the problem was that ubuntu (probably debian as well) has two apt packages for the above pgpool and pgpool2. Of course pgpool2 is pgpool-II. It would be nice if there was a way to say "see also" in packages so people who install pgpool knew that pgpool2 package existed.
Once I got the source for the pgpool-II and compiled it myself (enabling SSL which was not enabled in the apt package) the master-slave switch works as advertised.