[Pgpool-general] Problems getting master_slave_mode to work

Kevin MacClay kmmacclay at yahoo.com
Wed Apr 13 18:30:58 GMT 2005


Hello,
 
I'm having trouble getting pgpool to work in master/slave mode.  I'm planning on using something like Slony-I for replication, and use pgpool only to load balance the queries across the master and slave, as well as provide failover if the master goes down.
 
I configured the settings so replication_mode = false, load_balance_mode = true, and master_slave_mode = true.  I also set secondary_backend_host_name and secondary_backend_port to refer to the slave.  Here's what happens when I try to connect to the database to show the status:
 
-bash-2.05b$ psql -p 9999 -c 'show pool_status' template1
psql: server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request. 
The strange thing is that if I change the configuration so master_slave_mode = false, it seems that the failover works but load balancing does not.  When master/slave is disabled, I'm able to show the status and run queries against the master.  If I use "pgpool -s s switch" to perform a manual switchover, I am then able to run queries against the slave.  But as soon as I try running pgpool with master_slave_mode = true, it stops working and when I try to connect I get the error above ("server closed the connection unexpectedly").
 
Am I doing something wrong?  Below are my configuration settings when I receive the error.  I'm using the latest stable build (2.5.1).
 
[root at vl-pe6650-004 etc]# more pgpool.conf
#
# pgpool configuration file sample
# $Header: /cvsroot/pgpool/pgpool/pgpool.conf.sample,v 1.1.1.1 2005/02/14 14:52:21 t-ishii Exp $
# host name or IP address to listen on: '*' for all, '' for no TCP/IP connections
listen_addresses = '*'
# port number for pgpool
port = 9999
# Unix domain socket path. Debian package default to /var/run/postgresql!
socket_dir = '/tmp'
# host name where PostgreSQL server is running on. '' means localhost using UNIX
# domain socket
backend_host_name = ''
# port number PostgreSQL server is running on.
backend_port = 5432
# Unix domain socket path for the backend. Debian package default to /var/run/postgresql!
backend_socket_dir = '/tmp'
# host name where secondary PostgreSQL server is running on. '' means localhost using UNIX
# domain socket
secondary_backend_host_name = '192.168.0.153'
# port number secondary PostgreSQL server is running on.
# 0 means no secondrary PostgreSQL
secondary_backend_port = 5432
# number of pre-forked child process
num_init_children = 32
# numer of connection pool allowed for a child process.
max_pool = 4
# if idle for this seconds, child exits. 0 means no timeout.
child_life_time = 300
# if idle for this seconds, connection to PostgreSQL closes. 0 means
# no timeout
connection_life_time = 0
# logging directory
logdir = '/tmp'
# replication mode
replication_mode = false
# set this to true if you want to avoid deadlock situation when
# replication enabled.
# there will be noticable performance degration, however.
# a work around is set this to false and insert /*STRICT*/ comment
# at the beginning of the SQL command.
replication_strict = true
# when replication_strict is set to false, there will be a chance for
# deadlocks. set this to non 0 (in milli seconds) to detect this
# situation and resolve the deadlock aborting current session.
replication_timeout = 5000
# load balancing mode. i.e. all SELECT except in a transaction block
# are load balanced. This is ignored if replication_mode is false.
load_balance_mode = true
# load balance weight for master and secondary. actual weight is
# calculated by weight_master:weight_secondary. For example both
#
# weight_master = 10 and weight_secondary = 5
# weight_master = 4 and weight_secondary = 2
#
# are regarded as master has double the weight comparing with secondary.
# master and secondary have same weight in the default.
weight_master = 0.5
weight_secondary = 0.5
# if there's a data mismatch between master and secondary
# start degenration to stop replication mode
replication_stop_on_mismatch = false
# semicolon separated list of quries to be issued at the end of session
reset_query_list = 'ABORT; RESET ALL; SET SESSION AUTHORIZATION DEFAULT'
# if true print time stamp to each log line
print_timestamp = true
# if true, operate in master/slave mode
master_slave_mode = true
# if true, cache connection pool
connection_cache = true
# health check timeout. 0 means no timeout;
health_check_timeout = 20
# health check period. 0 means no health check
health_check_period = 0
# health check user
health_check_user = 'nobody'
 
Thanks for your help,
Kevin


		
---------------------------------
Do you Yahoo!?
 Yahoo! Small Business - Try our new resources site! 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://pgfoundry.org/pipermail/pgpool-general/attachments/20050413/7ec22368/attachment.html


More information about the Pgpool-general mailing list