I have this configuration with pgpool: "Host-1" master and "Host-2" slave, if "Host-1" go down, pgpool correctly promotes "Host-2" to be the master; but then if "Host-1" return up, pgpool is not aware of this and, if "Host-2" go down, pgpool doesn't promote "Host-1" to be the master even if "Host-1" is online.
I enabled health_check but it seems completely useless, because the state of "Host-1" (after it becomes up) is always 3="Node is down".
This is the output of the command "show pool_nodes" during the events:
-> Initially situation: "Host-1" UP (master), "Host-2" UP (slave)
node_id | hostname | port | status | lb_weight | role
---------+----------+------+--------+-----------+--------
0 | Host-1 | 5432 | 2 | nan | master
1 | Host-2 | 5432 | 1 | nan | slave
-> node 0 goes down: "Host-1" DOWN, "Host-2" UP
node_id | hostname | port | status | lb_weight | role
---------+----------+------+--------+-----------+--------
0 | Host-1 | 5432 | 3 | nan | slave
1 | Host-2 | 5432 | 2 | nan | master
-> node 0 returns up: "Host-1" UP, "Host-2" UP
node_id | hostname | port | status | lb_weight | role
---------+----------+------+--------+-----------+--------
0 | Host-1 | 5432 | 3 | nan | slave
1 | Host-2 | 5432 | 2 | nan | master
note that the status of "Host-1" is however 3 that means "Node is down"
-> node 1 goes down: "Host-1" UP, "Host-2" DOWN: at this point i'm not able to connect to db, even if node 0 is up and running!
What I have to do to permit to pgpool to promote master the node 0 another time?
If can be useful, these are sections "Backend Connection Settings" and "HEALTH CHECK" of my pgpool.conf:
# - Backend Connection Settings -
backend_hostname0 = 'Host-1'
# Host name or IP address to connect to for backend 0
backend_port0 = 5432
# Port number for backend 0
#backend_weight0 = 1
# Weight for backend 0 (only in load balancing mode)
#backend_data_directory0 = '/data'
# Data directory for backend 0
backend_flag0 = 'ALLOW_TO_FAILOVER'
# Controls various backend behavior
# ALLOW_TO_FAILOVER or DISALLOW_TO_FAILOVER
backend_hostname1 = 'Host-2'
# Host name or IP address to connect to for backend 0
backend_port1 = 5432
# Port number for backend 0
#backend_weight1 = 1
# Weight for backend 0 (only in load balancing mode)
#backend_data_directory1 = '/data'
# Data directory for backend 0
backend_flag1 = 'ALLOW_TO_FAILOVER'
# Controls various backend behavior
# ALLOW_TO_FAILOVER or DISALLOW_TO_FAILOVER
#------------------------------------------------------------------------------
# HEALTH CHECK
#------------------------------------------------------------------------------
health_check_period = 10
# Health check period
# Disabled (0) by default
health_check_timeout = 20
# Health check timeout
# 0 means no timeout
health_check_user = 'admin'
# Health check user
health_check_password = '12345'
# Password for health check user
health_check_max_retries = 10
# Maximum number of times to retry a failed health check before giving up.
health_check_retry_delay = 1
# Amount of time to wait (in seconds) between retries.