Skip to main content
You can monitor a stream using: When you complete a , there will be a gap in the primary cluster’s metrics whether you are monitoring via the DB Console or Prometheus. The standby cluster will also require separate monitoring to ensure observability during the failover period. You can use the DB console to track the relevant metrics, or you can use a tool like to create two separate dashboards, one for each cluster, or a single dashboard with data from both clusters.

SQL Shell

In the standby cluster’s SQL shell, you can query SHOW VIRTUAL CLUSTER... WITH REPLICATION STATUS for detail on status and timestamps for planning :
Refer to Responses for a description of each field.

Responses

FieldResponse
idThe ID of a virtual cluster.
nameThe name of the standby (destination) virtual cluster.
data\_stateThe state of the data on a virtual cluster. This can show one of the following: initializing replication, ready, replicating, replication paused, replication pending failover, replication failing over, replication error. Refer to Data state for more detail on each response.
service\_modeThe service mode shows whether a virtual cluster is ready to accept SQL requests. This can show none or shared. When shared, a virtual cluster’s SQL connections will be served by the same nodes that are serving the system virtual cluster.
source\_tenant\_nameThe name of the primary (source) virtual cluster.
source\_cluster\_uriThe URI of the primary (source) cluster. The standby cluster connects to the primary cluster using this URI when .
replicated\_timeThe latest timestamp at which the standby cluster has consistent data — that is, the latest time you can fail over to. This time advances automatically as long as the replication proceeds without error. replicated\_time is updated periodically (every 30s).
retained\_timeThe earliest timestamp at which the standby cluster has consistent data — that is, the earliest time you can fail over to.
replication\_lagThe time between the most up-to-date replicated time and the actual time. Refer to the for more detail.
failover\_timeThe time at which the failover will begin. This can be in the past or the future. Refer to .
statusThe status of the replication stream. This can show one of the following: initializing replication, ready, replicating, replication paused, replication pending failover, replication failing over, replication error. Refer to Data state for more detail on each response.
capability\_nameThe name.
capability\_valueWhether the is enabled for a virtual cluster.

Data state

StateDescription
add() The is waiting for the PCR job’s initial scan to complete, then readonly will be available for read queries.
initializing replicationThe replication job is completing the initial scan of data from the primary cluster before it starts replicating data in real time.
readyA virtual cluster’s data is ready for use. The readonly virtual cluster is ready to serve read queries.
replicatingThe replication job has started and is replicating data.
replication pausedThe replication job is paused due to an error or a manual request with .
replication pending failoverThe replication job is running and the failover time has been set. Once the the replication reaches the failover time, the failover will begin automatically.
replication failing overThe job has started failing over. The failover time can no longer be changed. Once failover is complete, a virtual cluster will be available for use with .
replication errorAn error has occurred. You can find more detail in the error message and the . Note: A PCR job will retry for 3 minutes before failing.

DB Console

You can use the of the standby cluster’s to monitor:

Prometheus

You can use Prometheus and Alertmanager to track and alert on PCR metrics. Refer to the tutorial for steps to set up Prometheus. We recommend tracking the following metrics:
  • physical_replication.logical_bytes: The logical bytes (the sum of all keys and values) ingested by all PCR jobs.
  • physical_replication.replicated_time_seconds: The of the physical replication stream in seconds since the Unix epoch.

Data verification

This feature is in and subject to change. To share feedback and/or issues, contact Support.
The SHOW EXPERIMENTAL_FINGERPRINTS statement verifies that the data transmission and ingestion is working as expected while a replication stream is running. Any checksum mismatch likely represents corruption or a bug in CockroachDB. SHOW EXPERIMENTAL_FINGERPRINTS is only to verify data. Should you encounter such a mismatch, contact Support. To verify that the data at a certain point in time is correct on the standby cluster, you can use the from the replication job information to run a point-in-time fingerprint on both the primary and standby clusters. This will verify that the transmission and ingestion of the data on the standby cluster, at that point in time, is correct.
  1. Retrieve the current replicated time of the replication job on the standby cluster with :
    For detail on connecting to the standby cluster, refer to .
  2. From the primary cluster’s system virtual cluster, specify a timestamp at or earlier than the current replicated_time to retrieve the fingerprint. This example uses the current replicated_time:
    For detail on connecting to the primary cluster, refer to .
  3. From the standby cluster’s system virtual cluster, specify the same timestamp used on the primary cluster to retrieve the standby cluster’s fingerprint:
  4. Compare the fingerprints of the primary and standby clusters to verify the data. The same value for the fingerprints indicates the data is correct.

See also