From 090493ebc94d1430c7f5090162c3db6a7e947e73 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Wed, 24 Apr 2019 13:19:00 +0900 Subject: [PATCH] doc: document "child_node" events --- doc/event-notifications.sgml | 21 ++++- doc/repmgrd-automatic-failover.sgml | 136 ++++++++++++++++++++++++++-- 2 files changed, 147 insertions(+), 10 deletions(-) diff --git a/doc/event-notifications.sgml b/doc/event-notifications.sgml index 4f610b47..145b3428 100644 --- a/doc/event-notifications.sgml +++ b/doc/event-notifications.sgml @@ -91,8 +91,7 @@ may contain spaces, so should be quoted in the provided command configuration, e.g.: - event_notification_command='/path/to/some/script %n %e %s "%t" "%d"' - + event_notification_command='/path/to/some/script %n %e %s "%t" "%d"' @@ -147,7 +146,10 @@ By default, all notification types will be passed to the designated script; the notification types can be filtered to explicitly named ones using the - event_notifications parameter. + event_notifications parameter, e.g.: + + event_notifications=primary_register,standby_register,witness_register + @@ -255,6 +257,19 @@ standby_recovery + + child_node_disconnect + + + child_node_reconnect + + + child_node_new_connect + + + child_nodes_disconnect_command + + diff --git a/doc/repmgrd-automatic-failover.sgml b/doc/repmgrd-automatic-failover.sgml index 522a690b..7559d00c 100644 --- a/doc/repmgrd-automatic-failover.sgml +++ b/doc/repmgrd-automatic-failover.sgml @@ -165,7 +165,7 @@ - + repmgrd standby disconnection @@ -192,13 +192,19 @@ example to "fence" the node and ensure it is isolated from any applications attempting to access the replication cluster. - + + + Standby disconnections monitoring process and criteria + + repmgrd monitors attach child nodes and decides + whether to invoke the user-defined command based on the following process + and criteria: - Every few seconds (defined by the configuration parameter child_nodes_check_interval - (a value of 0 disables this altogether), repmgrd queries + Every few seconds (defined by the configuration parameter child_nodes_check_interval; + a value of 0 disables this altogether), repmgrd queries the pg_stat_replication system view and compares the nodes present there against the list of nodes registered with &repmgr; which should be attached to the primary. @@ -233,7 +239,7 @@ If the child_nodes_disconnect_command parameter is set in repmgr.conf, repmgrd will then loop through all child nodes. If it determines that insufficient child nodes are connected, and a - minimum of child_nodes_disconnect_timeout seconds (default: 30 + minimum of child_nodes_disconnect_timeout seconds (default: 30) has elapsed since the last node became disconnected, repmgrd will then execute the child_nodes_disconnect_command script. @@ -253,7 +259,8 @@ the criteria for its execution are met again. - The child_nodes_disconnect_command script will not be executed if repmgrd is paused. + The child_nodes_disconnect_command script will not be executed if + repmgrd is paused. @@ -266,7 +273,122 @@ - + + + + + Standby disconnections monitoring process example + + + + + + Standby disconnections monitoring process configuration + + + + + + Standby disconnections monitoring process event notifications + + The following event notifications may be generated: + + + + + + child_node_disconnect + event notification + + child_node_disconnect + + + This event is generated after repmgrd + detects that a child node is no longer streaming from the primary node. + + + Example: + +$ repmgr cluster event --event=child_node_disconnect + Node ID | Name | Event | OK | Timestamp | Details +---------+-------+-----------------------+----+---------------------+-------------------------------------------- + 1 | node1 | child_node_disconnect | t | 2019-04-24 12:41:36 | node "node3" (node ID: 3) has disconnected + + + + + + + child_node_reconnect + event notification + + child_node_reconnect + + + This event is generated after repmgrd + detects that a child node has resumed streaming from the primary node. + + + Example: + +$ repmgr cluster event --event=child_node_reconnect + Node ID | Name | Event | OK | Timestamp | Details +---------+-------+----------------------+----+---------------------+------------------------------------------------------------ +1 | node1 | child_node_reconnect | t | 2019-04-24 12:42:19 | node "node3" (node ID: 3) has reconnected after 42 seconds + + + + + + + child_node_new_connect + event notification + + child_node_new_connect + + + This event is generated after repmgrd + detects that a new child node has been registered with &repmgr; and has + connected to the primary. + + + Example: + +$ repmgr cluster event --event=child_node_new_connect + Node ID | Name | Event | OK | Timestamp | Details +---------+-------+------------------------+----+---------------------+--------------------------------------------- + 1 | node1 | child_node_new_connect | t | 2019-04-24 12:41:30 | new node "node3" (node ID: 3) has connected + + + + + + + child_nodes_disconnect_command + event notification + + child_nodes_disconnect_command + + + This event is generated after repmgrd detects + that sufficient child nodes have been disconnected for a sufficient amount + of time to trigger execution of the child_nodes_disconnect_command. + + + Example: + +$ repmgr cluster event --event=child_nodes_disconnect_command + Node ID | Name | Event | OK | Timestamp | Details +---------+-------+--------------------------------+----+---------------------+-------------------------------------------------------- + 1 | node1 | child_nodes_disconnect_command | t | 2019-04-24 13:08:17 | "child_nodes_disconnect_command" successfully executed + + + + + + + +