Skip to content

Commit 7953270

Browse files
Added preview notice and backported to missing versions (#21194)
* Added notice and backport Added preview notice and backported to missing versions * Changed language in feature availability page Changed language in feature availability page
1 parent c4114c0 commit 7953270

File tree

10 files changed

+230
-8
lines changed

10 files changed

+230
-8
lines changed

src/current/_includes/v24.3/sidebar-data/cross-cluster-replication.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@
6464
"/${VERSION}/physical-cluster-replication-monitoring.html"
6565
]
6666
},
67+
{
68+
"title": "Read From Standby",
69+
"urls": [
70+
"/${VERSION}/read-from-standby.html"
71+
]
72+
},
6773
{
6874
"title": "Technical Overview",
6975
"urls": [

src/current/_includes/v25.2/sidebar-data/cross-cluster-replication.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@
6464
"/${VERSION}/physical-cluster-replication-monitoring.html"
6565
]
6666
},
67+
{
68+
"title": "Read From Standby",
69+
"urls": [
70+
"/${VERSION}/read-from-standby.html"
71+
]
72+
},
6773
{
6874
"title": "Technical Overview",
6975
"urls": [

src/current/v24.3/cockroachdb-feature-availability.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ The [`VECTOR`]({% link {{ page.version.version }}/vector.md %}) data type stores
7979

8080
**Logical data replication (LDR)** continuously replicates tables between active CockroachDB clusters. Both source and destination cluster can receive application reads and writes, with LDR enabling bidirectional replication for eventual consistency in the replicating tables. The active-active setup between clusters can provide protection against cluster, datacenter, or region failure while still achieving single-region low latency reads and writes in the individual CockroachDB clusters. Setting up LDR between a source and destination CockroachDB {{ site.data.products.core }} cluster is in preview.
8181

82-
### Read on standby cluster in physical cluster replication (PCR) for CockroachDB {{ site.data.products.core }}
82+
### Read from standby in physical cluster replication (PCR) for CockroachDB {{ site.data.products.core }}
8383

84-
The [`READ VIRTUAL CLUSTER`]({% link {{ page.version.version }}/create-virtual-cluster.md %}#options) option allows you to set up a PCR stream that also creates a read-only virtual cluster on the standby cluster. You can create a PCR job as per the [Set Up Physical Cluster Replication]({% link {{ page.version.version }}/set-up-physical-cluster-replication.md %}) guide and then add the option to the [`CREATE VIRTUAL CLUSTER`]({% link {{ page.version.version }}/create-virtual-cluster.md %}) statement.
84+
The [`READ VIRTUAL CLUSTER`]({% link {{ page.version.version }}/create-virtual-cluster.md %}#options) option allows you to set up a PCR stream that also creates a [read-only virtual cluster]({% link {{ page.version.version }}/read-from-standby.md %}) on the standby cluster. You can create a PCR job as per the [Set Up Physical Cluster Replication]({% link {{ page.version.version }}/set-up-physical-cluster-replication.md %}) guide and then add the option to the [`CREATE VIRTUAL CLUSTER`]({% link {{ page.version.version }}/create-virtual-cluster.md %}) statement.
8585

8686
### Custom Metrics Chart page for CockroachDB {{ site.data.products.cloud }} clusters
8787

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
title: Read from Standby
3+
summary: Direct read-only queries to your standby cluster instead of your primary cluster.
4+
toc: true
5+
docs_area: manage
6+
---
7+
8+
{{site.data.alerts.callout_info}}
9+
{% include feature-phases/preview.md %}
10+
{{site.data.alerts.end}}
11+
12+
In addition to providing [failover]({% link {{ page.version.version }}/failover-replication.md %}) capabilities for [disaster recovery]({% link {{ page.version.version }}/disaster-recovery-overview.md %}), [**physical cluster replication (PCR)**]({% link {{ page.version.version }}/physical-cluster-replication-overview.md %}) allows you to direct read-only queries to your standby cluster. This process offloads traffic such as application reads, analytics queries, and ad-hoc reporting from the primary cluster.
13+
14+
Use this page to understand how the _read from standby_ feature works and how to utilize it.
15+
16+
## How the read from standby feature works
17+
18+
PCR utilizes [cluster virtualization]({% link {{ page.version.version }}/cluster-virtualization-overview.md %}) to separate a cluster's control plane from its data plane. A cluster always has one control plane, called a _system virtual cluster (system VC)_, and at least one data plane, called an _App Virtual Cluster (app VC)_. The standby cluster's system VC manages the PCR job and other cluster metadata, and is not used for application queries. All data tables, system tables, and cluster settings in the standby cluster's app VC are identical to the primary cluster's app VC. The standby cluster's app VC itself remains offline during replication.
19+
20+
When using read from standby, applications can read from the standby cluster, but they do not connect directly to the standby cluster's app VC. Instead, PCR introduces a _reader virtual cluster (reader VC)_. The reader VC ensures a clean, isolated environment specifically for serving read queries without interfering with replication or system metadata. It reads continuously from the standby cluster's app VC using internal pointers, providing access to the replicated data while keeping the app VC offline. The reader VC itself only stores a small amount of metadata and no user data, so it is not expected to take up additional storage space.
21+
22+
The standby cluster's reader VC has its own system tables and [cluster settings]({% link {{ page.version.version }}/cluster-settings.md %}). The reader VC replicates a subset of system tables, including **Users** and **Roles**, from the app VC, so that existing primary users can authenticate using the same [users and roles]({% link {{ page.version.version }}/security-reference/authorization.md %}) as on the primary cluster's app VC. Other system tables and cluster settings are set to defaults in the reader VC. For more information, consult [Physical Cluster Replication Technical Overview]({% link {{ page.version.version }}/physical-cluster-replication-technical-overview.md %}).
23+
24+
In the event of failover, the reader VC's response depends on the type of failover. After failover to the latest timestamp, the reader VC continues pointing to the app VC but stops receiving updates. After failover to a point-in-time timestamp, the reader VC is destroyed.
25+
26+
## Use the read from standby feature
27+
### Before you begin
28+
29+
Prior to setting up read from standby, ensure that:
30+
31+
- You have already configured PCR between a _primary_ cluster and a _standby_ cluster. For information on configuring PCR, refer to [Set Up Physical Cluster Replication]({% link {{ page.version.version }}/set-up-physical-cluster-replication.md %}).
32+
- Your CockroachDB version is v24.3 or later. The `read from standby` option is not supported in earlier versions.
33+
34+
### Start a PCR stream with read from standby
35+
36+
To start a PCR stream that allows read access to the standby cluster, use the [`CREATE VIRTUAL CLUSTER ... REPLICATION`]({% link {{ page.version.version }}/create-virtual-cluster.md %}) statement with the `READ VIRTUAL CLUSTER` option:
37+
38+
{% include_cached copy-clipboard.html %}
39+
~~~ sql
40+
CREATE VIRTUAL CLUSTER main FROM REPLICATION OF main ON 'postgresql://{connection string to primary}' WITH READ VIRTUAL CLUSTER;
41+
~~~
42+
43+
### Add read from standby to a PCR stream
44+
45+
To add read from standby capabilities to an existing PCR stream, use the [`ALTER VIRTUAL CLUSTER`]({% link {{ page.version.version }}/alter-virtual-cluster.md %}) statement:
46+
47+
{% include_cached copy-clipboard.html %}
48+
~~~ sql
49+
ALTER VIRTUAL CLUSTER main SET REPLICATION READ VIRTUAL CLUSTER;
50+
~~~
51+
52+
{{site.data.alerts.callout_info}}
53+
The standby cluster's app VC must have a status of `replicating` before you can create your reader VC. Use the [`SHOW VIRTUAL CLUSTERS`]({% link {{ page.version.version }}/show-virtual-cluster.md %}) command to check the status of the app VC.
54+
{{site.data.alerts.end}}
55+
56+
### Check the status of your reader virtual cluster
57+
58+
To confirm that your reader virtual cluster is active:
59+
60+
{% include_cached copy-clipboard.html %}
61+
~~~ sql
62+
SHOW VIRTUAL CLUSTERS;
63+
~~~
64+
65+
The output shows a `standby-readonly` virtual cluster in addition to the system VC and app VC:
66+
67+
~~~
68+
id | name | data_state | service_mode
69+
-----+------------------+-------------+---------------
70+
1 | system | ready | shared
71+
3 | standby | replicating | none
72+
4 | standby-readonly | ready | shared
73+
~~~
74+
75+
{{site.data.alerts.callout_info}}
76+
The reader VC cannot serve reads until after the PCR initial scan is complete. After completing the initial scan, wait until the reader VC's `service_mode` is `shared`, then wait about one minute before connecting to the reader VC.
77+
{{site.data.alerts.end}}
78+
79+
### Run read-only queries on the standby cluster
80+
81+
Once you have created a reader virtual cluster on the standby cluster, you can connect to it and run [read (`SELECT`) queries]({% link {{ page.version.version }}/selection-queries.md %}). For example:
82+
83+
{% include_cached copy-clipboard.html %}
84+
~~~ sql
85+
SELECT COUNT(*) FROM customers;
86+
SELECT region, SUM(amount) FROM orders GROUP BY region;
87+
~~~
88+
89+
The results of queries on the standby cluster reflect the state of the primary cluster as of a historical time that approaches the [replicated time]({% link {{ page.version.version }}/show-virtual-cluster.md %}#show-replication-status).
90+
91+
{{ site.data.alerts.callout_info }}
92+
Write operations are not permitted on the standby cluster.
93+
{{ site.data.alerts.end }}
94+
95+
## See also
96+
- [Set Up Physical Cluster Replication]({% link {{ page.version.version }}/set-up-physical-cluster-replication.md %})
97+
- [Fail Over from a Primary Cluster to a Standby Cluster]({% link {{ page.version.version }}/failover-replication.md %})
98+
- [Physical Cluster Replication Technical Overview]({% link {{ page.version.version }}/physical-cluster-replication-technical-overview.md %})
99+
- [`CREATE VIRTUAL CLUSTER`]({% link {{ page.version.version }}/create-virtual-cluster.md %})
100+
- [`ALTER VIRTUAL CLUSTER`]({% link {{ page.version.version }}/alter-virtual-cluster.md %})
101+
- [`SHOW VIRTUAL CLUSTER`]({% link {{ page.version.version }}/show-virtual-cluster.md %})

src/current/v25.2/cockroachdb-feature-availability.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ The [`VECTOR`]({% link {{ page.version.version }}/vector.md %}) data type stores
9393

9494
[Organizing CockroachDB {{ site.data.products.cloud }} clusters using folders]({% link cockroachcloud/folders.md %}) is in preview. Folders allow you to organize and manage access to your clusters according to your organization's requirements. For example, you can create top-level folders for each business unit in your organization, and within those folders, organize clusters by geographic location and then by level of maturity, such as production, staging, and testing.
9595

96-
### Read on standby cluster in physical cluster replication (PCR) for CockroachDB {{ site.data.products.core }}
96+
### Read from standby in physical cluster replication (PCR) for CockroachDB {{ site.data.products.core }}
9797

98-
The [`READ VIRTUAL CLUSTER`]({% link {{ page.version.version }}/create-virtual-cluster.md %}#options) option allows you to set up a PCR stream that also creates a read-only virtual cluster on the standby cluster. You can create a PCR job as per the [Set Up Physical Cluster Replication]({% link {{ page.version.version }}/set-up-physical-cluster-replication.md %}) guide and then add the option to the [`CREATE VIRTUAL CLUSTER`]({% link {{ page.version.version }}/create-virtual-cluster.md %}) statement.
98+
The [`READ VIRTUAL CLUSTER`]({% link {{ page.version.version }}/create-virtual-cluster.md %}#options) option allows you to set up a PCR stream that also creates a [read-only virtual cluster]({% link {{ page.version.version }}/read-from-standby.md %}) on the standby cluster. You can create a PCR job as per the [Set Up Physical Cluster Replication]({% link {{ page.version.version }}/set-up-physical-cluster-replication.md %}) guide and then add the option to the [`CREATE VIRTUAL CLUSTER`]({% link {{ page.version.version }}/create-virtual-cluster.md %}) statement.
9999

100100
### Custom Metrics Chart page for CockroachDB {{ site.data.products.cloud }} clusters
101101

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
title: Read from Standby
3+
summary: Direct read-only queries to your standby cluster instead of your primary cluster.
4+
toc: true
5+
docs_area: manage
6+
---
7+
8+
{{site.data.alerts.callout_info}}
9+
{% include feature-phases/preview.md %}
10+
{{site.data.alerts.end}}
11+
12+
In addition to providing [failover]({% link {{ page.version.version }}/failover-replication.md %}) capabilities for [disaster recovery]({% link {{ page.version.version }}/disaster-recovery-overview.md %}), [**physical cluster replication (PCR)**]({% link {{ page.version.version }}/physical-cluster-replication-overview.md %}) allows you to direct read-only queries to your standby cluster. This process offloads traffic such as application reads, analytics queries, and ad-hoc reporting from the primary cluster.
13+
14+
Use this page to understand how the _read from standby_ feature works and how to utilize it.
15+
16+
## How the read from standby feature works
17+
18+
PCR utilizes [cluster virtualization]({% link {{ page.version.version }}/cluster-virtualization-overview.md %}) to separate a cluster's control plane from its data plane. A cluster always has one control plane, called a _system virtual cluster (system VC)_, and at least one data plane, called an _App Virtual Cluster (app VC)_. The standby cluster's system VC manages the PCR job and other cluster metadata, and is not used for application queries. All data tables, system tables, and cluster settings in the standby cluster's app VC are identical to the primary cluster's app VC. The standby cluster's app VC itself remains offline during replication.
19+
20+
When using read from standby, applications can read from the standby cluster, but they do not connect directly to the standby cluster's app VC. Instead, PCR introduces a _reader virtual cluster (reader VC)_. The reader VC ensures a clean, isolated environment specifically for serving read queries without interfering with replication or system metadata. It reads continuously from the standby cluster's app VC using internal pointers, providing access to the replicated data while keeping the app VC offline. The reader VC itself only stores a small amount of metadata and no user data, so it is not expected to take up additional storage space.
21+
22+
The standby cluster's reader VC has its own system tables and [cluster settings]({% link {{ page.version.version }}/cluster-settings.md %}). The reader VC replicates a subset of system tables, including **Users** and **Roles**, from the app VC, so that existing primary users can authenticate using the same [users and roles]({% link {{ page.version.version }}/security-reference/authorization.md %}) as on the primary cluster's app VC. Other system tables and cluster settings are set to defaults in the reader VC. For more information, consult [Physical Cluster Replication Technical Overview]({% link {{ page.version.version }}/physical-cluster-replication-technical-overview.md %}).
23+
24+
In the event of failover, the reader VC's response depends on the type of failover. After failover to the latest timestamp, the reader VC continues pointing to the app VC but stops receiving updates. After failover to a point-in-time timestamp, the reader VC is destroyed.
25+
26+
## Use the read from standby feature
27+
### Before you begin
28+
29+
Prior to setting up read from standby, ensure that:
30+
31+
- You have already configured PCR between a _primary_ cluster and a _standby_ cluster. For information on configuring PCR, refer to [Set Up Physical Cluster Replication]({% link {{ page.version.version }}/set-up-physical-cluster-replication.md %}).
32+
- Your CockroachDB version is v24.3 or later. The `read from standby` option is not supported in earlier versions.
33+
34+
### Start a PCR stream with read from standby
35+
36+
To start a PCR stream that allows read access to the standby cluster, use the [`CREATE VIRTUAL CLUSTER ... REPLICATION`]({% link {{ page.version.version }}/create-virtual-cluster.md %}) statement with the `READ VIRTUAL CLUSTER` option:
37+
38+
{% include_cached copy-clipboard.html %}
39+
~~~ sql
40+
CREATE VIRTUAL CLUSTER main FROM REPLICATION OF main ON 'postgresql://{connection string to primary}' WITH READ VIRTUAL CLUSTER;
41+
~~~
42+
43+
### Add read from standby to a PCR stream
44+
45+
To add read from standby capabilities to an existing PCR stream, use the [`ALTER VIRTUAL CLUSTER`]({% link {{ page.version.version }}/alter-virtual-cluster.md %}) statement:
46+
47+
{% include_cached copy-clipboard.html %}
48+
~~~ sql
49+
ALTER VIRTUAL CLUSTER main SET REPLICATION READ VIRTUAL CLUSTER;
50+
~~~
51+
52+
{{site.data.alerts.callout_info}}
53+
The standby cluster's app VC must have a status of `replicating` before you can create your reader VC. Use the [`SHOW VIRTUAL CLUSTERS`]({% link {{ page.version.version }}/show-virtual-cluster.md %}) command to check the status of the app VC.
54+
{{site.data.alerts.end}}
55+
56+
### Check the status of your reader virtual cluster
57+
58+
To confirm that your reader virtual cluster is active:
59+
60+
{% include_cached copy-clipboard.html %}
61+
~~~ sql
62+
SHOW VIRTUAL CLUSTERS;
63+
~~~
64+
65+
The output shows a `standby-readonly` virtual cluster in addition to the system VC and app VC:
66+
67+
~~~
68+
id | name | data_state | service_mode
69+
-----+------------------+-------------+---------------
70+
1 | system | ready | shared
71+
3 | standby | replicating | none
72+
4 | standby-readonly | ready | shared
73+
~~~
74+
75+
{{site.data.alerts.callout_info}}
76+
The reader VC cannot serve reads until after the PCR initial scan is complete. After completing the initial scan, wait until the reader VC's `service_mode` is `shared`, then wait about one minute before connecting to the reader VC.
77+
{{site.data.alerts.end}}
78+
79+
### Run read-only queries on the standby cluster
80+
81+
Once you have created a reader virtual cluster on the standby cluster, you can connect to it and run [read (`SELECT`) queries]({% link {{ page.version.version }}/selection-queries.md %}). For example:
82+
83+
{% include_cached copy-clipboard.html %}
84+
~~~ sql
85+
SELECT COUNT(*) FROM customers;
86+
SELECT region, SUM(amount) FROM orders GROUP BY region;
87+
~~~
88+
89+
The results of queries on the standby cluster reflect the state of the primary cluster as of a historical time that approaches the [replicated time]({% link {{ page.version.version }}/show-virtual-cluster.md %}#show-replication-status).
90+
91+
{{ site.data.alerts.callout_info }}
92+
Write operations are not permitted on the standby cluster.
93+
{{ site.data.alerts.end }}
94+
95+
## See also
96+
- [Set Up Physical Cluster Replication]({% link {{ page.version.version }}/set-up-physical-cluster-replication.md %})
97+
- [Fail Over from a Primary Cluster to a Standby Cluster]({% link {{ page.version.version }}/failover-replication.md %})
98+
- [Physical Cluster Replication Technical Overview]({% link {{ page.version.version }}/physical-cluster-replication-technical-overview.md %})
99+
- [`CREATE VIRTUAL CLUSTER`]({% link {{ page.version.version }}/create-virtual-cluster.md %})
100+
- [`ALTER VIRTUAL CLUSTER`]({% link {{ page.version.version }}/alter-virtual-cluster.md %})
101+
- [`SHOW VIRTUAL CLUSTER`]({% link {{ page.version.version }}/show-virtual-cluster.md %})

0 commit comments

Comments
 (0)