Monitoring through pgd-cli v6.5.1

Use pgd-cli to check a PGD cluster's health, topology, and replication status quickly, without writing SQL. Install and configure it as described in Installing pgd-cli and Configuring pgd-cli.

See Command reference, for all command options, output formats, and the required user role.

Tip

Most show and list commands also accept -o json to get the same information as JSON, for scripting. Their table output also pipes into standard Unix tools like grep to filter or search it.

Checking cluster health

Check node connectivity, Raft consensus, replication slot status, clock drift, and version consistency across the cluster with pgd cluster show --health:

pgd cluster show --health
Output
# Health
Check             Status Details                                        
----------------- ------ -----------------------------------------------
Connections       Ok     All BDR nodes are accessible                   
Raft              Ok     Raft Consensus is working correctly            
Replication Slots Ok     All PGD replication slots are working correctly
Clock Drift       Ok     Clock drift is within permissible limit        
Versions          Ok     All nodes are running the same PGD version     

Run pgd cluster show without options for a combined summary, health, and clock drift report, or add --clock-drift for clock drift alone. See its reference page for the full list of options and status symbols.

Use pgd cluster verify to check configuration and architecture rather than runtime health. It checks Postgres settings and cluster architecture, such as whether each data group has at most one witness node, against PGD's requirements:

pgd cluster verify
Output
# Architecture
 Check                       | Status | Groups 
-----------------------------+--------+--------
 Cluster has data nodes      | Ok     |        
 Max data nodes in a cluster | Ok     |        
 Witness nodes per group     | Ok     |        
 Witness-only groups         | Ok     |        
 Data nodes per group        | Ok     |        
 Routing enabled groups      | Ok     |        
 Empty groups                | Ok     |        
 Nodes have node kind set    | Ok     |        

# Settings
 Setting Name                     | Status   
----------------------------------+----------
 bdr.accept_connections           | Ok       
 bdr.ddl_locking                  | Ok       
 bdr.max_writers_per_subscription | Ok       
 bdr.raft_group_max_connections   | Ok       
 bdr.replay_progress_frequency    | Ok       
 bdr.role_replication             | Ok       
 bdr.start_workers                | Ok       
 bdr.writers_per_subscription     | Ok       
 max_connections                  | Ok       
 max_prepared_transactions        | Ok       
 max_replication_slots            | Ok       
 max_wal_senders                  | Ok       
 max_worker_processes             | Critical 
 shared_preload_libraries         | Ok       
 track_commit_timestamp           | Ok       
 wal_level                        | Ok       

A Critical status flags a setting or architecture check that doesn't meet PGD's requirements and needs attention. Add --verbose for specific advice on fixing each failing check.

Viewing cluster topology

Check how a cluster's groups and nodes are laid out, to confirm a change landed correctly or to get your bearings on a cluster you didn't build yourself.

Listing groups

List every group in the cluster with pgd groups list:

pgd groups list
Output
  Group Name  Parent Group Name Group Type     Nodes          
  ---------- ----------------- --------------- -----
  bdrgroup   bdrgroup          global          0
  group_a    bdrgroup          data            4
  group_b    bdrgroup          data            4    
  group_c    bdrgroup          data            1
  group_so   bdrgroup          subscriber-only 1

Listing nodes

List every node in the cluster with pgd nodes list:

pgd nodes list
Output
  Node Name           Group Name Node Kind       Join State Node Status
  ------------------- ---------- --------------- ---------- -----------          
  bdr-a1              group_a    data            ACTIVE     Up
  bdr-a2              group_a    data            ACTIVE     Up     
  logical-standby-a1  group_a    standby         ACTIVE     Up
  witness-a           group_a    witness         ACTIVE     Up
  bdr-b1              group_b    data            ACTIVE     Up
  bdr-b2              group_b    data            ACTIVE     Up
  logical-standby-b1  group_b    standby         ACTIVE     Up
  witness-b           group_b    witness         ACTIVE     Up
  witness-c           group_c    witness         ACTIVE     Up
  subscriber-only-c1  group_so   subscriber-only ACTIVE     Up 

Showing a single node

Run pgd node <node_name> show to display the properties and routing options for one node:

pgd node kaboom show
Output
# Summary
Node Property   Value       
--------------- ------------
Node Name       kaboom      
Group Name      dc1_subgroup
Node Kind       data        
Join State      ACTIVE      
Node Status     Up          
Node ID         2710197610  
Snowflake SeqID 2           
Database        pgddb       

# Options
Option Name    Option Value                                     
-------------- -------------------------------------------------
route_dsn      host=kaboom port=5444 dbname=pgddb user=postgres 
route_fence    false                                            
route_priority 100                                              
route_reads    true                                             
route_writes   true   

Monitoring replication

Run pgd replication show to get node-to-node replication progress, replication slot status, subscription status, and analytics replication status, all in one command:

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               

# 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        

# Analytics Replication Progress
Origin Node Replicating Node Replicated LSN Last Updated
----------- ---------------- -------------- ------------

Restrict the report to one section with --nodes, --slots, --subscriptions, or --analytics, and add --verbose for LSN positions and per-connection lag. See pgd replication show for the status symbols and their thresholds.

The Analytics Replication Progress section tracks how far each node's replication to analytics has progressed.

Monitoring Raft consensus

Run pgd raft show to check Raft consensus state, follower state, and the consensus journal:

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

Raft consensus is healthy when every node reports a valid state, RAFT_LEADER or RAFT_FOLLOWER, exactly one node in each group is the leader, and every follower's Leader Name matches that leader. Use --followers to see how far behind each follower is, and --journal to inspect recent consensus log entries. See pgd raft show for details.

Reviewing cluster events

Run pgd events show to list the most recent node and group lifecycle events, such as joins, parts, and routing leader changes:

pgd events show -n 5

Filter the list with --node or --group, and raise --limit (or -n) beyond the default of 20 events to look further back. See Node states for what each event's state means.