replication show slots v5.6

Shows the status of BDR replication slots

Synopsis

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.

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

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

pgd replication show slots [flags]

Options

FlagFlag, long          ValueDescription
--verboseVerbose mode - provides mode detailed information

Examples

In a cluster with a node down

In this example, there is a 3 node cluster, bdr-a1 and bdr-c1 are up, bdr-b1 is down.

  $ pgd replication show slots
Output
  Node   bdr-a1 bdr-b1  bdr-c1
  ----   ------ ------  ------
  bdr-a1 *      !(6.6G) *
  bdr-b1 x      *       x
  bdr-c1 *      !(6.9G) *

Or you can use the verbose flag to get more details.

  $ pgd replication show slots --verbose
Output
  Origin Node Target Node Status (active/state) Write Lag (bytes/duration)    Flush Lag (bytes/duration)    Replay Lag (bytes/duration)   Sent Lag (bytes)
  ----------- ----------- --------------------- --------------------------    --------------------------    ---------------------------   ----------------
  bdr-a1      bdr-b1      f / disconnected      6.6G / 8 days 02:58:36.243723 6.6G / 8 days 02:58:36.243723 6.6G / 8 days 02:58:36.243723 6.6G
  bdr-a1      bdr-c1      t / streaming         0B / 00:00:00                 0B / 00:00:00                 0B / 00:00:00                 0B
  bdr-c1      bdr-a1      t / streaming         0B / 00:00:00.000812          0B / 00:00:00.000812          0B / 00:00:00.000812          0B
  bdr-c1      bdr-b1      f / disconnected      6.9G / 8 days 02:58:36.004415 6.9G / 8 days 02:58:36.004415 6.9G / 8 days 02:58:36.004415 6.9G

In a restarted cluster

In this example, there is a 3 node cluster. Node bdr-b1 was down and it has just been restarted.

  $ pgd replication show slots
Output
  Node   bdr-a1 bdr-b1  bdr-c1
  ----   ------ ------  ------
  bdr-a1 *      !(6.9G) *
  bdr-b1 *      *       *
  bdr-c1 *      !(5.8G) *

The verbose flag gives more details.

  $ pgd replication show slots --verbose
Output
  Origin Node Target Node Status (active/state) Write Lag (bytes/duration) Flush Lag (bytes/duration) Replay Lag (bytes/duration) Sent Lag (bytes)
  ----------- ----------- --------------------- -------------------------- -------------------------- --------------------------- ----------------
  bdr-a1      bdr-b1      t / catchup           6.9G / 00:00:00.000778     6.9G / 00:00:00.000778     6.9G / 00:00:00.000778      6.9G
  bdr-a1      bdr-c1      t / streaming         0B / 00:00:00.104121       0B / 00:00:00.104133       0B / 00:00:00.104133        0B
  bdr-b1      bdr-a1      t / streaming         0B / 00:00:00              0B / 00:00:00              0B / 00:00:00               0B
  bdr-b1      bdr-c1      t / streaming         0B / 00:00:00              0B / 00:00:00              0B / 00:00:00               0B
  bdr-c1      bdr-a1      t / streaming         6.8K / 00:00:00            6.8K / 00:00:00            6.8K / 00:00:00             6.8K
  bdr-c1      bdr-b1      t / catchup           5.5G / 00:00:00.008257     5.5G / 00:00:00.008257     5.5G / 00:00:00.008257      5.5G

In a streaming cluster

In this example, there is a 3 node cluster, all nodes are up and in 'streaming' state.

  $ pgd replication show slots
Output
  Node   bdr-a1 bdr-b1 bdr-c1
  ----   ------ ------ ------
  bdr-a1 *      *      *
  bdr-b1 *      *      *
  bdr-c1 *      *      *

The verbose flag gives more details.

  $ pgd replication show slots --verbose
Output
  Origin Node Target Node Status (active/state) Write Lag (bytes/duration) Flush Lag (bytes/duration) Replay Lag (bytes/duration) Sent Lag (bytes)
  ----------- ----------- --------------------- -------------------------- -------------------------- --------------------------- ----------------
  bdr-a1      bdr-b1      t / streaming         0B / 00:00:00              0B / 00:00:00              0B / 00:00:00               0B
  bdr-a1      bdr-c1      t / streaming         0B / 00:00:00              0B / 00:00:00              0B / 00:00:00               0B
  bdr-b1      bdr-a1      t / streaming         0B / 00:00:00              0B / 00:00:00              0B / 00:00:00               0B
  bdr-b1      bdr-c1      t / streaming         0B / 00:00:00              0B / 00:00:00              0B / 00:00:00               0B
  bdr-c1      bdr-a1      t / streaming         0B / 00:00:00              528B / 00:00:00            528B / 00:00:00             0B
  bdr-c1      bdr-b1      t / streaming         528B / 00:00:00            528B / 00:00:00            528B / 00:00:00             0B

With other node types

In this example the cluster has witness, logical standby and subscriber-only nodes. Upstream for logical-standby-a1 is bdr-a1 and logical-standby-b1 is bdr-b1.

  • A logical standby is sent data only by one source node, but no other nodes receive replication changes from it.
  • A Subscriber-only node subscribes to replication changes from other nodes in the cluster, but no other nodes receive replication changes from it.
  $ pgd replication show slots
Output
  Node               bdr-a1 bdr-b1 logical-standby-a1 logical-standby-b1 subscriber-only-c1 witness-c1
  ----               ------ ------ ------------------ ------------------ ------------------ ----------
  bdr-a1             *      *      *                  -                  *                  *
  bdr-b1             *      *      -                  *                  *                  *
  logical-standby-a1 -      -      *                  -                  -                  -
  logical-standby-b1 -      -      -                  *                  -                  -
  subscriber-only-c1 -      -      -                  -                  *                  -
  witness-c1         *      *      -                  -                  *                  *