Skip to content

Commit 59cdae5

Browse files
committed
Add manage PCR page for cluster upgrades + tasks
1 parent 06e006d commit 59cdae5

8 files changed

+114
-62
lines changed

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

+13-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"is_top_level": true,
44
"items": [
55
{
6-
"title": "Logical Data Replication",
6+
"title": "Logical Data Replication (LDR)",
77
"items": [
88
{
99
"title": "Overview",
@@ -12,27 +12,27 @@
1212
]
1313
},
1414
{
15-
"title": "Set Up Logical Data Replication",
15+
"title": "Set Up LDR",
1616
"urls": [
1717
"/${VERSION}/set-up-logical-data-replication.html"
1818
]
1919
},
2020
{
21-
"title": "Manage Logical Data Replication",
21+
"title": "Manage LDR",
2222
"urls": [
2323
"/${VERSION}/manage-logical-data-replication.html"
2424
]
2525
},
2626
{
27-
"title": "Monitor Logical Data Replication",
27+
"title": "Monitor LDR",
2828
"urls": [
2929
"/${VERSION}/logical-data-replication-monitoring.html"
3030
]
3131
}
3232
]
3333
},
3434
{
35-
"title": "Physical Cluster Replication",
35+
"title": "Physical Cluster Replication (PCR)",
3636
"items": [
3737
{
3838
"title": "Overview",
@@ -41,7 +41,7 @@
4141
]
4242
},
4343
{
44-
"title": "Set Up Physical Cluster Replication",
44+
"title": "Set Up PCR",
4545
"urls": [
4646
"/${VERSION}/set-up-physical-cluster-replication.html"
4747
]
@@ -53,11 +53,17 @@
5353
]
5454
},
5555
{
56-
"title": "Monitor a Replication Stream",
56+
"title": "Monitor PCR",
5757
"urls": [
5858
"/${VERSION}/physical-cluster-replication-monitoring.html"
5959
]
6060
},
61+
{
62+
"title": "Manage PCR",
63+
"urls": [
64+
"/${VERSION}/manage-physical-cluster-replication.html"
65+
]
66+
},
6167
{
6268
"title": "Technical Overview",
6369
"urls": [

src/current/v25.1/create-external-connection.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Storage or sink | Operation support
6666
[HTTP(S)]({% link {{ page.version.version }}/changefeed-sinks.md %}) | Changefeeds
6767
[Kafka]({% link {{ page.version.version }}/changefeed-sinks.md %}#kafka) | Changefeeds
6868
[Nodelocal]({% link {{ page.version.version }}/use-cloud-storage.md %}) | Backups, restores, imports, exports, changefeeds
69-
[PostgreSQL]({% link {{ page.version.version }}/set-up-physical-cluster-replication.md %}#connection-reference) connections | Physical cluster replication
69+
[PostgreSQL]({% link {{ page.version.version }}/manage-physical-cluster-replication.md %}#connection-reference) connections | Physical cluster replication
7070
[Userfile]({% link {{ page.version.version }}/use-userfile-storage.md %}) | Backups, restores, imports, exports, changefeeds
7171
[Webhook]({% link {{ page.version.version }}/changefeed-sinks.md %}#webhook-sink) | Changefeeds
7272

src/current/v25.1/create-virtual-cluster.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ cockroach sql --url `"postgresql://root@{node IP or hostname}:{26257}?options=-c
150150
~~~
151151

152152
{{site.data.alerts.callout_info}}
153-
You can only read data on the created `readonly` virtual cluster, other operations like `SHOW VIRTUAL CLUSTERS` must be run from the `system` virtual cluster. To connect to the `readonly` virtual cluster, refer to the [Connection Reference]({% link {{ page.version.version }}/set-up-physical-cluster-replication.md %}#connection-reference).
153+
You can only read data on the created `readonly` virtual cluster, other operations like `SHOW VIRTUAL CLUSTERS` must be run from the `system` virtual cluster. To connect to the `readonly` virtual cluster, refer to the [Connection Reference]({% link {{ page.version.version }}/manage-physical-cluster-replication.md %}#connection-reference).
154154
{{site.data.alerts.end}}
155155

156156
{% include {{ page.version.version }}/physical-replication/failover-read-virtual-cluster.md %} Use [`DROP VIRTUAL CLUSTER`]({% link {{ page.version.version }}/drop-virtual-cluster.md %}) to remove the `readonly` virtual cluster.

src/current/v25.1/failover-replication.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ This section illustrates the steps to fail back to the original primary cluster
223223
~~~
224224

225225
{{site.data.alerts.callout_success}}
226-
For details on connection strings, refer to the [Connection reference]({% link {{ page.version.version }}/set-up-physical-cluster-replication.md %}#connection-reference).
226+
For details on connection strings, refer to the [Connection reference]({% link {{ page.version.version }}/manage-physical-cluster-replication.md %}#connection-reference).
227227
{{site.data.alerts.end}}
228228

229229
1. Connect to the system virtual cluster for **Cluster B**:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
title: Manage Physical Cluster Replication
3+
summary: Learn how to manage a physical cluster replication (PCR) stream.
4+
toc: true
5+
---
6+
7+
[Physical cluster replication (PCR)]({% link {{ page.version.version }}/physical-cluster-replication-overview.md %}) enables continuous replication of data from an active primary cluster to a passive standby cluster, supporting high availability and disaster recovery scenarios.
8+
This page describes:
9+
10+
- [Connecting to and interacting with](#connection-reference) the system virtual cluser and virtual clusters on each physical cluster.
11+
- [Managing PCR](#manage-replication-in-the-sql-shell) using SQL statements.
12+
- [Upgrading CockroachDB](#upgrade-the-cluster-version-on-the-primary-and-standby) on both the primary and standby clusters.
13+
14+
## Connection reference
15+
16+
This table outlines the connection strings to connect to the primary and standby cluster's [virtual clusters]({% link {{ page.version.version }}/cluster-virtualization-overview.md %}).
17+
18+
{{site.data.alerts.callout_success}}
19+
You can use an [external connection]({% link {{ page.version.version }}/create-external-connection.md %}) to define a name for connections using the `postgresql://` scheme.
20+
{{site.data.alerts.end}}
21+
22+
The table uses `main` as an example name for the virtual cluster that contains user table data in the primary and standby clusters.
23+
24+
Cluster | Virtual Cluster | Usage | URL and Parameters
25+
--------+-----------------+-------+-------------------
26+
Primary | System | Set up a replication user and view running virtual clusters. Connect with [`cockroach sql`]({% link {{ page.version.version }}/cockroach-sql.md %}). | `"postgresql://root@{node IP or hostname}:{26257}?options=-ccluster=system&sslmode=verify-full"`<br><br><ul><li>`options=-ccluster=system`</li><li>`sslmode=verify-full`</li></ul>Use the `--certs-dir` flag to specify the path to your certificate.
27+
Primary | Main | Add and run a workload with [`cockroach workload`]({% link {{ page.version.version }}/cockroach-workload.md %}). | `"postgresql://root@{node IP or hostname}:{26257}?options=-ccluster=main&sslmode=verify-full&sslrootcert=certs/ca.crt&sslcert=certs/client.root.crt&sslkey=certs/client.root.key"`<br><br>{% include {{ page.version.version }}/connect/cockroach-workload-parameters.md %} As a result, for the example in this tutorial, you will need:<br><br><ul><li>`options=-ccluster={virtual_cluster_name}`</li><li>`sslmode=verify-full`</li><li>`sslrootcert={path}/certs/ca.crt`</li><li>`sslcert={path}/certs/client.root.crt`</li><li>`sslkey={path}/certs/client.root.key`</li></ul>
28+
Standby | System | Manage the replication stream. Connect with [`cockroach sql`]({% link {{ page.version.version }}/cockroach-sql.md %}). | `"postgresql://root@{node IP or hostname}:{26257}?options=-ccluster=system&sslmode=verify-full"`<br><br><ul><li>`options=-ccluster=system`</li><li>`sslmode=verify-full`</li></ul>Use the `--certs-dir` flag to specify the path to your certificate.
29+
Standby/Primary | System | Connect to the other cluster. | `"postgresql://{replication user}:{password}@{node IP or hostname}:{26257}/defaultdb?options=-ccluster%3Dsystem&sslinline=true&sslmode=verify-full&sslrootcert=-----BEGIN+CERTIFICATE-----{encoded_cert}-----END+CERTIFICATE-----%0A"`<br><br>Generate the connection string with [`cockroach encode-uri`]({% link {{ page.version.version }}/set-up-physical-cluster-replication.md %}#step-3-manage-the-cluster-certificates). Use the generated connection string in:<br><br><ul><li>`CREATE VIRTUAL CLUSTER` statements to [start the replication stream]({% link {{ page.version.version }}/set-up-physical-cluster-replication.md %}#step-4-start-replication).</li><li>`ALTER VIRTUAL CLUSTER` statements to [fail back to the primary cluster]({% link {{ page.version.version }}/failover-replication.md %}#failback).</li></ul>
30+
Standby | Read only | Run read queries on the standby's replicating virtual cluster | `"postgresql://root@{node IP or hostname}:{26257}?options=-ccluster=main-readonly&sslmode=verify-full"`<br><br><ul><li>`options=-ccluster=main-readonly`</li><li>`sslmode=verify-full`</li></ul>Use the `--certs-dir` flag to specify the path to your certificate.
31+
32+
For additional detail on the standard CockroachDB connection parameters, refer to [Client Connection Parameters]({% link {{ page.version.version }}/connection-parameters.md %}#connect-using-a-url).
33+
34+
## Manage replication in the SQL shell
35+
36+
To start, manage, and observe PCR, you can use the following SQL statements:
37+
38+
Statement | Action
39+
----------+------
40+
[`CREATE VIRTUAL CLUSTER ... FROM REPLICATION OF ...`]({% link {{ page.version.version }}/create-virtual-cluster.md %}) | Start a PCR stream and [configure the stream's behavior]({% link {{ page.version.version }}/create-virtual-cluster.md %}#options).
41+
[`ALTER VIRTUAL CLUSTER`]({% link {{ page.version.version }}/alter-virtual-cluster.md %}) | Pause and resume PCR streams, [initiate a failover]({% link {{ page.version.version }}/alter-virtual-cluster.md %}#start-the-failover-process), and configure a running stream's behavior.
42+
[`SHOW VIRTUAL CLUSTER`]({% link {{ page.version.version }}/show-virtual-cluster.md %}) | Show all virtual clusters and PCR stream status in the physical cluster.
43+
[`DROP VIRTUAL CLUSTER`]({% link {{ page.version.version }}/drop-virtual-cluster.md %}) | Remove a virtual cluster.
44+
45+
## Upgrade the cluster version on the primary and standby
46+
47+
{{site.data.alerts.callout_danger}}
48+
The standby cluster must be at the same version as, or one version ahead of, the primary's virtual cluster.
49+
{{site.data.alerts.end}}
50+
51+
To upgrade the primary and standby clusters in PCR, complete the following steps in order:
52+
53+
### Step 1. Upgrade the binary on both clusters
54+
55+
Upgrade the binary on **every node** in both the primary and standby clusters:
56+
57+
1. Replace the `cockroach` binary on each node.
58+
1. Restart CockroachDB each node.
59+
60+
You can find more details on upgrading the binary in [Perform a major-version upgrade]({% link {{ page.version.version }}/upgrade-cockroach-version.md %}#perform-a-major-version-upgrade).
61+
62+
### Step 2. Finalize the upgrade on each virtual cluster
63+
64+
You must finalize the upgrade on each virtual cluster in this order:
65+
66+
1. Standby system virtual cluster
67+
1. Primary system virtual cluster
68+
1. Standby application virtual cluster
69+
1. Primary application virtual cluster
70+
71+
Repeat these steps for **each** virtual cluster in the specified order. To finalize a virtual cluster:
72+
73+
1. Connect to the virtual cluster using the SQL shell:
74+
75+
{% include_cached copy-clipboard.html %}
76+
~~~ shell
77+
cockroach sql "<connection string>"
78+
~~~
79+
80+
Use the [Connection reference](#connection-reference) to find the correct connection strings.
81+
82+
1. Run the following command, replacing `{VERSION}` with the target major version (e.g., `{{ page.version.version }}`):
83+
84+
{% include_cached copy-clipboard.html %}
85+
~~~ sql
86+
SET CLUSTER SETTING version = '{VERSION}';
87+
~~~
88+
89+
This upgrades the standby cluster before the primary cluster. Within the primary and standby CockroachDB clusters, the system virtual cluster must be at a cluster version greater than or equal to the virtual cluster.
90+
91+
{{site.data.alerts.callout_info}}
92+
It is possible to perform a failover from the primary to the standby during the upgrade; however, you will not be able perform a failback from the promoted original standby when it is a version ahead of the original primary cluster.
93+
{{site.data.alerts.end}}
94+
95+
For more details on finalizing or rolling back the upgrade, refer to [Upgrade CockroachDB self-hosted]({% link {{ page.version.version }}/upgrade-cockroach-version.md %}) page.

src/current/v25.1/physical-cluster-replication-overview.md

+1-30
Original file line numberDiff line numberDiff line change
@@ -50,42 +50,13 @@ Frequent large schema changes or imports may cause a significant spike in [repli
5050

5151
## Get started
5252

53-
This section is a quick overview of the initial requirements to start a replication stream. For more comprehensive guides, refer to:
53+
To get started with PCR, refer to the following pages:
5454

5555
- [Set Up Physical Cluster Replication]({% link {{ page.version.version }}/set-up-physical-cluster-replication.md %}): for a tutorial on how to start a replication stream.
5656
- [Physical Cluster Replication Monitoring]({% link {{ page.version.version }}/physical-cluster-replication-monitoring.md %}): for detail on metrics and observability into a replication stream.
5757
- [Fail Over from a Primary Cluster to a Standby Cluster]({% link {{ page.version.version }}/failover-replication.md %}): for a guide on how to complete a replication stream and fail over to the standby cluster.
5858
- [Technical Overview]({% link {{ page.version.version }}/physical-cluster-replication-technical-overview.md %}): to understand PCR in more depth before setup.
5959

60-
### Manage replication in the SQL shell
61-
62-
To start, manage, and observe PCR, you can use the following SQL statements:
63-
64-
Statement | Action
65-
----------+------
66-
[`CREATE VIRTUAL CLUSTER ... FROM REPLICATION OF ...`]({% link {{ page.version.version }}/create-virtual-cluster.md %}) | Start a replication stream.
67-
[`ALTER VIRTUAL CLUSTER ... PAUSE REPLICATION`]({% link {{ page.version.version }}/alter-virtual-cluster.md %}) | Pause a running replication stream.
68-
[`ALTER VIRTUAL CLUSTER ... RESUME REPLICATION`]({% link {{ page.version.version }}/alter-virtual-cluster.md %}) | Resume a paused replication stream.
69-
[`ALTER VIRTUAL CLUSTER ... START SERVICE SHARED`]({% link {{ page.version.version }}/alter-virtual-cluster.md %}#start-a-virtual-cluster) | Initiate a [failover]({% link {{ page.version.version }}/failover-replication.md %}).
70-
[`SHOW VIRTUAL CLUSTER`]({% link {{ page.version.version }}/show-virtual-cluster.md %}) | Show all virtual clusters.
71-
[`DROP VIRTUAL CLUSTER`]({% link {{ page.version.version }}/drop-virtual-cluster.md %}) | Remove a virtual cluster.
72-
73-
## Cluster versions and upgrades
74-
75-
{{site.data.alerts.callout_danger}}
76-
The standby cluster must be at the same version as, or one version ahead of, the primary's virtual cluster.
77-
{{site.data.alerts.end}}
78-
79-
When PCR is enabled, upgrade with the following procedure. This upgrades the standby cluster before the primary cluster. Within the primary and standby CockroachDB clusters, the system virtual cluster must be at a cluster version greater than or equal to the virtual cluster:
80-
81-
1. [Upgrade the binaries]({% link {{ page.version.version }}/upgrade-cockroach-version.md %}#perform-a-major-version-upgrade) on the primary and standby clusters. Replace the binary on each node of the cluster and restart the node.
82-
1. [Finalize]({% link {{ page.version.version }}/upgrade-cockroach-version.md %}#finalize-a-major-version-upgrade-manually) the upgrade on the standby's system virtual cluster if auto-finalization is disabled.
83-
1. [Finalize]({% link {{ page.version.version }}/upgrade-cockroach-version.md %}#finalize-a-major-version-upgrade-manually) the upgrade on the primary's system virtual cluster if auto-finalization is disabled.
84-
1. [Finalize]({% link {{ page.version.version }}/upgrade-cockroach-version.md %}#finalize-a-major-version-upgrade-manually) the upgrade on the standby's virtual cluster.
85-
1. [Finalize]({% link {{ page.version.version }}/upgrade-cockroach-version.md %}#finalize-a-major-version-upgrade-manually) the upgrade on the primary's virtual cluster.
86-
87-
The standby cluster must be at the same version as, or one version ahead of, the primary's virtual cluster at the time of [failover]({% link {{ page.version.version }}/failover-replication.md %}).
88-
8960
## Demo video
9061

9162
Learn how to use PCR to meet your RTO and RPO requirements with the following demo:

0 commit comments

Comments
 (0)