<sect1 id="runtime-config-failover">
<title>Failover and Failback</title>
- <para>
- failover_command, failback_command, fail_over_on_backend_error,
- search_primary_node_timeout
- </para>
+ <variablelist>
+
+ <varlistentry id="guc-failover-command" xreflabel="failover_command">
+ <term><varname>failover_command</varname> (<type>string</type>)
+ <indexterm>
+ <primary><varname>failover_command</varname> configuration parameter</primary>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ Specifies a user command to run when a PostgreSQL backend node detaches.
+ <productname>Pgpool-II</productname> replaces the following special characters
+ with the backend specific information.
+ </para>
+
+ <table id="failover-command-table">
+ <title>failover command options</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Special character</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+
+ <tbody>
+ <row>
+ <entry>%d</entry>
+ <entry>Backend ID of a detached node</entry>
+ </row>
+ <row>
+ <entry>%h</entry>
+ <entry>Hostname of a detached node</entry>
+ </row>
+ <row>
+ <entry>%p</entry>
+ <entry>Port number of a detached node</entry>
+ </row>
+ <row>
+ <entry>%D</entry>
+ <entry>Database cluster directory of a detached node</entry>
+ </row>
+ <row>
+ <entry>%M</entry>
+ <entry>Old master node ID</entry>
+ </row>
+ <row>
+ <entry>%m</entry>
+ <entry> New master node ID</entry>
+ </row>
+ <row>
+ <entry>%H</entry>
+ <entry>Hostname of the new master node</entry>
+ </row>
+ <row>
+ <entry>%P</entry>
+ <entry> Old primary node ID</entry>
+ </row>
+ <row>
+ <entry>%r</entry>
+ <entry>New master port number</entry>
+ </row>
+ <row>
+ <entry>%R</entry>
+ <entry>New master database cluster directory</entry>
+ </row>
+ <row>
+ <entry>%%</entry>
+ <entry> '%' character</entry>
+ </row>
+
+ </tbody>
+ </tgroup>
+ </table>
+
+ <note>
+ <para>
+ When a failover is performed, <productname>Pgpool-II</productname> kills all
+ its child processes, which will in turn terminate all the active sessions to
+ <productname>Pgpool-II</productname>. After that <productname>Pgpool-II</productname>
+ invokes the <command>failover_command</command> and after the command completion
+ <productname>Pgpool-II</productname> starts new child processes
+ which makes it ready again to accept client connections.
+ </para>
+ </note>
+ <para>
+ This parameter can be changed by reloading the pgpool configurations.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="guc-failback-command" xreflabel="failback_command">
+ <term><varname>failback_command</varname> (<type>string</type>)
+ <indexterm>
+ <primary><varname>failback_command</varname> configuration parameter</primary>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ Specifies a user command to run when a PostgreSQL backend node gets attached to
+ <productname>Pgpool-II</productname>, <productname>Pgpool-II</productname>
+ replaces the following special characters with the backend specific information.
+ </para>
+
+ <table id="ffailback-command-table">
+ <title>failback command options</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Special character</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+
+ <tbody>
+ <row>
+ <entry>%d</entry>
+ <entry>Backend ID of a detached node</entry>
+ </row>
+ <row>
+ <entry>%h</entry>
+ <entry>Hostname of a detached node</entry>
+ </row>
+ <row>
+ <entry>%p</entry>
+ <entry>Port number of a detached node</entry>
+ </row>
+ <row>
+ <entry>%D</entry>
+ <entry>Database cluster directory of a detached node</entry>
+ </row>
+ <row>
+ <entry>%M</entry>
+ <entry>Old master node ID</entry>
+ </row>
+ <row>
+ <entry>%m</entry>
+ <entry> New master node ID</entry>
+ </row>
+ <row>
+ <entry>%H</entry>
+ <entry>Hostname of the new master node</entry>
+ </row>
+ <row>
+ <entry>%P</entry>
+ <entry> Old primary node ID</entry>
+ </row>
+ <row>
+ <entry>%r</entry>
+ <entry>New master port number</entry>
+ </row>
+ <row>
+ <entry>%R</entry>
+ <entry>New master database cluster directory</entry>
+ </row>
+ <row>
+ <entry>%%</entry>
+ <entry> '%' character</entry>
+ </row>
+
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para>
+ This parameter can be changed by reloading the pgpool configurations.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="guc-follow-master-command" xreflabel="follow_master_command">
+ <term><varname>follow_master_command</varname> (<type>string</type>)
+ <indexterm>
+ <primary><varname>follow_master_command</varname> configuration parameter</primary>
+ </indexterm>
+ </term>
+ <listitem>
+
+ <para>
+ Specifies a user command to run in master/slave streaming replication mode
+ after the master backend node failover.
+ <productname>Pgpool-II</productname>, <productname>Pgpool-II</productname>
+ replaces the following special characters with the backend specific information.
+ </para>
+
+ <table id="follow_master-command-table">
+ <title>follow master command options</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Special character</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+
+ <tbody>
+ <row>
+ <entry>%d</entry>
+ <entry>Backend ID of a detached node</entry>
+ </row>
+ <row>
+ <entry>%h</entry>
+ <entry>Hostname of a detached node</entry>
+ </row>
+ <row>
+ <entry>%p</entry>
+ <entry>Port number of a detached node</entry>
+ </row>
+ <row>
+ <entry>%D</entry>
+ <entry>Database cluster directory of a detached node</entry>
+ </row>
+ <row>
+ <entry>%M</entry>
+ <entry>Old master node ID</entry>
+ </row>
+ <row>
+ <entry>%m</entry>
+ <entry> New master node ID</entry>
+ </row>
+ <row>
+ <entry>%H</entry>
+ <entry>Hostname of the new master node</entry>
+ </row>
+ <row>
+ <entry>%P</entry>
+ <entry> Old primary node ID</entry>
+ </row>
+ <row>
+ <entry>%r</entry>
+ <entry>New master port number</entry>
+ </row>
+ <row>
+ <entry>%R</entry>
+ <entry>New master database cluster directory</entry>
+ </row>
+ <row>
+ <entry>%%</entry>
+ <entry> '%' character</entry>
+ </row>
+
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para>
+ If <xref linkend="guc-follow-master-command"> is not left out empty, then when
+ a master node failover gets completed in master/slave streaming replication mode,
+ <productname>Pgpool-II</productname> degenerates all nodes excepted the new master
+ and starts new child processes to be ready again to accept connections from the clients.
+ After this, <productname>Pgpool-II</productname> executes the command configured
+ in the <xref linkend="guc-follow-master-command"> for each degenerated backend nodes.
+ </para>
+ <para>
+ Typically <xref linkend="guc-follow-master-command"> command is used to recover
+ the slave from the new master by calling the pcp_recovery_node command.
+ </para>
+ <para>
+ This parameter can be changed by reloading the pgpool configurations.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="guc-fail-over-on-backend-error" xreflabel="fail_over_on_backend_error">
+ <term><varname>fail_over_on_backend_error</varname> (<type>boolean</type>)
+ <indexterm>
+ <primary><varname>fail_over_on_backend_error</varname> configuration parameter</primary>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ When set to on, <productname>Pgpool-II</productname> considers the reading/writing
+ errors on the PostgreSQL backend connection as the backend node failure and trigger the
+ failover on that node after disconnecting the current session.
+ When this is set to off, <productname>Pgpool-II</productname> only report an error
+ and disconnect the session in case of such errors.
+ </para>
+ <note>
+ <para>
+ It is recommended to turn on the backend health checking
+ (see <xref linkend="runtime-config-health-check">)
+ when <xref linkend="guc-fail-over-on-backend-error"> is set to off.
+ However, <productname>Pgpool-II</productname> still triggers the
+ failover when it detects the administrative shutdown of
+ PostgreSQL backend server.
+ </para>
+ </note>
+ <para>
+ This parameter can be changed by reloading the pgpool configurations.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="guc-search-primary-node-timeout" xreflabel="search_primary_node_timeout">
+ <term><varname>search_primary_node_timeout</varname> (<type>integer</type>)
+ <indexterm>
+ <primary><varname>search_primary_node_timeout</varname> configuration parameter</primary>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ Specifies the maximum amount of time in seconds to search for the
+ primary node when a failover scenario occurs.
+ <productname>Pgpool-II</productname> will give up looking for the primary
+ node if it is not found with-in this configured time.
+ Default is 10 and Setting this parameter to 0 means keep trying forever.
+ </para>
+ <para>
+ This parameter is only applicable in the streaming replication mode.
+ </para>
+ <para>
+ This parameter can be changed by reloading the pgpool configurations.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
</sect1>
Default value is 20. Setting it to 0, disables the timeout (waits until TCP/IP timeout).
</para>
<para>
- This parameter can be changed by reloading pgpool configuration.
+ This parameter can be changed by reloading the pgpool configurations.
</para>
</listitem>
</varlistentry>
Default is 0, which means health check is disabled.
</para>
<para>
- This parameter can be changed by reloading pgpool configuration.
+ This parameter can be changed by reloading the pgpool configurations.
</para>
</listitem>
</varlistentry>
Otherwise, health check causes an error.
</para>
<para>
- This parameter can be changed by reloading pgpool configuration.
+ This parameter can be changed by reloading the pgpool configurations.
</para>
</listitem>
</varlistentry>
Otherwise, health check causes an error.
</para>
<para>
- This parameter can be changed by reloading pgpool configuration.
+ This parameter can be changed by reloading the pgpool configurations.
</para>
</listitem>
</varlistentry>
<productname>Pgpool-II</productname> <emphasis>V3.5</emphasis>.
</para>
<para>
- This parameter can be changed by reloading pgpool configuration.
+ This parameter can be changed by reloading the pgpool configurations.
</para>
</listitem>
</varlistentry>
Default is 0, which means do not retry.
</para>
<para>
- This parameter can be changed by reloading pgpool configuration.
+ This parameter can be changed by reloading the pgpool configurations.
</para>
</listitem>
</varlistentry>
If 0, then retries are immediate (no delay).
</para>
<para>
- This parameter can be changed by reloading pgpool configuration.
+ This parameter can be changed by reloading the pgpool configurations.
</para>
</listitem>
</varlistentry>
</note>
</para>
<para>
- This parameter can be changed by reloading pgpool configuration.
+ This parameter can be changed by reloading the pgpool configurations.
</para>
</listitem>
</varlistentry>