pgd raft show
=============

Synopsis
--------

The ``pgd raft show`` command is used to display the Raft status in the
EDB Postgres Distributed cluster. In particular, it lists all nodes in
all groups, including the top level group, and their Raft status -
leader or follower, number of nodes in the group with them, number of
voting nodes in the group, presence of a leader, and the term number.

Syntax
------

.. code:: plaintext

   pgd raft show [OPTIONS]

Options
-------

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

.. csv-table::
  :header: Short,Long,Description
  :widths: 12,25,15
  :align: left
  :class: longtable

  "",--group,Filter by group name.

See `Global Options <https://www.enterprisedb.com/docs/pgd/latest/reference/cli/command_ref/#global-options>`_  for common global options.

Examples
--------

Show Raft status
^^^^^^^^^^^^^^^^

.. code:: shell

   pgd raft show
   __OUTPUT__
   Group Name    Node Name State         Leader Name Current Term Commit Index Nodes Voting Nodes Protocol Version
   - ------------ --------- ------------- ----------- ------------ ------------ ----- ------------ ----------------
   dc1_subgroup  kaftan    RAFT_LEADER   kaftan      1            4            3     3            0
   dc1_subgroup  kaboom    RAFT_FOLLOWER kaftan      1            4            3     3            0
   dc1_subgroup  kaolin    RAFT_FOLLOWER kaftan      1            4            3     3            0
   democluster   kaftan    RAFT_LEADER   kaftan      0            335          3     3            5007
   democluster   kaboom    RAFT_FOLLOWER kaftan      0            335          3     3            5007
   democluster   kaolin    RAFT_FOLLOWER kaftan      0            335          3     3            5007

Note that ``dc1_subgroup`` here is a data group with local routing, and
``democluster`` is the top level group with global routing.

The ``Protocol Version`` column shows the version of the Raft protocol
in use. The ``Commit Index`` column shows the index of the last
committed log entry. The ``Nodes`` column shows the total number of
nodes in the group. The ``Voting Nodes`` column shows the number of
nodes that participate in the Raft consensus. The ``State`` column shows
the Raft state of the node - leader or follower. The ``Leader Name``
column shows the name of the leader node in the group. The
``Current Term`` column shows the current term number.

Show Raft status for a specific group
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code:: shell

   pgd raft show --group dc1_subgroup
   __OUTPUT__
   Group Name    Node Name State         Leader Name Current Term Commit Index Nodes Voting Nodes Protocol Version
   - ------------ --------- ------------- ----------- ------------ ------------ ----- ------------ ----------------
   dc1_subgroup  kaftan    RAFT_LEADER   kaftan      1            4            3     3            0
   dc1_subgroup  kaboom    RAFT_FOLLOWER kaftan      1            4            3     3            0
   dc1_subgroup  kaolin    RAFT_FOLLOWER kaftan      1            4            3     3            0
