pgd raft show#
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.
Users and roles#
Requires the bdr_monitor role or higher. See User roles .
Syntax#
pgd raft show [OPTIONS]
Options#
The following options are available for the pgd raft show command:
Section flags#
Short |
Long |
Description |
|---|---|---|
--state |
Show only the State section (consensus state from bdr.stat_raft_state). |
|
--followers |
Show only the Followers section (follower state from bdr.stat_raft_followers_state). |
|
--journal |
Show only the Journal section (global journal details from bdr.global_consensus_journal_details). |
These flags are mutually exclusive.
Section options#
Short |
Long |
Applies to |
Default |
Description |
|---|---|---|---|---|
--group |
All states |
Filter output by group name. |
||
-n |
--limit |
--journal |
20 |
Limit the number of journal entries shown. |
The tabular output displays a subset of available fields; leader_id
, voted_for_id , and node_id are included only in the full field
set. 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