CHECK_REQUEST;
- if (pool_config->health_check_period <= 0)
+ if (pool_config->health_check_params[*node_id].health_check_period <= 0)
{
sleep(30);
}
* If health checking is enabled and the node is not in down status,
* do health check.
*/
- else if (pool_config->health_check_period > 0)
+ else if (pool_config->health_check_params[*node_id].health_check_period > 0)
{
bool result;
/* Discard persistent connections */
discard_persistent_connection(*node_id);
- sleep(pool_config->health_check_period);
+ sleep(pool_config->health_check_params[*node_id].health_check_period);
}
}
exit(0);
/*
* If database is not specified, "postgres" database is assumed.
*/
- if (*pool_config->health_check_database == '\0')
- pool_config->health_check_database = "postgres";
+ if (*pool_config->health_check_params[node].health_check_database == '\0')
+ pool_config->health_check_params[node].health_check_database = "postgres";
/*
* Try to connect to the database.
*/
if (slot == NULL)
{
- retry_cnt = pool_config->health_check_max_retries;
+ retry_cnt = pool_config->health_check_params[node].health_check_max_retries;
do
{
* communication path failure much earlier before
* TCP/IP stack detects it.
*/
- if (pool_config->health_check_timeout > 0)
+ if (pool_config->health_check_params[node].health_check_timeout > 0)
{
CLEAR_ALARM;
pool_signal(SIGALRM, health_check_timer_handler);
- alarm(pool_config->health_check_timeout);
+ alarm(pool_config->health_check_params[node].health_check_timeout);
errno = 0;
health_check_timer_expired = 0;
}
slot = make_persistent_db_connection_noerror(node, bkinfo->backend_hostname,
bkinfo->backend_port,
- pool_config->health_check_database,
- pool_config->health_check_user,
- pool_config->health_check_password, false);
+ pool_config->health_check_params[node].health_check_database,
+ pool_config->health_check_params[node].health_check_user,
+ pool_config->health_check_params[node].health_check_password, false);
- if (pool_config->health_check_timeout > 0)
+ if (pool_config->health_check_params[node].health_check_timeout > 0)
{
/* cancel health check timer */
pool_signal(SIGALRM, SIG_IGN);
if (slot)
{
- if (retry_cnt != pool_config->health_check_max_retries)
+ if (retry_cnt != pool_config->health_check_params[node].health_check_max_retries)
{
ereport(LOG,
(errmsg("health check retrying on DB node: %d succeeded",
ereport(LOG,
(errmsg("health check retrying on DB node: %d (round:%d)",
node,
- pool_config->health_check_max_retries - retry_cnt)));
+ pool_config->health_check_params[node].health_check_max_retries - retry_cnt)));
- sleep(pool_config->health_check_retry_delay);
+ sleep(pool_config->health_check_params[node].health_check_retry_delay);
}
} while (retry_cnt >= 0);
}
echo "recovery_2nd_stage_command = 'pgpool_recovery_pitr'" >> $CONF
fi
- echo "health_check_period = 10" >> $CONF
- echo "health_check_user = '$WHOAMI'" >> $CONF
+ n=0
+ while [ $n -lt $NUMCLUSTERS ]
+ do
+ echo "health_check_period$n = 10" >> $CONF
+ echo "health_check_user$n = '$WHOAMI'" >> $CONF
+ echo "health_check_password$n = ''" >> $CONF
+ echo "health_check_database$n = 'postgres'" >> $CONF
+ echo "health_check_max_retries$n = '3'" >> $CONF
+ echo "health_check_retry_delay$n = '1'" >> $CONF
+ echo "connect_timeout$n = '1000'" >> $CONF
+ n=`expr $n + 1`
+ done
OIDDIR=$BASEDIR/log/pgpool/oiddir
mkdir -p $OIDDIR
echo "memqcache_oiddir = '$OIDDIR'" >> $CONF