Hello, On 06/07/2011 14:48, Tatsuo Ishii wrote: > Hi Nicolas, > >> We are currently not able to specify the password of the health check >> user, which is needed at least for streaming replication lag. So I >> added the possibility to specify it in the configuration file, in the >> attached patch. > > Great idea. I will commit as soon as possible.
Sorry, I forgot to include the update of the English documentation in
the patch.
>> Also, I find the error message in check_replication_time_lag()
>> (pool_worker_child.c) not friendly :
>>
>> pool_error("check_replication_time_lag: DB node is valid but no
>> persistent connection");
>>
>> What about sending this error message to the debug level and adding a
>> second message on the error level? Fro example:
>>
>> pool_error("check_replication_time_lag: could not connect to DB node %d,
>> check health check configuration", i);
>
> Agreed.
Done inside the new version of the patch, attached.
> --
> Tatsuo Ishii
> SRA OSS, Inc. Japan
> English: http://www.sraoss.co.jp/index_en.php
> Japanese: http://www.sraoss.co.jp
--
Nicolas Thauvin
DBA
http://www.dalibo.com
Index: pool_config.h
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pool_config.h,v
retrieving revision 1.14
diff -u -p -r1.14 pool_config.h
--- pool_config.h 29 Jun 2011 02:44:12 -0000 1.14
+++ pool_config.h 6 Jul 2011 13:36:49 -0000
@@ -113,6 +113,7 @@ typedef struct {
int health_check_timeout; /* health check timeout */
int health_check_period; /* health check period */
char *health_check_user; /* PostgreSQL user name for health check */
+ char *health_check_password; /* password for health check username */
char *failover_command; /* execute command when failover happens */
char *follow_master_command; /* execute command when failover is ended */
char *failback_command; /* execute command when failback happens */
Index: pool_config.l
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pool_config.l,v
retrieving revision 1.57
diff -u -p -r1.57 pool_config.l
--- pool_config.l 29 Jun 2011 02:44:12 -0000 1.57
+++ pool_config.l 6 Jul 2011 13:36:49 -0000
@@ -178,6 +178,7 @@ int pool_init_config(void)
pool_config->health_check_timeout = 20;
pool_config->health_check_period = 0;
pool_config->health_check_user = "nobody";
+ pool_config->health_check_password = "";
pool_config->failover_command = "";
pool_config->follow_master_command = "";
pool_config->failback_command = "";
@@ -1065,6 +1066,26 @@ int pool_get_config(char *confpath, POOL
pool_config->health_check_user = str;
}
+ else if (!strcmp(key, "health_check_password") &&
+ CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
+ {
+ char *str;
+
+ if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY)
+ {
+ PARSE_ERROR();
+ fclose(fd);
+ return(-1);
+ }
+ str = extract_string(yytext, token);
+ if (str == NULL)
+ {
+ fclose(fd);
+ return(-1);
+ }
+ pool_config->health_check_password = str;
+ }
+
else if (!strcmp(key, "failover_command") &&
CHECK_CONTEXT(INIT_CONFIG|RELOAD_CONFIG, context))
{
Index: pool_worker_child.c
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pool_worker_child.c,v
retrieving revision 1.9
diff -u -p -r1.9 pool_worker_child.c
--- pool_worker_child.c 23 May 2011 19:44:00 -0000 1.9
+++ pool_worker_child.c 6 Jul 2011 13:36:49 -0000
@@ -156,7 +156,7 @@ static void establish_persistent_connect
bkinfo->backend_port,
"postgres",
pool_config->health_check_user,
- "");
+ pool_config->health_check_password);
if (s)
slots[i] = s;
else
@@ -223,7 +223,9 @@ static void check_replication_time_lag(v
if (!slots[i])
{
- pool_error("check_replication_time_lag: DB node is valid but no persistent connection");
+ pool_debug("check_replication_time_lag: DB node is valid but no persistent connection");
+ pool_error("check_replication_time_lag: could not connect to DB node %d, check health check configuration", i);
+
return;
}
Index: pgpool.conf.sample
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pgpool.conf.sample,v
retrieving revision 1.46
diff -u -p -r1.46 pgpool.conf.sample
--- pgpool.conf.sample 1 Jul 2011 10:47:14 -0000 1.46
+++ pgpool.conf.sample 6 Jul 2011 13:36:49 -0000
@@ -254,6 +254,7 @@ health_check_period = 0 # Hea
health_check_timeout = 20 # Health check timeout
# 0 means no timeout
health_check_user = 'nobody' # Health check user
+health_check_password = '' # Password for health check user
# - Special commands -
Index: pgpool.conf.sample-master-slave
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pgpool.conf.sample-master-slave,v
retrieving revision 1.20
diff -u -p -r1.20 pgpool.conf.sample-master-slave
--- pgpool.conf.sample-master-slave 1 Jul 2011 10:47:14 -0000 1.20
+++ pgpool.conf.sample-master-slave 6 Jul 2011 13:36:49 -0000
@@ -254,6 +254,7 @@ health_check_period = 0 # Hea
health_check_timeout = 20 # Health check timeout
# 0 means no timeout
health_check_user = 'nobody' # Health check user
+health_check_password = '' # Password for health check user
# - Special commands -
Index: pgpool.conf.sample-replication
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pgpool.conf.sample-replication,v
retrieving revision 1.18
diff -u -p -r1.18 pgpool.conf.sample-replication
--- pgpool.conf.sample-replication 1 Jul 2011 10:47:14 -0000 1.18
+++ pgpool.conf.sample-replication 6 Jul 2011 13:36:49 -0000
@@ -254,6 +254,7 @@ health_check_period = 0 # Hea
health_check_timeout = 20 # Health check timeout
# 0 means no timeout
health_check_user = 'nobody' # Health check user
+health_check_password = '' # Password for health check user
# - Special commands -
Index: pgpool.conf.sample-stream
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/pgpool.conf.sample-stream,v
retrieving revision 1.13
diff -u -p -r1.13 pgpool.conf.sample-stream
--- pgpool.conf.sample-stream 1 Jul 2011 10:47:14 -0000 1.13
+++ pgpool.conf.sample-stream 6 Jul 2011 13:36:49 -0000
@@ -255,6 +255,7 @@ health_check_period = 0 # Hea
health_check_timeout = 20 # Health check timeout
# 0 means no timeout
health_check_user = 'nobody' # Health check user
+health_check_password = '' # Password for health check user
# - Special commands -
Index: doc/pgpool-en.html
===================================================================
RCS file: /cvsroot/pgpool/pgpool-II/doc/pgpool-en.html,v
retrieving revision 1.95
diff -u -p -r1.95 pgpool-en.html
--- doc/pgpool-en.html 1 Jul 2011 10:47:14 -0000 1.95
+++ doc/pgpool-en.html 6 Jul 2011 13:36:50 -0000
@@ -641,6 +641,13 @@ max_pool*num_init_children*2 <= (max_con
</p>
</dd>
+ <dt><a name="HEALTH_CHECK_PASSWORD"></a>health_check_password</dt>
+ <dd>
+ <p>The password of the user to perform health check.
+ You need to reload pgpool.conf if you change health_check_password.
+ </p>
+ </dd>
+
<dt><a name="FAILOVER_COMMAND"></a>failover_command</dt>
<dd>
<p>
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Pgpool-hackers mailing list [email protected] http://pgfoundry.org/mailman/listinfo/pgpool-hackers
