From a3d655425d8f775f1d7ff86de81a08c183612915 Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Sun, 4 Oct 2020 23:49:33 +0900 Subject: [PATCH] Doc: update watchdog related documentation and remove "8.2. Watchdog Configuration Example". --- doc.ja/src/sgml/example-AWS.sgml | 58 +-- doc.ja/src/sgml/example-cluster.sgml | 35 +- doc.ja/src/sgml/example-watchdog.sgml | 496 -------------------------- doc.ja/src/sgml/examples.sgml | 1 - doc.ja/src/sgml/watchdog.sgml | 79 +++- doc/src/sgml/example-AWS.sgml | 43 +-- doc/src/sgml/example-cluster.sgml | 32 +- doc/src/sgml/example-watchdog.sgml | 350 ------------------ doc/src/sgml/examples.sgml | 1 - doc/src/sgml/watchdog.sgml | 71 +++- 10 files changed, 202 insertions(+), 964 deletions(-) delete mode 100644 doc.ja/src/sgml/example-watchdog.sgml delete mode 100644 doc/src/sgml/example-watchdog.sgml diff --git a/doc.ja/src/sgml/example-AWS.sgml b/doc.ja/src/sgml/example-AWS.sgml index 6bc76f456..b571be755 100644 --- a/doc.ja/src/sgml/example-AWS.sgml +++ b/doc.ja/src/sgml/example-AWS.sgml @@ -98,58 +98,16 @@ --> <productname>Pgpool-II</productname>の設定 - - この例の設定はとほとんど同じになりますが、を設定せず、代わりにとを使ってleader/Active Pgpool-IIノードのElastic IPアドレスを切り替えるのが異なります。 + この例の設定はとほとんど同じになりますが、を設定せず、代わりにとを使ってleader/Active Pgpool-IIノードのElastic IPアドレスを切り替えるのが異なります。 - - - Instance-1における<productname>Pgpool-II</productname>の設定 - - - - use_watchdog = on - delegate_IP = '' - wd_hostname = 'instance-1-private-ip' - other_pgpool_hostname0 = 'instance-2-private-ip' - other_pgpool_port0 = 9999 - other_wd_port0 = 9000 - wd_escalation_command = '$path_to_script/aws-escalation.sh' - wd_de_escalation_command = '$path_to_script/aws-de-escalation.sh' - - - - - - - - Instance-2における<productname>Pgpool-II</productname>の設定 - - - - use_watchdog = on - delegate_IP = '' - wd_hostname = 'instance-2-private-ip' - other_pgpool_hostname0 = 'instance-1-private-ip' - other_pgpool_port0 = 9999 - other_wd_port0 = 9000 - wd_escalation_command = '$path_to_script/aws-escalation.sh' - wd_de_escalation_command = '$path_to_script/aws-de-escalation.sh' - - - - + +use_watchdog = on +delegate_IP = '' +... +wd_escalation_command = '$path_to_script/aws-escalation.sh' +wd_de_escalation_command = '$path_to_script/aws-de-escalation.sh' + diff --git a/doc.ja/src/sgml/example-cluster.sgml b/doc.ja/src/sgml/example-cluster.sgml index d6ebb3fa0..31ab041aa 100644 --- a/doc.ja/src/sgml/example-cluster.sgml +++ b/doc.ja/src/sgml/example-cluster.sgml @@ -808,7 +808,22 @@ pgpool_port2 = 9999 - ハートビート通信用の各Pgpool-IIサーバ情報を設定しておきます。 + Watchdog死活監視の設定では、死活監視の方法を指定する、 + 監視間隔(秒)を指定するを設定します。 + この設定例では、死活監視の方法はhearbeatを用います。 + + + +wd_lifecheck_method = 'heartbeat' + # Method of watchdog lifecheck ('heartbeat' or 'query' or 'external') + # (change requires restart) +wd_interval = 10 + # lifecheck interval (sec) > 0 + # (change requires restart) + + + がheartbeatに設定されている場合、 + heartbeat通信用の各Pgpool-IIサーバ情報を設定しておきます。 heartbeat_hostname0 = 'server1' @@ -834,6 +849,24 @@ heartbeat_hostname2 = 'server3' heartbeat_port2 = 9694 heartbeat_device2 = '' + + がheartbeatに設定されている場合、 + 障害と判断する秒数を指定する、 + ハートビート信号の送信間隔(秒)を指定するを設定します。 + + +wd_heartbeat_keepalive = 2 + # Interval time of sending heartbeat signal (sec) + # (change requires restart) +wd_heartbeat_deadtime = 30 + # Deadtime interval for heartbeat signal (sec) + # (change requires restart) + + + + Watchdogノードの数が偶数の場合は、パラメータをonにする必要があります。 + + use_watchdog = onの場合は、pgpoolノード番号をpgpool_node_idに設定する必要があります。 diff --git a/doc.ja/src/sgml/example-watchdog.sgml b/doc.ja/src/sgml/example-watchdog.sgml deleted file mode 100644 index e286bc19e..000000000 --- a/doc.ja/src/sgml/example-watchdog.sgml +++ /dev/null @@ -1,496 +0,0 @@ - - - - - Watchdogの設定例 - - - - ここではwatchdogの機能を簡単に試す方法を説明します。 - Linux マシン2台にそれぞれ Pgpool-II がインストールされているものとします。 - また、いずれかのマシンか第 3 のマシンに、PostgreSQL がインストールされて稼働しているものとします。 - バックエンドノードは1台でかまいません。 - Pgpool-II がどのモードで稼働していても(レプリケーションモードでもマスタースレーブモードでも)、watchdogを利用することができます。 - - - - この例では、「osspc16」をActiveノードとして、「osspc20」をStandbyノードとして使います。 - 「someserver」は、これらのどちらかということを意味しています。 - - - - - 共通設定 - - - アクティブとスタンバイの両サーバで以下を設定します。 - - - - - Watchdogの有効化 - - - まず、をonにします。 - - use_watchdog = on - # Activates watchdog - - - - - - - 上位サーバの設定 - - - 上流のサーバ(アプリケーションサーバなど)を指定します。 - 空欄にしておいても構いません。 - - trusted_servers = '' - # trusted server list which are used - # to confirm network connection - # (hostA,hostB,hostC,...) - - - - - - - Watchdog通信 - - - watchdog通信を行うTCPポート番号を指定します。 - - wd_port = 9000 - # port number for watchdog service - - - - - - - 仮想IP - - - 仮想IPをに設定します。 - - delegate_IP = '133.137.177.143' - # delegate IP address - - - - - - 仮想IPに設定されるIPアドレスは空いており他のマシンで使用されていないことを確認してください。 - - - - - - - - 個々のサーバ設定 - - - 次に、それぞれのPgpool-IIで以下のパラメータを設定します。 - - - - - Activeサーバの設定(osspc16) - - - other_pgpool_hostname0 = 'osspc20' - # Host name or IP address to connect to for other pgpool 0 - other_pgpool_port0 = 9999 - # Port number for other pgpool 0 - other_wd_port0 = 9000 - # Port number for other watchdog 0 - - - - - - - Standbyサーバの設定(osspc20) - - - other_pgpool_hostname0 = 'osspc16' - # Host name or IP address to connect to for other pgpool 0 - other_pgpool_port0 = 9999 - # Port number for other pgpool 0 - other_wd_port0 = 9000 - # Port number for other watchdog 0 - - - - - - - - <productname>Pgpool-II</productname>の起動 - - - 両方のサーバでPgpool-IIをrootユーザで、"-n"オプションを付けて起動し、ログメッセージはpgpool.logファイルにリダイレクトします。 - - - - - ActiveサーバでのPgpool-II起動(osspc16) - - - 最初に、Active サーバでPgpool-IIを起動します。 - - [user@osspc16]$ su - - [root@osspc16]# {installed_dir}/bin/pgpool -n -f {installed_dir}/etc/pgpool.conf > pgpool.log 2>&1 - - - ログから、仮想IP アドレスを使用し、またwatchdogプロセス起動したことが確認できます。 - - LOG: I am announcing my self as leader/coordinator watchdog node - LOG: I am the cluster leader node - DETAIL: our declare coordinator message is accepted by all nodes - LOG: I am the cluster leader node. Starting escalation process - LOG: escalation process started with PID:59449 - LOG: watchdog process is initialized - LOG: watchdog: escalation started - LOG: I am the leader watchdog node - DETAIL: using the local backend node status - - - - - - - StandbyサーバでのPgpool-II起動(osspc20) - - - 次に、StandbyサーバでPgpool-IIを起動します。 - - [user@osspc20]$ su - - [root@osspc20]# {installed_dir}/bin/pgpool -n -f {installed_dir}/etc/pgpool.conf > pgpool.log 2>&1 - - - ログメッセージからPgpool-IIがwatchdogクラスタにスタンバイとして参加したことがわかります。 - - LOG: watchdog cluster configured with 1 remote nodes - LOG: watchdog remote node:0 on Linux_osspc16_9000:9000 - LOG: interface monitoring is disabled in watchdog - LOG: IPC socket path: "/tmp/.s.PGPOOLWD_CMD.9000" - LOG: watchdog node state changed from [DEAD] to [LOADING] - LOG: new outbound connection to Linux_osspc16_9000:9000 - LOG: watchdog node state changed from [LOADING] to [INITIALIZING] - LOG: watchdog node state changed from [INITIALIZING] to [STANDBY] - - LOG: successfully joined the watchdog cluster as standby node - DETAIL: our join coordinator request is accepted by cluster leader node "Linux_osspc16_9000" - LOG: watchdog process is initialized - - - - - - - - - 動作確認 - - - 仮想 IP アドレスに、pingが通ることを確認します。 - - [user@someserver]$ ping 133.137.177.143 - PING 133.137.177.143 (133.137.177.143) 56(84) bytes of data. - 64 bytes from 133.137.177.143: icmp_seq=1 ttl=64 time=0.328 ms - 64 bytes from 133.137.177.143: icmp_seq=2 ttl=64 time=0.264 ms - 64 bytes from 133.137.177.143: icmp_seq=3 ttl=64 time=0.412 ms - - - 先にPgpool-IIを起動したActiveサーバが、仮想IPアドレスを使っていることを確認します。 - - [root@osspc16]# ifconfig - eth0 ... - - eth0:0 inet addr:133.137.177.143 ... - - lo ... - - - 後からPgpool-IIを立ち上げたStandbサーバは、仮想IPアドレスを使っていないことを確認します。 - - [root@osspc20]# ifconfig - eth0 ... - - lo ... - - - - 仮想IPアドレスを使って、PostgreSQL に接続をできることを確認します。 - - [user@someserver]$ psql -h 133.137.177.143 -p 9999 -l - - - - - - - 仮想IPの切り替え - - - Activeサーバがサービス供給不可な状態になったときに、Standbyがそれを引き継ぐのを確認します。 - ActiveサーバのPgpool-IIを停止します。 - - [root@osspc16]# {installed_dir}/bin/pgpool stop - - - - するとStandbyサーバで、仮想IPアドレスを使用しはじめたというログメッセージが出力されます。 - - - - LOG: remote node "Linux_osspc16_9000" is shutting down - LOG: watchdog cluster has lost the coordinator node - - LOG: watchdog node state changed from [STANDBY] to [JOINING] - LOG: watchdog node state changed from [JOINING] to [INITIALIZING] - LOG: I am the only alive node in the watchdog cluster - HINT: skipping stand for coordinator state - LOG: watchdog node state changed from [INITIALIZING] to [LEADER] - LOG: I am announcing my self as leader/coordinator watchdog node - LOG: I am the cluster leader node - DETAIL: our declare coordinator message is accepted by all nodes - - LOG: I am the cluster leader node. Starting escalation process - LOG: watchdog: escalation started - - LOG: watchdog escalation process with pid: 59551 exit with SUCCESS. - - - - 仮想 IP アドレスに、pingが通ることを確認します。 - - [user@someserver]$ ping 133.137.177.143 - PING 133.137.177.143 (133.137.177.143) 56(84) bytes of data. - 64 bytes from 133.137.177.143: icmp_seq=1 ttl=64 time=0.328 ms - 64 bytes from 133.137.177.143: icmp_seq=2 ttl=64 time=0.264 ms - 64 bytes from 133.137.177.143: icmp_seq=3 ttl=64 time=0.412 ms - - - - Activeではもう仮想IPアドレスが使われなくなったのを確認します。 - - [root@osspc16]# ifconfig - eth0 ... - - lo ... - - - - Standbyで仮想IP アドレスが使われていることを確認します。 - - [root@osspc20]# ifconfig - eth0 ... - - eth0:0 inet addr:133.137.177.143 ... - - lo ... - - - - 仮想IPアドレスを使って、PostgreSQLに接続できることを確認します。 - - [user@someserver]$ psql -h 133.137.177.143 -p 9999 -l - - - - - - - - 応用 - - - - 死活監視 - - - watchdog の監視方法について設定するパラメータがあります。 - 監視間隔秒を指定する、死活監視のタイプを指定するを記述します。 - heartbeat方式では、障害と判断する秒数を指定する、受信ポート番号を指定する、ハートビート信号の送信間隔秒を指定する、送信先、を記述します。 - - wd_lifecheck_method = 'heartbeat' - # Method of watchdog lifecheck ('heartbeat' or 'query' or 'external') - # (change requires restart) - wd_interval = 10 - # lifecheck interval (sec) > 0 - wd_heartbeat_port = 9694 - # Port number for receiving heartbeat signal - # (change requires restart) - wd_heartbeat_keepalive = 2 - # Interval time of sending heartbeat signal (sec) - # (change requires restart) - wd_heartbeat_deadtime = 30 - # Deadtime interval for heartbeat signal (sec) - # (change requires restart) - heartbeat_destination0 = 'host0_ip1' - # Host name or IP address of destination 0 - # for sending heartbeat signal. - # (change requires restart) - heartbeat_destination_port0 = 9694 - # Port number of destination 0 for sending - # heartbeat signal. Usually this is the - # same as wd_heartbeat_port. - # (change requires restart) - - - - - - - - 仮想IPの切り替え - - - IP アドレスの切り替えコマンドについて設定するパラメータがあります。 - 仮想 IP を切り替える際に使うコマンドとして、、そのパスを指定するを記述します。 - また、仮想IP切り替え後のARPリクエスト送信コマンドを指定する、そのパスを指定するを記述します。 - - if_cmd_path = '/sbin' - # path to the directory where if_up/down_cmd exists - if_up_cmd = 'ip addr add $_IP_$/24 dev eth0 label eth0:0' - # startup delegate IP command - if_down_cmd = 'ip addr del $_IP_$/24 dev eth0' - # shutdown delegate IP command - - arping_path = '/usr/sbin' # arping command path - - arping_cmd = 'arping -U $_IP_$ -w 1' - - - およびパラメータに指定した任意のスクリプトで仮想IPの起動・停止を行うこともできます。 - - - - - - diff --git a/doc.ja/src/sgml/examples.sgml b/doc.ja/src/sgml/examples.sgml index b71c71171..e9bb01217 100644 --- a/doc.ja/src/sgml/examples.sgml +++ b/doc.ja/src/sgml/examples.sgml @@ -22,7 +22,6 @@ --> 設定の例 &example-basic; - &example-watchdog; &example-cluster; &example-AWS; &example-Aurora; diff --git a/doc.ja/src/sgml/watchdog.sgml b/doc.ja/src/sgml/watchdog.sgml index 94000d5e4..2bf368522 100644 --- a/doc.ja/src/sgml/watchdog.sgml +++ b/doc.ja/src/sgml/watchdog.sgml @@ -51,6 +51,51 @@ --> このパラメータは、サーバ起動時にのみ設定できます。 + + Pgpool-II 4.2より前では、watchdogは自ノードとそれを基準に他ノードの設定を記述するため、 + ノードごとに異なる設定を記述する必要がありました。 + Pgpool-II 4.2以降では、watchdogの設定はノード間で共通するようにしました。 + そのため、Pgpool-II 4.2以降、Watchdog機能が有効になっている場合、 + どの設定がどのホストであるかを区別するには、 + 設定ファイルpgpool.confを格納するディレクトリにpgpool_node_idファイルの作成が必要になります。 + そのファイルにpgpool(watchdog)ホストを識別するためのノード番号(0、1、2など)を指定します。 + + + pgpool_node_idの設定例 + + Pgpool ノードが3つあり、それぞれのホスト名が server1、server2、server3 の場合、各ホスト上でpgpool_node_idファイル以下のように作成します。 + RPMからインストールした場合は、pgpool.confが/etc/pgpool-II/配下にインストールされます。 + + + + + server1 + + +[server1]# cat /etc/pgpool-II/pgpool_node_id +0 + + + + + server2 + + +[server2]# cat /etc/pgpool-II/pgpool_node_id +1 + + + + + server3 + + +[server3]# cat /etc/pgpool-II/pgpool_node_id +2 + + + + @@ -163,7 +208,7 @@ you can set the , and like below: --> - Pgpool ノードが3つあり、それぞれのホストが server1、server2、server3 の場合、 + Pgpool ノードが3つあり、それぞれのホスト名が server1、server2、server3 の場合、 、 及びを以下のように設定します。 @@ -1321,8 +1366,8 @@ the number at the end of the parameter name is referred as the "pgpool node id", that starts from 0. --> - ハートビート信号を受信するためのポート番号を指定します。 - 1つのみを指定してください。 + ハートビート信号を受信するためのUDPポート番号を指定します。 + 1つのみを指定してください。デフォルトは9694です。 パラメータ名の最後にある数字は「pgpool ノードID」で、0から始まります(たとえばheartbeat_port0)。 @@ -1386,22 +1431,22 @@ you can set the , and like below: --> - Pgpool ノードが3つあり、それぞれのホストが server1、server2、server3 の場合、 + Pgpool ノードが3つあり、それぞれのホスト名が server1、server2、server3 の場合、 、 及びを以下のように設定します。 - - heartbeat_hostname0 = 'server1' - heartbeat_port0 = 9694 - heartbeat_device0 = '' - - heartbeat_hostname1 = 'server2' - heartbeat_port1 = 9694 - heartbeat_device1 = '' - - heartbeat_hostname2 = 'server3' - heartbeat_port2 = 9694 - heartbeat_device2 = '' - + +heartbeat_hostname0 = 'server1' +heartbeat_port0 = 9694 +heartbeat_device0 = '' + +heartbeat_hostname1 = 'server2' +heartbeat_port1 = 9694 +heartbeat_device1 = '' + +heartbeat_hostname2 = 'server3' +heartbeat_port2 = 9694 +heartbeat_device2 = '' + diff --git a/doc/src/sgml/example-AWS.sgml b/doc/src/sgml/example-AWS.sgml index fd7328c8f..111e420fc 100644 --- a/doc/src/sgml/example-AWS.sgml +++ b/doc/src/sgml/example-AWS.sgml @@ -63,48 +63,19 @@ <productname>Pgpool-II</productname> configurations Mostly the Pgpool-II configurations for this - example will be same as in the , except the + example will be same as in the , except the which we will not set in this example instead we will use and to switch the Elastic IP address to the leader/Active Pgpool-II node. - - - <productname>Pgpool-II</productname> configurations on Instance-1 - - - - use_watchdog = on - delegate_IP = '' - wd_hostname = 'instance-1-private-ip' - other_pgpool_hostname0 = 'instance-2-private-ip' - other_pgpool_port0 = 9999 - other_wd_port0 = 9000 - wd_escalation_command = '$path_to_script/aws-escalation.sh' - wd_de_escalation_command = '$path_to_script/aws-de-escalation.sh' + +use_watchdog = on +delegate_IP = '' +... +wd_escalation_command = '$path_to_script/aws-escalation.sh' +wd_de_escalation_command = '$path_to_script/aws-de-escalation.sh' - - - - - - <productname>Pgpool-II</productname> configurations on Instance-2 - - - - use_watchdog = on - delegate_IP = '' - wd_hostname = 'instance-2-private-ip' - other_pgpool_hostname0 = 'instance-1-private-ip' - other_pgpool_port0 = 9999 - other_wd_port0 = 9000 - wd_escalation_command = '$path_to_script/aws-escalation.sh' - wd_de_escalation_command = '$path_to_script/aws-de-escalation.sh' - - - - diff --git a/doc/src/sgml/example-cluster.sgml b/doc/src/sgml/example-cluster.sgml index ba5c167d2..d52ae28f5 100644 --- a/doc/src/sgml/example-cluster.sgml +++ b/doc/src/sgml/example-cluster.sgml @@ -873,7 +873,19 @@ hostname2 = 'server3' wd_port2 = 9000 pgpool_port2 = 9999 - + + Specify the method of lifecheck + and the lifecheck interval . + Here, we use hearbeat method to perform watchdog lifecheck. + + +wd_lifecheck_method = 'heartbeat' + # Method of watchdog lifecheck ('heartbeat' or 'query' or 'external') + # (change requires restart) +wd_interval = 10 + # lifecheck interval (sec) > 0 + # (change requires restart) + Specify all Pgpool-II nodes information for sending and receiving heartbeat signal. @@ -901,6 +913,24 @@ heartbeat_hostname2 = 'server3' heartbeat_port2 = 9694 heartbeat_device2 = '' + + If the is set to heartbeat, + specify the time to detect a fault and + the interval to send heartbeat signals . + + +wd_heartbeat_keepalive = 2 + # Interval time of sending heartbeat signal (sec) + # (change requires restart) +wd_heartbeat_deadtime = 30 + # Deadtime interval for heartbeat signal (sec) + # (change requires restart) + + + + If you have even number of watchdog nodes, you need to turn on parameter. + + If use_watchdog = on, please make sure the pgpool node number is specified diff --git a/doc/src/sgml/example-watchdog.sgml b/doc/src/sgml/example-watchdog.sgml deleted file mode 100644 index ac753a2ef..000000000 --- a/doc/src/sgml/example-watchdog.sgml +++ /dev/null @@ -1,350 +0,0 @@ - - Watchdog Configuration Example - - - This tutorial explains the simple way to try "Watchdog". - What you need is 2 Linux boxes on which - Pgpool-II is installed and a PostgreSQL - on the same machine or in the other one. It is enough - that 1 node for backend exists. - You can use watchdog with - Pgpool-II in any mode: replication mode, - native replication mode and raw mode. - - - This example uses use "osspc16" as an Active node and - "osspc20" as a Standby node. "Someserver" means one of them. - - - - Common configurations - - Set the following parameters in both of active and standby nodes. - - - - Enabling watchdog - - First of all, set to on. - - use_watchdog = on - # Activates watchdog - - - - - - Configure Up stream servers - - Specify the up stream servers (e.g. application servers). - Leaving it blank is also fine. - - trusted_servers = '' - # trusted server list which are used - # to confirm network connection - # (hostA,hostB,hostC,...) - - - - - - Watchdog Communication - - Specify the TCP port number for watchdog communication. - - wd_port = 9000 - # port number for watchdog service - - - - - - Virtual IP - - Specify the IP address to be used as a virtual IP address - in the . - - delegate_IP = '133.137.177.143' - # delegate IP address - - - - - Make sure the IP address configured as a Virtual IP should be - free and is not used by any other machine. - - - - - - - Individual Server Configurations - - Next, set the following parameters for each - Pgpool-II. - - - - Active (osspc16) Server configurations - - - other_pgpool_hostname0 = 'osspc20' - # Host name or IP address to connect to for other pgpool 0 - other_pgpool_port0 = 9999 - # Port number for other pgpool 0 - other_wd_port0 = 9000 - # Port number for other watchdog 0 - - - - - - Standby (osspc20) Server configurations - - - other_pgpool_hostname0 = 'osspc16' - # Host name or IP address to connect to for other pgpool 0 - other_pgpool_port0 = 9999 - # Port number for other pgpool 0 - other_wd_port0 = 9000 - # Port number for other watchdog 0 - - - - - - - Starting <productname>Pgpool-II</productname> - - Start Pgpool-II on each servers from - root user with "-n" switch - and redirect log messages into pgpool.log file. - - - - Starting pgpool in Active server (osspc16) - - First start the Pgpool-II on Active server. - - [user@osspc16]$ su - - [root@osspc16]# {installed_dir}/bin/pgpool -n -f {installed_dir}/etc/pgpool.conf > pgpool.log 2>&1 - - Log messages will show that Pgpool-II - has the virtual IP address and starts watchdog process. - - LOG: I am announcing my self as leader/coordinator watchdog node - LOG: I am the cluster leader node - DETAIL: our declare coordinator message is accepted by all nodes - LOG: I am the cluster leader node. Starting escalation process - LOG: escalation process started with PID:59449 - LOG: watchdog process is initialized - LOG: watchdog: escalation started - LOG: I am the leader watchdog node - DETAIL: using the local backend node status - - - - - - Starting pgpool in Standby server (osspc20) - - Now start the Pgpool-II on Standby server. - - [user@osspc20]$ su - - [root@osspc20]# {installed_dir}/bin/pgpool -n -f {installed_dir}/etc/pgpool.conf > pgpool.log 2>&1 - - Log messages will show that Pgpool-II - has joined the watchdog cluster as standby watchdog. - - LOG: watchdog cluster configured with 1 remote nodes - LOG: watchdog remote node:0 on Linux_osspc16_9000:9000 - LOG: interface monitoring is disabled in watchdog - LOG: IPC socket path: "/tmp/.s.PGPOOLWD_CMD.9000" - LOG: watchdog node state changed from [DEAD] to [LOADING] - LOG: new outbound connection to Linux_osspc16_9000:9000 - LOG: watchdog node state changed from [LOADING] to [INITIALIZING] - LOG: watchdog node state changed from [INITIALIZING] to [STANDBY] - - LOG: successfully joined the watchdog cluster as standby node - DETAIL: our join coordinator request is accepted by cluster leader node "Linux_osspc16_9000" - LOG: watchdog process is initialized - - - - - - - - Try it out - - Confirm to ping to the virtual IP address. - - [user@someserver]$ ping 133.137.177.142 - PING 133.137.177.143 (133.137.177.143) 56(84) bytes of data. - 64 bytes from 133.137.177.143: icmp_seq=1 ttl=64 time=0.328 ms - 64 bytes from 133.137.177.143: icmp_seq=2 ttl=64 time=0.264 ms - 64 bytes from 133.137.177.143: icmp_seq=3 ttl=64 time=0.412 ms - - Confirm if the Active server which started at first has the virtual IP address. - - [root@osspc16]# ifconfig - eth0 ... - - eth0:0 inet addr:133.137.177.143 ... - - lo ... - - Confirm if the Standby server which started not at first doesn't have the virtual IP address. - - [root@osspc20]# ifconfig - eth0 ... - - lo ... - - - Try to connect PostgreSQL by "psql -h delegate_IP -p port". - - [user@someserver]$ psql -h 133.137.177.142 -p 9999 -l - - - - - - Switching virtual IP - - Confirm how the Standby server works when the Active server can't provide its service. - Stop Pgpool-II on the Active server. - - [root@osspc16]# {installed_dir}/bin/pgpool stop - - - Then, the Standby server starts to use the virtual IP address. Log shows: - - - - LOG: remote node "Linux_osspc16_9000" is shutting down - LOG: watchdog cluster has lost the coordinator node - - LOG: watchdog node state changed from [STANDBY] to [JOINING] - LOG: watchdog node state changed from [JOINING] to [INITIALIZING] - LOG: I am the only alive node in the watchdog cluster - HINT: skipping stand for coordinator state - LOG: watchdog node state changed from [INITIALIZING] to [LEADER] - LOG: I am announcing my self as leader/coordinator watchdog node - LOG: I am the cluster leader node - DETAIL: our declare coordinator message is accepted by all nodes - - LOG: I am the cluster leader node. Starting escalation process - LOG: watchdog: escalation started - - LOG: watchdog escalation process with pid: 59551 exit with SUCCESS. - - - Confirm to ping to the virtual IP address. - - [user@someserver]$ ping 133.137.177.142 - PING 133.137.177.143 (133.137.177.143) 56(84) bytes of data. - 64 bytes from 133.137.177.143: icmp_seq=1 ttl=64 time=0.328 ms - 64 bytes from 133.137.177.143: icmp_seq=2 ttl=64 time=0.264 ms - 64 bytes from 133.137.177.143: icmp_seq=3 ttl=64 time=0.412 ms - - - Confirm that the Active server doesn't use the virtual IP address any more. - - [root@osspc16]# ifconfig - eth0 ... - - lo ... - - - Confirm that the Standby server uses the virtual IP address. - - [root@osspc20]# ifconfig - eth0 ... - - eth0:0 inet addr:133.137.177.143 ... - - lo ... - - - Try to connect PostgreSQL by "psql -h delegate_IP -p port". - - [user@someserver]$ psql -h 133.137.177.142 -p 9999 -l - - - - - - - More - - - Lifecheck - - There are the parameters about watchdog's monitoring. - Specify the interval to check and - the type of lifecheck . - The hearbeat method specify the time to detect - a fault , the port number to - receive , the interval to send - , the IP address or hostname - of destination and finally - the destination port number . - - wd_lifecheck_method = 'heartbeat' - # Method of watchdog lifecheck ('heartbeat' or 'query' or 'external') - # (change requires restart) - wd_interval = 10 - # lifecheck interval (sec) > 0 - wd_heartbeat_port = 9694 - # Port number for receiving heartbeat signal - # (change requires restart) - wd_heartbeat_keepalive = 2 - # Interval time of sending heartbeat signal (sec) - # (change requires restart) - wd_heartbeat_deadtime = 30 - # Deadtime interval for heartbeat signal (sec) - # (change requires restart) - heartbeat_destination0 = 'host0_ip1' - # Host name or IP address of destination 0 - # for sending heartbeat signal. - # (change requires restart) - heartbeat_destination_port0 = 9694 - # Port number of destination 0 for sending - # heartbeat signal. Usually this is the - # same as wd_heartbeat_port. - # (change requires restart) - - - - - - - Switching virtual IP address - - There are the parameters for switching the virtual IP address. - Specify switching commands , - , the path to them - , the command executed after - switching to send ARP request - and the path to it . - - if_cmd_path = '/sbin' - # path to the directory where if_up/down_cmd exists - if_up_cmd = 'ip addr add $_IP_$/24 dev eth0 label eth0:0' - # startup delegate IP command - if_down_cmd = 'ip addr del $_IP_$/24 dev eth0' - # shutdown delegate IP command - - arping_path = '/usr/sbin' # arping command path - - arping_cmd = 'arping -U $_IP_$ -w 1' - - You can also bring up and bring down the virtual IP using arbitrary scripts - specified and - parameters. - - - - - diff --git a/doc/src/sgml/examples.sgml b/doc/src/sgml/examples.sgml index 49c220f75..db598054e 100644 --- a/doc/src/sgml/examples.sgml +++ b/doc/src/sgml/examples.sgml @@ -12,7 +12,6 @@ Configuration Examples &example-basic; - &example-watchdog; &example-cluster; &example-AWS; &example-Aurora; diff --git a/doc/src/sgml/watchdog.sgml b/doc/src/sgml/watchdog.sgml index be177c8b2..1089d2706 100644 --- a/doc/src/sgml/watchdog.sgml +++ b/doc/src/sgml/watchdog.sgml @@ -30,6 +30,54 @@ This parameter can only be set at server start. + + Pgpool-II 4.1 or earlier, because it is required to specify + its own pgpool node information and the destination pgpool nodes information, the + settings are different per pgpool node. + Since Pgpool-II 4.2, all configuration parameters are + identical on all hosts. If watchdog feature is enabled, to distingusish which host + is which, a pgpool_node_id file is required. + You need to create a pgpool_node_id file and specify the + pgpool (watchdog) node number (e.g. 0, 1, 2 ...) to identify pgpool (watchdog) host. + + + pgpool_node_id configuration + + If you have 3 pgpool nodes with hostname server1, server2 and server3, create the + pgpool_node_id file on each host as follows. + When installing Pgpool-II using RPM, + pgpool.conf is installed under /etc/pgpool-II/. + + + + + server1 + + +[server1]# cat /etc/pgpool-II/pgpool_node_id +0 + + + + + server2 + + +[server2]# cat /etc/pgpool-II/pgpool_node_id +1 + + + + + server3 + + +[server3]# cat /etc/pgpool-II/pgpool_node_id +2 + + + + @@ -101,20 +149,20 @@ Watchdog configuration If you have 3 pgpool nodes with hostname server1, server2 and server3, - you can set the , + you can configure , and like below: - hostname0 = 'server1' - wd_port0 = 9000 - pgpool_port0 = 9999 +hostname0 = 'server1' +wd_port0 = 9000 +pgpool_port0 = 9999 - hostname1 = 'server2' - wd_port1 = 9000 - pgpool_port1 = 9999 +hostname1 = 'server2' +wd_port1 = 9000 +pgpool_port1 = 9999 - hostname2 = 'server3' - wd_port2 = 9000 - pgpool_port2 = 9999 +hostname2 = 'server3' +wd_port2 = 9000 +pgpool_port2 = 9999 @@ -930,6 +978,7 @@ Specifies the port number for sending and receiving the heartbeat signals. + Specify only one port number here. Default is 9694. The number at the end of the parameter name is referred as "pgpool node id", and it starts from 0 (e.g. heartbeat_port0). @@ -967,7 +1016,7 @@ Heartbeat configuration If you have 3 pgpool nodes with hostname server1, server2 and server3, - you can set the , + you can configure , and like below: heartbeat_hostname0 = 'server1' -- 2.39.5