public inbox for [email protected]
help / color / mirror / Atom feedEnhance watchdog_setup
2+ messages / 1 participants
[nested] [flat]
* Enhance watchdog_setup
@ 2025-08-20 06:16 Tatsuo Ishii <[email protected]>
2025-08-21 23:26 ` Re: Enhance watchdog_setup Tatsuo Ishii <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Tatsuo Ishii @ 2025-08-20 06:16 UTC (permalink / raw)
To: [email protected]
A tool called "watchdog_setup" has been used to create a simple test
cluster environment on localost for developing and testing
Pgpool-II. It allows to create 3 watchdog node and 3 PostgreSQL server
configuration by single command for example:
$ watchdog_set -wn 3 -n 3
The command is also used in our regression test.
One of the things that watchdog_setup does not support is, assigning
VIP. This is a limitation by deign as it runs on a single
host. However, I would like to test whether watchdog properly executes
if_up_cmd or if_down_cmd, which could increase the test coverage. In
the attached patch, a new option "-vip [ip]" is added to
watchdog_setup. If ip is omitted, '127.0.0.1' is assumed.
The parameters added by this option are followings:
delegate_ip = '127.0.0.1'
if_up_cmd = '/usr/bin/echo "if_up_cmd executed"'
if_down_cmd = 'usr/bin/echo "if_down_cmd executed"'
arping_cmd = '/usr/bin/true'
Comments and suggestions are welcome.
Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
Attachments:
[application/octet-stream] v1-0001-Feature-allow-to-specify-VIP-in-watchdog_setup.patch (7.3K, 2-v1-0001-Feature-allow-to-specify-VIP-in-watchdog_setup.patch)
download | inline diff:
From 9f54b8f12818b0753dd7c35ad9b5540b135dcbf8 Mon Sep 17 00:00:00 2001
From: Tatsuo Ishii <[email protected]>
Date: Wed, 20 Aug 2025 15:08:50 +0900
Subject: [PATCH v1] Feature: allow to specify VIP in watchdog_setup.
This commit allows to specify VIP parameter (delegate_ip) in
watchdog_setup using new option "-vip [ip]". If ip is omitted,
'127.0.0.1' is assumed. Even if vip option is specified, pgpool will
not actually set the VIP to the system: if_up_cmd, if_down_cmd are
just set to echo command and do nothing except emit a log. This option
is intended to trace the action of Pgpool-II regarding VIP handling.
---
doc.ja/src/sgml/ref/watchdog_setup.sgml | 18 +++++++++++++
doc/src/sgml/ref/watchdog_setup.sgml | 23 +++++++++++++++-
src/test/watchdog_setup.in | 35 +++++++++++++++++++++----
3 files changed, 70 insertions(+), 6 deletions(-)
diff --git a/doc.ja/src/sgml/ref/watchdog_setup.sgml b/doc.ja/src/sgml/ref/watchdog_setup.sgml
index 0a51eda28..9bf5d785e 100644
--- a/doc.ja/src/sgml/ref/watchdog_setup.sgml
+++ b/doc.ja/src/sgml/ref/watchdog_setup.sgml
@@ -160,6 +160,24 @@ Pgpool-II documentation
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>-vip [<replaceable class="parameter">ip</replaceable>]</option></term>
+ <listitem>
+ <para>
+ 仮想IPを指定します。
+ ipを省略した場合は、'127.0.0.1'を指定したものと見なされます。
+ ここで指定した仮想IPは、<xref linkend="guc-delegate-ip">パラメータに設定されます。
+ 仮想IPを指定しても、実際に仮想IPがシステムに設定されるわけではなく、単に<xref linkend="PCP-WATCHDOG-INFO">や、ログファイルで仮想IPを設定する動作が確認できるだけですが、<productname>Pgpool-II</productname>の仮想IPに関する挙動をテストするのに役立ちます。
+ また、以下のパラメータも設定されます。
+ <programlisting>
+ if_up_cmd = '/usr/bin/echo "if_up_cmd executed"'
+ if_down_cmd = 'usr/bin/echo "if_down_cmd executed"'
+ arping_cmd = '/usr/bin/true'
+ </programlisting>
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><option>--no-stop</option></term>
<listitem>
diff --git a/doc/src/sgml/ref/watchdog_setup.sgml b/doc/src/sgml/ref/watchdog_setup.sgml
index 18f27958b..76d7f2f03 100644
--- a/doc/src/sgml/ref/watchdog_setup.sgml
+++ b/doc/src/sgml/ref/watchdog_setup.sgml
@@ -42,7 +42,6 @@ Pgpool-II documentation
<para>
<application>watchdog_setup</application> is for testing purpose
only and should not be used to create production installations.
- Also please note that heartbeat is not used.
</para>
<para>
@@ -112,6 +111,28 @@ Pgpool-II documentation
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>-vip [<replaceable class="parameter">ip</replaceable>]</option></term>
+ <listitem>
+ <para>
+ Specify the virtual IP. If ip is omitted, it is assumed that
+ '127.0.0.1' is specified. The specified virtual IP is set
+ to <xref linkend="guc-delegate-ip"> parameter. Even if virtual
+ IP is specified, it will not be set to the system: just you
+ could confirm the action trying to set the virtual IP
+ in <xref linkend="PCP-WATCHDOG-INFO">, or the log file, yet
+ this is useful how <productname>Pgpool-II</productname> reacts
+ trying to set the virtual IP. In additioin to delegate_ip,
+ following parameters will be set too.
+ <programlisting>
+ if_up_cmd = '/usr/bin/echo "if_up_cmd executed"'
+ if_down_cmd = 'usr/bin/echo "if_down_cmd executed"'
+ arping_cmd = '/usr/bin/true'
+ </programlisting>
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><option>--no-stop</option></term>
<listitem>
diff --git a/src/test/watchdog_setup.in b/src/test/watchdog_setup.in
index d84a5b619..dfa362471 100644
--- a/src/test/watchdog_setup.in
+++ b/src/test/watchdog_setup.in
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
-# Copyright (c) 2013-2021 PgPool Global Development Group
+# Copyright (c) 2013-2025 PgPool Global Development Group
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby
@@ -18,10 +18,11 @@
# this tool for production environment!
# Note that this script uses pgpool_setup as a work horse.
#
-# usage: watchdog_setup [-wn num_pgpool][-wp watchdog_base_port][-m r|s|n|i][-n num_clusters][-p base_port][--no-stop][-d]
+# usage: watchdog_setup [-wn num_pgpool][-wp watchdog_base_port][-m r|s|n|i][-n num_clusters][-p base_port][--no-stop][-vip [ip]][-d]
# -wn num_pgpool: create num_pgpool pgpool nodes. The default is 3. Must be greater than 1.
# -wp watchdog_base_port: starting port number. The default is
# 50000.
+# -vip [ip]: allow to assign "ip" being set to delegate_ip. If "ip" is omitted, "127.0.0.1" is assumed.
#-------------------------------------------
# Configuration section
#-------------------------------------------
@@ -40,6 +41,9 @@ export PGBASEPORT=`expr $W_BASE_PORT + 1000`
# number of ports used in a single pgpool-II installation.
# (port, pcp_port, wd_port, wd_heartbeat_port)
num_ports_per_node=4
+
+# default vip
+DEFAULT_VIP="127.0.0.1"
#-------------------------------------------
# End of configuration section
#-------------------------------------------
@@ -195,6 +199,12 @@ EOF
echo "wd_port$n = $wd_port" >> $conf
echo "heartbeat_hostname$n = 'localhost'" >> $conf
echo "heartbeat_port$n = $wd_heartbeat_port" >> $conf
+ if [ $VIP != "" ];then
+ echo "delegate_ip = '$VIP'" >> $conf
+ echo "if_up_cmd = '/usr/bin/echo \"if_up_cmd executed\"'" >> $conf
+ echo "if_down_cmd = 'usr/bin/echo \"if_down_cmd executed\"'" >> $conf
+ echo "arping_cmd = '/usr/bin/true'" >> $conf
+ fi
n=`expr $n + 1`
done
@@ -208,17 +218,18 @@ EOF
################################################################################
function usage()
{
- echo "usage: $0 [-wn num_pgpool][-wp watchdog_base_port][-m r|s|n|i] [-n num_clusters] [-p base_port] [-pg pg_base_port][--no-stop] [-d]";exit 1
+ echo "usage: $0 [-wn num_pgpool][-wp watchdog_base_port][-m r|s|n|i] [-n num_clusters] [-p base_port] [-pg pg_base_port][--no-stop] -vip [ip]] [-d]";exit 1
}
#-------------------------------------------
# Argument check
-# usage: $0 [-wn num_pgpool][-wp watchdog_base_port][-m r|s|n][-n num_clusters][-p base_port][-pg pg_base_port][--no-stop][-d]
+# usage: $0 [-wn num_pgpool][-wp watchdog_base_port][-m r|s|n][-n num_clusters][-p base_port][-pg pg_base_port][--no-stop][-vip [ip]][-d]
#-------------------------------------------
#
# default mode is streaming replication mode
MODE="s"
NO_STOP="false"
+VIP=""
while [ $# -gt 0 ]
do
@@ -257,9 +268,23 @@ do
elif [ $1 = "--no-stop" ];then
shift
NO_STOP="true"
+
+ elif [ $1 = "-vip" ];then
+ if [ $# = 1 ];then
+ # there's no more argument. set the default vip
+ VIP=$DEFAULT_VIP
+ else
+ if [[ $2 =~ -.* ]];then
+ # next argument given. set the default vip
+ VIP=$DEFAULT_VIP
+ else
+ # VIP is specified
+ shift
+ VIP=$1
+ fi
+ fi
elif [ $1 = "-d" ];then
export PGPOOLDEBUG="true"
- shift;
elif [ $1 = "--help" -o $1 = "-o" ];then
usage
exit
--
2.25.1
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Enhance watchdog_setup
2025-08-20 06:16 Enhance watchdog_setup Tatsuo Ishii <[email protected]>
@ 2025-08-21 23:26 ` Tatsuo Ishii <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Tatsuo Ishii @ 2025-08-21 23:26 UTC (permalink / raw)
To: [email protected]
> A tool called "watchdog_setup" has been used to create a simple test
> cluster environment on localost for developing and testing
> Pgpool-II. It allows to create 3 watchdog node and 3 PostgreSQL server
> configuration by single command for example:
>
> $ watchdog_set -wn 3 -n 3
>
> The command is also used in our regression test.
>
> One of the things that watchdog_setup does not support is, assigning
> VIP. This is a limitation by deign as it runs on a single
> host. However, I would like to test whether watchdog properly executes
> if_up_cmd or if_down_cmd, which could increase the test coverage. In
> the attached patch, a new option "-vip [ip]" is added to
> watchdog_setup. If ip is omitted, '127.0.0.1' is assumed.
> The parameters added by this option are followings:
>
> delegate_ip = '127.0.0.1'
> if_up_cmd = '/usr/bin/echo "if_up_cmd executed"'
> if_down_cmd = 'usr/bin/echo "if_down_cmd executed"'
> arping_cmd = '/usr/bin/true'
>
> Comments and suggestions are welcome.
Patch pushed to master branch.
Thanks.
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2025-08-21 23:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-08-20 06:16 Enhance watchdog_setup Tatsuo Ishii <[email protected]>
2025-08-21 23:26 ` Tatsuo Ishii <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox