Logical data replication is only supported in CockroachDB self-hosted clusters.
SHOW LOGICAL REPLICATION JOBSin the SQL shell to view a list of LDR jobs on the cluster.- The Logical Data Replication dashboard on the DB Console to view metrics at the cluster level.
- Prometheus and Alertmanager to track and alert on LDR metrics.
- Metrics export with Datadog.
- Metrics labels to view metrics at the job level.
- The history retention job on the source cluster, which runs while the LDR job is active to protect changes in the table from garbage collection until they have been applied to the destination cluster. The history retention job is viewable in the DB Console or with
SHOW JOBS. Any manual changes to the history retention job could disrupt the LDR job. - The
logical replicationjob on the destination cluster. You can view the status of this job in the SQL shell withSHOW LOGICAL REPLICATION JOBSand the DB Console Jobs page.
SQL shell
In the destination cluster’s SQL shell, you can querySHOW LOGICAL REPLICATION JOBS to view the LDR jobs running on the cluster:
WITH details option:
SHOW JOBS for general job details.
Responses
Recommended LDR metrics to track
- Replication latency: The commit-to-commit replication latency, which is tracked from when a row is committed on the source cluster, to when it is applied on the destination cluster. An LDR commit is when the job either applies a row successfully to the destination cluster or adds a row to the dead letter queue (DLQ).
logical_replication.commit_latency-p50logical_replication.commit_latency-p99
- Replication lag: How far behind the source cluster is from the destination cluster at a specific point in time. The replication lag is equivalent to RPO during a disaster. Calculate the replication lag with this metric. For example,
time.now() - replicated_time_seconds.logical_replication.replicated_time_seconds
- Row updates applied: These metrics indicate whether the destination cluster is actively receiving and applying data from the source cluster.
logical_replication.events_ingestedlogical_replication.events_dlqed
DB Console
In the DB Console, you can use:- The Metrics dashboard for LDR to view metrics for the job on the destination cluster.
- The Jobs page to view the history retention job on the source cluster and the LDR job on the destination cluster
Metrics dashboard
You can use the Logical Data Replication dashboard of the destination cluster to monitor the following metric graphs at the cluster level:- Replication latency
- Replication lag
- Row updates applied
- Logical bytes received
- Batch application processing time: 50th percentile
- Batch application processing time: 99th percentile
- DLQ causes
- Retry queue size
Jobs page
On the Jobs page, select:- The Replication Producer in the source cluster’s DB Console to view the history retention job.
- The Logical Replication Ingestion job in the destination cluster’s DB Console. When you start LDR, the Logical Replication Ingestion job will show a bar that tracks the initial scan progress of the source table’s existing data.
Monitoring and alerting
Prometheus
You can use Prometheus and Alertmanager to track and alert on LDR metrics. Refer to the Monitor CockroachDB with Prometheus tutorial for steps to set up Prometheus.Metrics labels
To view metrics at the job level, you can use thelabel option when you start LDR to add a metrics label to the LDR job. This enables child metric export, which are Prometheus time series with extra labels. You can track the following metrics for an LDR job with labels:
logical_replication.catchup_ranges_by_labellogical_replication.events_dlqed_by_labellogical_replication.events_ingested_by_labellogical_replication.replicated_time_by_labellogical_replication.scanning_ranges_by_label
label option:

