pgd raft show v6.4.0

Synopsis

The pgd raft show command displays Raft consensus information for the EDB Postgres Distributed cluster. By default, it displays three sections:

  • State: consensus state for all nodes, sourced from bdr.stat_raft_state.
  • Followers: follower state as seen from the leader node, sourced from bdr.stat_raft_followers_state.
  • Journal: global consensus journal details, sourced from bdr.global_consensus_journal_details.

Run the command without any of the section flags to display all three, or use --state, --followers, or --journal to display only that section. These flags are mutually exclusive.

Syntax

pgd raft show [OPTIONS]

Options

The following options are available for the pgd raft show command:

Section flags

ShortLongDescription
--stateShow only the State section (consensus state from bdr.stat_raft_state).
--followersShow only the Followers section (follower state from bdr.stat_raft_followers_state).
--journalShow only the Journal section (global journal details from bdr.global_consensus_journal_details).

These flags are mutually exclusive.

Section options

ShortLongApplies toDefaultDescription
--groupAll statesFilter output by group name.
-n--limit--journal20Limit the number of journal entries shown.

The tabular output displays a subset of available fields. Use --output json or --output markdown for the full field set.

See Global Options for common global options.

Examples

Show Raft state for all nodes

pgd raft show --state
Output
Group Name    Node Name State         Leader Name Term Commit Index Apply Index Last Log Index Is Voting Nodes Voting Nodes Protocol Version
------------- --------- ------------- ----------- ---- ------------ ----------- -------------- --------- ----- ------------ ----------------
dc1_subgroup  kaftan    RAFT_LEADER   kaftan      1    4            4           4              true      3     3            0
dc1_subgroup  kaboom    RAFT_FOLLOWER kaftan      1    4            4           4              true      3     3            0
dc1_subgroup  kaolin    RAFT_FOLLOWER kaftan      1    4            4           4              true      3     3            0
democluster   kaftan    RAFT_LEADER   kaftan      0    335          335         335            true      3     3            5007
democluster   kaboom    RAFT_FOLLOWER kaftan      0    335          335         335            true      3     3            5007
democluster   kaolin    RAFT_FOLLOWER kaftan      0    335          335         335            true      3     3            5007

In this output, dc1_subgroup is a data group with local routing, and democluster is the top-level group with global routing.

The Term column shows the current Raft term number. The Commit Index shows the index of the last committed log entry. Apply Index and Last Log Index show how far the node has applied and received log entries respectively. Is Voting indicates whether the node participates in Raft elections. Nodes shows the total number of nodes in the group. Voting Nodes shows the number of nodes that participate in Raft consensus. Protocol Version shows the version of the Raft protocol in use.

Show follower state for a specific group

pgd raft show --followers --group dc1_subgroup
Output
Group Name    Node Name Sent Commit Index Match Index Clock Drift (ms)
------------- --------- ---------------- ----------- ----------------
dc1_subgroup  kaboom    4                4           -2
dc1_subgroup  kaolin    4                3           5

Sent Commit Index is the commit index the leader last sent to each follower. Match Index is the highest log index confirmed replicated on that follower. Clock Drift (ms) is the approximate clock difference between the leader and follower in milliseconds.

Show journal entries with a custom limit

pgd raft show --journal --limit 5
Output
Group Name    Origin Log Index Term Message Type  Response Type
------------- ------ --------- ---- ------------- ---------------------------
democluster   kaftan 335       0    CONFIG_CHANGE CONFIG_CHANGE_RESPONSE
democluster   kaftan 334       0    CONFIG_CHANGE CONFIG_CHANGE_RESPONSE
democluster   kaftan 333       0    CONFIG_CHANGE CONFIG_CHANGE_RESPONSE
democluster   kaftan 332       0    CONFIG_CHANGE CONFIG_CHANGE_RESPONSE
democluster   kaftan 331       0    CONFIG_CHANGE CONFIG_CHANGE_RESPONSE

Show all sections for a specific group

pgd raft show --group dc1_subgroup
Output
# State
Group Name    Node Name State         Leader Name Term Commit Index Apply Index Last Log Index Is Voting Nodes Voting Nodes Protocol Version
------------- --------- ------------- ----------- ---- ------------ ----------- -------------- --------- ----- ------------ ----------------
dc1_subgroup  kaftan    RAFT_LEADER   kaftan      1    4            4           4              true      3     3            0
dc1_subgroup  kaboom    RAFT_FOLLOWER kaftan      1    4            4           4              true      3     3            0
dc1_subgroup  kaolin    RAFT_FOLLOWER kaftan      1    4            4           4              true      3     3            0

# Followers
Group Name    Node Name Sent Commit Index Match Index Clock Drift (ms)
------------- --------- ---------------- ----------- ----------------
dc1_subgroup  kaboom    4                4           -2
dc1_subgroup  kaolin    4                3           5

# Journal
Group Name    Origin Log Index Term Message Type  Response Type
------------- ------ --------- ---- ------------- ---------------------------
dc1_subgroup  kaftan 4         1    CONFIG_CHANGE CONFIG_CHANGE_RESPONSE
dc1_subgroup  kaftan 3         1    CONFIG_CHANGE CONFIG_CHANGE_RESPONSE
dc1_subgroup  kaftan 2         1    CONFIG_CHANGE CONFIG_CHANGE_RESPONSE