From c7f4b0edbc35aebfd278d49f8d84c6fdeb1e1fe3 Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Wed, 18 Jun 2025 18:12:13 +0900 Subject: [PATCH] Doc: enhance pcp_node_info document. Clarify that each backend_application_nameX must match the value specified in the application_name of primary_conninfo to correctly display "replication_state" and "replication_sync_state". --- doc.ja/src/sgml/ref/pcp_node_info.sgml | 51 +++++++++++++++++---- doc/src/sgml/ref/pcp_node_info.sgml | 61 +++++++++++++++++++++----- 2 files changed, 92 insertions(+), 20 deletions(-) diff --git a/doc.ja/src/sgml/ref/pcp_node_info.sgml b/doc.ja/src/sgml/ref/pcp_node_info.sgml index 0e24eaae1..dc146cec3 100644 --- a/doc.ja/src/sgml/ref/pcp_node_info.sgml +++ b/doc.ja/src/sgml/ref/pcp_node_info.sgml @@ -136,7 +136,7 @@ $ pcp_node_info -w -p 11001 -n 1 2. ノードのポート番号 3. ステータス 4. ロードバランスウェイト -5. バックエンド状態名 +5. バックエンドステータス名 6. 実際のバックエンドの状態 (Pgpool-II 4.3以降。PQpingParamsで取得) 7. バックエンドの役割 8. 実際のバックエンドの役割(Pgpool-II 4.3以降。pg_is_in_recoveryで取得) @@ -148,9 +148,9 @@ $ pcp_node_info -w -p 11001 -n 1 - 3 (ステータス)は [0..3] までの数字で表わされます。各数字の意味は以下のとおりです。 + 3(ステータス)は [0..3] までの数字で表わされます。各数字の意味は以下のとおりです。 @@ -170,10 +170,21 @@ $ pcp_node_info -w -p 11001 -n 1 - 4 (ロードバランスウェイト)は0から1に正規化されたフォーマットで出力されます。 + 4(ロードバランスウェイト)は0から1に正規化されたフォーマットで出力されます。 - 6は実際のバックエンドの状態をリアルタイムで取得して表示します。 + + 5(バックエンドステータス名)はPgpool-IIから見たPostgreSQLノードのステータス名を示します。 + これは、上記「3(ステータス)」の数値に対応する状態名(文字列)であり、Pgpool-IIが内部的に保持しているノードの状態を、可読性の高い形式で表現したものです。 + + + 6(実際のバックエンドの状態)は実際のバックエンドの状態をリアルタイムで取得して表示します。 情報の取得は、このコマンドが実行された時にPQpingParamsを呼び出すことによって行われます。 PQpingParamsはPostgreSQL 9.1以降でのみサポートされています。 Pgpool-IIがPostgreSQL 9.0以前とともに構築されると、この列は"unknown"と表示されます。 @@ -182,7 +193,10 @@ $ pcp_node_info -w -p 11001 -n 1 逆に、5が"up"なのに、6が"down"というのは起こらないはずです。 - 8は実際のバックエンドの状態をリアルタイムで取得して表示します。 + 7(バックエンドの役割)はPgpool-IIから見たPostgreSQLノードの役割(primaryまたはstandby)を示します。Pgpool-IIが内部的に保持している情報に基づいて表示されます。 + + + 8(実際のバックエンドの役割)は実際のバックエンドの役割(primaryまたはstandby)をリアルタイムで取得して表示します。 その結果はストリーミングレプリケーションモードでは、"primary"か"standby"ですが、情報が取得できなければ"unknown"と表示します。 Pgpool-IIはノードID順にバックエンドノードを調べ、最後に見つけたスタンバイ以外のノードをプライマリとするので、誤ってスタンバイ以外のノードが複数できたときなどには、7と8が一致しないことはありえます。 (このコマンドはそのような状態を見つけるのに役立ちます。) @@ -190,11 +204,30 @@ $ pcp_node_info -w -p 11001 -n 1 ストリーミングレプリケーションモードと違って、pg_is_in_recoveryは呼び出されず、7と8が異なる値になることはありません。 - 9, 10, 11は、が0以外でなければ正しく表示されません。 - また、10, 11は、がPostgreSQLのスーパーユーザーであるか、"pg_monitor"グループに所属していなけれ正しく表示されません。 + 9, 10, 11を正しく表示させるに、が0以外に設定されている必要があります。 + さらに10, 11を正しく表示させるには、以下の追加設定が必要です。 + + + + パラメータを設定する必要があります。 + + + 各backend_application_nameXに設定された値が、該当ノードのprimary_conninfoのapplication_nameに指定された値と一致している必要があります。 + + + 特に、Pgpool-IIのコマンドを用いてスタンバイノードを構築し、コミュニティ提供のサンプルスクリプトを使用している場合は、backend_application_nameXの値をbackend_hostnameXと一致させてください。 + 具体的な設定例についてはをご参照ください。 + + + + + がPostgreSQLのスーパーユーザーであるか、もしくはpg_monitorロールの権限が付与されている必要があります。 + + + - をpg_monitorグループに所属させるには、以下のSQLコマンドをPostgreSQLスーパーユーザーで実行してください("sr_check_user"をの設定値で置き換えてください) + にpg_monitorロールの権限を付与するには、以下のSQLコマンドをPostgreSQLスーパーユーザーで実行してください("sr_check_user"をの設定値で置き換えてください) GRANT pg_monitor TO sr_check_user; diff --git a/doc/src/sgml/ref/pcp_node_info.sgml b/doc/src/sgml/ref/pcp_node_info.sgml index de8348b49..c6a568699 100644 --- a/doc/src/sgml/ref/pcp_node_info.sgml +++ b/doc/src/sgml/ref/pcp_node_info.sgml @@ -100,7 +100,7 @@ $ pcp_node_info -w -p 11001 -n 1 - 3 (status) is represented by a digit from [0 to 3]. + 3 (status) is represented by a digit from [0 to 3]. 0 - This state is only used during the initialization. PCP will never display it. 1 - Node is up. No connections yet. @@ -109,10 +109,17 @@ $ pcp_node_info -w -p 11001 -n 1 - 4 (load balance weight) is displayed in normalized format (0 - 1). + 4 (load balance weight) is displayed in normalized format (0 - 1). - 6 shows the backend status in real time. The info is obtained by + 5 (status name) indicates the status of a + PostgreSQL node as recognized by + Pgpool-II. It corresponds to the numeric value + shown in "3 (status)" and represents the node's internal state + in a human-readable format maintained by Pgpool-II. + + + 6 (actual backend status) shows the backend status in real time. The info is obtained by calling PQpingParams at the time when the command is invoked. PQpingParams is only available in PostgreSQL 9.1 or later. If @@ -129,7 +136,13 @@ $ pcp_node_info -w -p 11001 -n 1 is "down". - 8 shows the backend status in real time. The result will be either + 7 (backend role) indicates the role of a PostgreSQL + node (primary or standby) from the perspective of + Pgpool-II, based on its internally maintained + information. + + + 8 (actual backend role) shows the backend status in real time. The result will be either "primary" or "standby", and possibly "unknown" if information retrieval failed. Since Pgpool-II searches backend nodes in the node id order and assumes the last @@ -142,15 +155,41 @@ $ pcp_node_info -w -p 11001 -n 1 7 and 8 will be always the same. - To correctly 9, 10, 11 are displayed, must not - be 0. 10, 11 will not be displayed - if is - not PostgreSQL super user nor it's not - in "pg_monitor" group. + To correctly display 9, 10 and 11, + must not be 0. + Additionally, to correctly display 10 and 11, the following + settings are required. + + + + must be configured. + + + The value set for each backend_application_nameX + must match the value specified in application_name + of primary_conninfo for the corresponding node. + + + In particular, when creating standby nodes using Pgpool-II's + command and community-provided + sample scripts, please ensure that the value of + backend_application_nameX matches that of + backend_hostnameX. For specific configuration examples, + please refer to . + + + + + must either be a + PostgreSQL superuser or have been granted the + privileges of the pg_monitor role. + + + - To make in pg_monitor - group, execute following SQL command + To grant the privileges of the pg_monitor role to + , execute following SQL command by PostgreSQL super user (replace "sr_check_user" with the setting of ): -- 2.39.5