pgd replication show
====================

Synopsis
--------

The ``pgd replication show`` command is used to display the replication
status in the EDB Postgres Distributed cluster.

By default, with no options, it produces reports on the following:

- Node Replication Progress: A matrix of the replication status between
  nodes.

- Replication Slots: The replication slots status for each node’s slots.

- Subscriptions: The subscription status for each subscription between
  nodes.

- Analytics Replication: The analytics replication status for each node.

Options can be used to restrict the output to any one of the above
reports. The ``--verbose`` option can be used to increase the detail in
the default report to show the LSN and the replication lag for each
node’s connection to other nodes.

Users and roles
^^^^^^^^^^^^^^^

Requires the ``bdr_monitor`` role or higher. See :ref:`User roles <User roles>`  .

Syntax
------

.. code:: plaintext

   pgd replication show [OPTIONS]

Options
-------

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

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

  "",--nodes,Display only node to node replication status in a matrix format.
  "",--slots,Display the replication slots for each node.
  "",--subscriptions,Display the subscription status for each subscription between nodes.
  "",--analytics,Display the analytics replication status for each node.
  -v,--verbose,Display detailed information about the replication status.

See the :ref:`Global Options <Global Options>`  for common global options.

–slots
^^^^^^

This shows Shows the status of BDR replication slots. Output with the
verbose flag gives details such as is slot active, replication state
(disconnected, streaming, catchup), and approximate lag.

.. csv-table::
  :header: Symbol,Meaning
  :widths: 10,30
  :align: left
  :class: longtable

  `*`,ok
  `~`,warning (lag > 10M)
  `!`,critical (lag > 100M OR slot is 'inactive' OR 'disconnected')
  `x`,down / unreachable
  `-`,n/a

In matrix view, sometimes byte lag is shown in parentheses. It is
maxOf(WriteLag, FlushLag, ReplayLag, SentLag).

Examples
--------

Display the replication status in the EDB Postgres Distributed cluster
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code:: shell

   pgd replication show
   __OUTPUT__

   #  Node Replication Progress

   Node   kaboom kaftan kaolin
   - ----- ------ ------ ------
   kaboom -      *      *     
   kaftan *      -      *     
   kaolin *      *      -     

   #  Replication Slots

   Group Name   Origin Node Target Node Slot Name                      Active State     Write Lag Replay Lag Sent Lag Bytes Write Lag Bytes Replay Lag Bytes
   - ----------- ----------- ----------- ------------------------------ ------ --------- --------- ---------- -------------- --------------- ----------------
   dc1_subgroup kaboom      kaftan      bdr_pgddb_democluster15_kaftan t      streaming 00:00:00  00:00:00   0              0               0               
   dc1_subgroup kaboom      kaolin      bdr_pgddb_democluster15_kaolin t      streaming 00:00:00  00:00:00   0              0               0               
   dc1_subgroup kaftan      kaboom      bdr_pgddb_democluster15_kaboom t      streaming 00:00:00  00:00:00   0              0               0               
   dc1_subgroup kaftan      kaolin      bdr_pgddb_democluster15_kaolin t      streaming 00:00:00  00:00:00   0              0               0               
   dc1_subgroup kaolin      kaboom      bdr_pgddb_democluster15_kaboom t      streaming 00:00:00  00:00:00   0              0               0               
   dc1_subgroup kaolin      kaftan      bdr_pgddb_democluster15_kaftan t      streaming 00:00:00  00:00:00   0              0               0               

   #  Subscriptions

   Origin Node Target Node Last Applied Tx Timestamp      Last Applied Tx Age Subscription Status
   - ---------- ----------- ------------------------------ ------------------- -------------------
   kaboom      kaftan      2025-02-21 19:18:12.661520 UTC 00:00:18.616        replicating        
   kaboom      kaolin      2025-02-21 19:18:12.661520 UTC 00:00:18.939        replicating        
   kaftan      kaboom      2025-02-21 19:18:12.658069 UTC 00:00:18.787        replicating        
   kaftan      kaolin      2025-02-21 19:18:12.658069 UTC 00:00:18.943        replicating        
   kaolin      kaboom      2025-02-21 19:18:12.663201 UTC 00:00:18.782        replicating        
   kaolin      kaftan      2025-02-21 19:18:12.663201 UTC 00:00:18.614        replicating        

   #  Analytics Replication Progress

   Origin Node Replicating Node Replicated LSN Last Updated
   - ---------- ---------------- -------------- ------------

Display only the node to node replication status in a matrix format
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code:: shell

   pgd replication show --nodes
   __OUTPUT__
   Node   kaboom kaftan kaolin
   - ----- ------ ------ ------
   kaboom -      *      *     
   kaftan *      -      *     
   kaolin *      *      -   
