Configure pgpool in master_slave mode fails to auth against backend
I am trying to run pgpool on 2+ web servers which also have a rails app, etc. The idea is to have replication via slon开发者_Go百科y 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
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.
精彩评论