For compatibility with the old versions, the old paramter delegate_IP can still work.
If the old paramter delegate_IP is used, Pgpool-II will set the value to
delegate_ip and throw a warning message.
This commit also fixes segfault of fail_over_on_backend_error
and changes the behavior to set the value to failover_on_backend_error
if fail_over_on_backend_error is used.
<programlisting>
use_watchdog = on
-delegate_IP = ''
+delegate_ip = ''
...
wd_escalation_command = '$path_to_script/aws-escalation.sh'
wd_de_escalation_command = '$path_to_script/aws-de-escalation.sh'
use_watchdog = on
</programlisting>
<para>
- アクティブ機が立ち上げる仮想IPを<varname>delegate_IP</varname>に指定します。
+ アクティブ機が立ち上げる仮想IPを<varname>delegate_ip</varname>に指定します。
仮想IPはまだ使われていないIPアドレスを指定してください。
</para>
<programlisting>
-delegate_IP = '192.168.137.150'
+delegate_ip = '192.168.137.150'
</programlisting>
<para>
<variablelist>
- <varlistentry id="guc-delegate-IP" xreflabel="delegate_IP">
- <term><varname>delegate_IP</varname> (<type>string</type>)
+ <varlistentry id="guc-delegate-ip" xreflabel="delegate_ip">
+ <term><varname>delegate_ip</varname> (<type>string</type>)
<indexterm>
<!--
- <primary><varname>delegate_IP</varname> configuration parameter</primary>
+ <primary><varname>delegate_ip</varname> configuration parameter</primary>
-->
- <primary><varname>delegate_IP</varname>設定パラメータ</primary>
+ <primary><varname>delegate_ip</varname>設定パラメータ</primary>
</indexterm>
</term>
<listitem>
to run <command>sudo</command> command without a password, and specify it such as
<literal>"/usr/bin/sudo /sbin/ip addr add $_IP_$/24 dev eth0 label eth0:0"</literal>.
<literal>$_IP_$</literal> will get replaced by the IP address
- specified in the <xref linkend="guc-delegate-IP">.
+ specified in the <xref linkend="guc-delegate-ip">.
-->
仮想IPを起動するために実行するコマンドを指定します。
<command>"ip addr add $_IP_$/24 dev eth0 label eth0:0"</command>のようにコマンドとパラメータを指定します。
<command>ip</command>コマンドに<command>setuid</command>を設定するか、
<productname>Pgpool-II</productname>起動ユーザ(デフォルトでは<literal>postgres</literal>)がパスワードなしに<command>sudo</command>を実行できるように設定し、
<command>sudo</command>を介したコマンドを<literal>"/usr/bin/sudo /sbin/ip addr add $_IP_$/24 dev eth0 label eth0:0"</literal>のように指定します。
- <literal>$_IP_$</literal>は<xref linkend="guc-delegate-IP">で指定されたIPアドレスに置換されます。
+ <literal>$_IP_$</literal>は<xref linkend="guc-delegate-ip">で指定されたIPアドレスに置換されます。
</para>
<para>
このパラメータは、サーバ起動時にのみ設定できます。
to run <command>sudo</command> command without a password, and specify it such as
<literal>"/usr/bin/sudo /sbin/ip addr del $_IP_$/24 dev eth0"</literal>.
<literal>$_IP_$</literal> will get replaced by the IP address
- specified in the <xref linkend="guc-delegate-IP">.
+ specified in the <xref linkend="guc-delegate-ip">.
-->
仮想IPを停止するために実行するコマンドを指定します。
<literal>"ip addr del $_IP_$/24 dev eth0"</literal>のようにコマンドとパラメータを指定します。
<command>ip</command>コマンドに<command>setuid</command>を設定するか、
<productname>Pgpool-II</productname>起動ユーザ(デフォルトでは<literal>postgres</literal>)がパスワードなしに<command>sudo</command>を実行できるように設定し、
<command>sudo</command>を介したコマンドを<literal>"/usr/bin/sudo /sbin/ip addr del $_IP_$/24 dev eth0"</literal>のように指定します。
- <literal>$_IP_$</literal>は<xref linkend="guc-delegate-IP">で指定されたIPアドレスに置換されます。
+ <literal>$_IP_$</literal>は<xref linkend="guc-delegate-ip">で指定されたIPアドレスに置換されます。
</para>
<para>
<!--
to run <command>sudo</command> command without a password, and specify it such as
<literal>"/usr/bin/sudo /usr/sbin/arping -U $_IP_$ -w 1 -I eth0"</literal>.
<literal>$_IP_$</literal> will get replaced by
- the IP address specified in the <varname>delegate_IP</varname>.
+ the IP address specified in the <varname>delegate_ip</varname>.
-->
IPアドレス切り替え後にARPリクエストを送信するコマンドです。
<literal>"arping -U $_IP_$ -w 1 -I eth0"</literal>のようにコマンドとパラメータを指定します。
<command>arping</command>コマンドに<literal>setuid</literal>を設定するか、
<productname>Pgpool-II</productname>起動ユーザ(デフォルトでは<literal>postgres</literal>ユーザ)がパスワードなしに<command>sudo</command>を実行できるように設定し、
<command>sudo</command>を介したコマンドを<literal>"/usr/bin/sudo /usr/sbin/arping -U $_IP_$ -w 1 -I eth0"</literal>のように設定します。
- <literal>$_IP_$</literal>は<xref linkend="guc-delegate-IP">で指定されたIPアドレスに置換されます。
+ <literal>$_IP_$</literal>は<xref linkend="guc-delegate-ip">で指定されたIPアドレスに置換されます。
</para>
<para>
<!--
</para>
<programlisting>
use_watchdog = on
-delegate_IP = ''
+delegate_ip = ''
...
wd_escalation_command = '$path_to_script/aws-escalation.sh'
wd_de_escalation_command = '$path_to_script/aws-de-escalation.sh'
Ensure that the IP address set to virtual IP isn't used yet.
</para>
<programlisting>
-delegate_IP = '192.168.137.150'
+delegate_ip = '192.168.137.150'
</programlisting>
<para>
<para>
Basically, it should work if you change the following variables according to your environment.
PGPOOL is tha array of the hostname that running Pgpool-II.
- VIP is the virtual IP address that you set as delegate_IP.
+ VIP is the virtual IP address that you set as delegate_ip.
DEVICE is the network interface for the virtual IP.
</para>
<programlisting>
<variablelist>
- <varlistentry id="guc-delegate-IP" xreflabel="delegate_IP">
- <term><varname>delegate_IP</varname> (<type>string</type>)
+ <varlistentry id="guc-delegate-ip" xreflabel="delegate_ip">
+ <term><varname>delegate_ip</varname> (<type>string</type>)
<indexterm>
- <primary><varname>delegate_IP</varname> configuration parameter</primary>
+ <primary><varname>delegate_ip</varname> configuration parameter</primary>
</indexterm>
</term>
<listitem>
to run <command>sudo</command> command without a password, and specify it such as
<literal>"/usr/bin/sudo /sbin/ip addr add $_IP_$/24 dev eth0 label eth0:0"</literal>.
<literal>$_IP_$</literal> will get replaced by the IP address
- specified in the <xref linkend="guc-delegate-IP">.
+ specified in the <xref linkend="guc-delegate-ip">.
</para>
<para>
This parameter can only be set at server start.
to run <command>sudo</command> command without a password, and specify it such as
<literal>"/usr/bin/sudo /sbin/ip addr del $_IP_$/24 dev eth0"</literal>.
<literal>$_IP_$</literal> will get replaced by the IP address
- specified in the <xref linkend="guc-delegate-IP">.
+ specified in the <xref linkend="guc-delegate-ip">.
</para>
<para>
This parameter can only be set at server start.
to run <command>sudo</command> command without a password, and specify it such as
<literal>"/usr/bin/sudo /usr/sbin/arping -U $_IP_$ -w 1 -I eth0"</literal>.
<literal>$_IP_$</literal> will get replaced by
- the IP address specified in the <varname>delegate_IP</varname>.
+ the IP address specified in the <varname>delegate_ip</varname>.
</para>
<para>
This parameter can only be set at server start.
/*variable custom assign functions */
static bool FailOverOnBackendErrorAssignMessage(ConfigContext scontext, bool newval, int elevel);
+static bool DelegateIPAssignMessage(ConfigContext scontext, char *newval, int elevel);
static bool BackendPortAssignFunc(ConfigContext context, int newval, int index, int elevel);
static bool BackendHostAssignFunc(ConfigContext context, char *newval, int index, int elevel);
static bool BackendDataDirAssignFunc(ConfigContext context, char *newval, int index, int elevel);
{
{"delegate_IP", CFGCXT_INIT, WATCHDOG_CONFIG,
+ "Old config parameter for delegate_ip.",
+ CONFIG_VAR_TYPE_STRING, false, VAR_HIDDEN_IN_SHOW_ALL
+ },
+ NULL,
+ "",
+ DelegateIPAssignMessage, NULL, NULL, NULL
+ },
+
+ {
+ {"delegate_ip", CFGCXT_INIT, WATCHDOG_CONFIG,
"Delegate IP address to be used when pgpool node become a watchdog cluster leader.",
CONFIG_VAR_TYPE_STRING, false, 0
},
- &g_pool_config.delegate_IP,
+ &g_pool_config.delegate_ip,
"",
NULL, NULL, NULL, NULL
},
if (scontext != CFGCXT_BOOT)
ereport(WARNING,
(errmsg("fail_over_on_backend_error is changed to failover_on_backend_error"),
- errdetail("setting failover_on_backend_error has no effect"),
- errhint("use failover_on_backend_error instead")));
+ errdetail("if fail_over_on_backend_error is specified, the value will be set to failover_on_backend_error")));
+ g_pool_config.failover_on_backend_error = newval;
+ return true;
+}
+/*
+ * Throws warning for if someone uses the removed delegate_IP
+ * configuration parameter and set the value to delegate_ip
+ */
+static bool
+DelegateIPAssignMessage(ConfigContext scontext, char *newval, int elevel)
+{
+ if (scontext != CFGCXT_BOOT)
+ ereport(WARNING,
+ (errmsg("delegate_IP is changed to delegate_ip"),
+ errdetail("if delegate_IP is specified, the value will be set to delegate_ip")));
+ g_pool_config.delegate_ip = newval;
return true;
}
/*
if (conf->show_hook)
val = (*conf->show_hook) ();
- else
+ else if (conf->variable)
val = *conf->variable ? "on" : "off";
+ else
+ val = "";
}
break;
if (conf->show_hook)
val = (*conf->show_hook) ();
- else if (*conf->variable && **conf->variable)
+ else if (conf->variable && *conf->variable && **conf->variable)
val = *conf->variable;
else
val = "";
int pgpool_node_id; /* pgpool (watchdog) node id */
WdNodesConfig wd_nodes; /* watchdog lists */
char *trusted_servers; /* icmp reachable server list (A,B,C) */
- char *delegate_IP; /* delegate IP address */
+ char *delegate_ip; /* delegate IP address */
int wd_interval; /* lifecheck interval (sec) */
char *wd_authkey; /* Authentication key for watchdog
* communication */
# - Virtual IP control Setting -
-#delegate_IP = ''
+#delegate_ip = ''
# delegate IP address
# If this is empty, virtual IP never bring up.
# (change requires restart)
StrNCpy(status[i].desc, "upper server list to observe connection", POOLCONFIG_MAXDESCLEN);
i++;
- StrNCpy(status[i].name, "delegate_IP", POOLCONFIG_MAXNAMELEN);
- snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%s", pool_config->delegate_IP);
+ StrNCpy(status[i].name, "delegate_ip", POOLCONFIG_MAXNAMELEN);
+ snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%s", pool_config->delegate_ip);
StrNCpy(status[i].desc, "delegate IP address of leader pgpool", POOLCONFIG_MAXDESCLEN);
i++;
gettimeofday(&g_cluster.localNode->startup_time, NULL);
strncpy(g_cluster.localNode->hostname, pool_config->wd_nodes.wd_node_info[pgpool_node_id].hostname, sizeof(g_cluster.localNode->hostname) - 1);
- strncpy(g_cluster.localNode->delegate_ip, pool_config->delegate_IP, sizeof(g_cluster.localNode->delegate_ip) - 1);
+ strncpy(g_cluster.localNode->delegate_ip, pool_config->delegate_ip, sizeof(g_cluster.localNode->delegate_ip) - 1);
/* Assign the node name */
{
struct utsname unameData;
/*
* STEP 3 bring up the delegate IP
*/
- if (strlen(pool_config->delegate_IP) != 0)
+ if (strlen(pool_config->delegate_ip) != 0)
{
if (wd_IP_up() != WD_OK)
ereport(WARNING,
* STEP 2 bring down the delegate IP
*/
- if (strlen(pool_config->delegate_IP) != 0)
+ if (strlen(pool_config->delegate_ip) != 0)
{
if (wd_IP_down() != WD_OK)
ereport(WARNING,
char *command;
int i;
- if (strlen(pool_config->delegate_IP) == 0)
+ if (strlen(pool_config->delegate_ip) == 0)
{
ereport(LOG,
(errmsg("trying to acquire the delegate IP address, but delegate IP is not configured")));
{
for (i = 0; i < WD_TRY_PING_AT_IPUP; i++)
{
- if (wd_is_ip_exists(pool_config->delegate_IP) == true)
+ if (wd_is_ip_exists(pool_config->delegate_ip) == true)
break;
ereport(LOG,
(errmsg("waiting for the delegate IP address to become active"),
if (rtn == WD_OK)
ereport(LOG,
- (errmsg("successfully acquired the delegate IP:\"%s\"", pool_config->delegate_IP),
+ (errmsg("successfully acquired the delegate IP:\"%s\"", pool_config->delegate_ip),
errdetail("'if_up_cmd' returned with success")));
else
ereport(LOG,
char path[WD_MAX_PATH_LEN];
char *command;
- if (strlen(pool_config->delegate_IP) == 0)
+ if (strlen(pool_config->delegate_ip) == 0)
{
ereport(LOG,
(errmsg("trying to release the delegate IP address, but delegate IP is not configured")));
if (rtn == WD_OK)
{
ereport(LOG,
- (errmsg("successfully released the delegate IP:\"%s\"", pool_config->delegate_IP),
+ (errmsg("successfully released the delegate IP:\"%s\"", pool_config->delegate_ip),
errdetail("'if_down_cmd' returned with success")));
}
else
{
ereport(LOG,
- (errmsg("failed to release the delegate IP:\"%s\"", pool_config->delegate_IP),
+ (errmsg("failed to release the delegate IP:\"%s\"", pool_config->delegate_ip),
errdetail("'if_down_cmd' failed")));
}
return rtn;
return WD_NG;
}
- buf = string_replace(command, "$_IP_$", pool_config->delegate_IP);
+ buf = string_replace(command, "$_IP_$", pool_config->delegate_ip);
bp = buf;
while (*bp == ' ')
* If delegate IP is not assigned to the node the configuration is not
* used
*/
- if (strlen(pool_config->delegate_IP) == 0)
+ if (strlen(pool_config->delegate_ip) == 0)
return;
/* check setuid bit of ifup command */