Skip to content

Commit e70c0e4

Browse files
committed
Update privileges for pcr in v25.2
1 parent e2b3545 commit e70c0e4

File tree

4 files changed

+18
-30
lines changed

4 files changed

+18
-30
lines changed

src/current/v25.2/alter-virtual-cluster.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ The `ALTER VIRTUAL CLUSTER` statement initiates a [_failover_](#start-the-failov
1515

1616
## Required privileges
1717

18-
`ALTER VIRTUAL CLUSTER` requires one of the following privileges:
18+
{% include_cached new-in.html version="v25.2" %} To run the `ALTER VIRTUAL CLUSTER` statement from the standby cluster, users require the `REPLICATIONDEST` system [privilege]({% link {{ page.version.version }}/security-reference/authorization.md %}) **and** the `MANAGEVIRTUALCLUSTER` privilege.
1919

20-
- The `admin` role.
21-
- The `MANAGEVIRTUALCLUSTER` [system privilege]({% link {{ page.version.version }}/security-reference/authorization.md %}#privileges) allows the user to run all the related `VIRTUAL CLUSTER` SQL statements for PCR.
20+
{% include_cached new-in.html version="v25.2" %} The `ALTER VIRTUAL CLUSTER ... SET REPLICATION SOURCE` statement requires the `REPLICATIONSOURCE` system privilege and the `MANAGEVIRTUALCLUSTER` privilege.
2221

23-
Use the [`GRANT SYSTEM`]({% link {{ page.version.version }}/grant.md %}) statement:
22+
Use the [`GRANT SYSTEM`]({% link {{ page.version.version }}/grant.md %}) statement to grant the necessary privileges:
2423

2524
{% include_cached copy-clipboard.html %}
2625
~~~ sql
@@ -42,7 +41,7 @@ Parameter | Description
4241
`RESUME REPLICATION` | Resume the replication stream.
4342
`COMPLETE REPLICATION TO` | Set the time to complete the replication. Use: <br><ul><li>`SYSTEM TIME` to specify a [timestamp]({% link {{ page.version.version }}/as-of-system-time.md %}). Refer to [Fail over to a point in time]({% link {{ page.version.version }}/failover-replication.md %}#fail-over-to-a-point-in-time) for an example.</li><li>`LATEST` to specify the most recent replicated timestamp. Refer to [Fail over to a point in time]({% link {{ page.version.version }}/failover-replication.md %}#fail-over-to-the-most-recent-replicated-time) for an example.</li></ul>
4443
`SET REPLICATION RETENTION = duration` | Change the [duration]({% link {{ page.version.version }}/interval.md %}) of the retention window that will control how far in the past you can [fail over]({% link {{ page.version.version }}/failover-replication.md %}) to.<br><br>{% include {{ page.version.version }}/physical-replication/retention.md %}
45-
`SET REPLICATION EXPIRATION WINDOW = duration` | Override the default producer job's expiration window of 24 hours. The producer job expiration window determines how long the producer job will continue to run without a heartbeat from the consumer job. For more details, refer to the [Technical Overview]({% link {{ page.version.version }}/physical-cluster-replication-technical-overview.md %}).
44+
<span class="version-tag">New in v25.2:</span> `SET REPLICATION SOURCE EXPIRATION WINDOW = duration` | Override the default producer job's expiration window of 24 hours from the primary cluster. The producer job expiration window determines how long the producer job will continue to run without a heartbeat from the consumer job. For more details, refer to the [Technical Overview]({% link {{ page.version.version }}/physical-cluster-replication-technical-overview.md %}).
4645
`START REPLICATION OF virtual_cluster_spec ON physical_cluster` | Reset a virtual cluster to the time when the virtual cluster on the promoted standby diverged from it. To reuse as much of the existing data on the original primary cluster as possible, you can run this statement as part of the [failback]({% link {{ page.version.version }}/failover-replication.md %}#failback) process. This command fails if the virtual cluster was not originally replicated from the original primary cluster. Refer to [Options](#options) for details on how you can configure a PCR stream initiated as a failback.
4746
`START SERVICE SHARED` | Start a virtual cluster so it is ready to accept SQL connections after failover.
4847
`RENAME TO virtual_cluster_spec` | Rename a virtual cluster.
@@ -58,15 +57,15 @@ You can use the following options with `ALTER VIRTUAL CLUSTER {vc} START REPLICA
5857

5958
Option | Value | Description
6059
-------+-------+------------
61-
`EXPIRATION WINDOW` | Duration | Override the default producer job's expiration window of 24 hours. The producer job expiration window determines how long the producer job will continue to run without a heartbeat from the consumer job. For more details, refer to the [Technical Overview]({% link {{ page.version.version }}/physical-cluster-replication-technical-overview.md %}).
60+
`EXPIRATION WINDOW` | Duration | Override the default producer job's expiration window of 24 hours from the primary cluster. The producer job expiration window determines how long the producer job will continue to run without a heartbeat from the consumer job. For more details, refer to the [Technical Overview]({% link {{ page.version.version }}/physical-cluster-replication-technical-overview.md %}).
6261
`READ VIRTUAL CLUSTER` | N/A | ([**Preview**]({% link {{ page.version.version }}/cockroachdb-feature-availability.md %}#features-in-preview)) Configure the PCR stream to allow reads from the standby cluster. <br>**Note:** This only allows for reads on the standby's virtual cluster. You cannot perform writes or schema changes to user tables while connected to the standby virtual cluster. For more details, refer to [Start the failback process](#start-the-failback-process).
6362
`RETENTION` | Duration | Change the [duration]({% link {{ page.version.version }}/interval.md %}) of the retention window that will control how far in the past you can [fail over]({% link {{ page.version.version }}/failover-replication.md %}) to.<br><br>{% include {{ page.version.version }}/physical-replication/retention.md %}
6463

6564
## Examples
6665

6766
### Start the failover process
6867

69-
To start the [failover]({% link {{ page.version.version }}/failover-replication.md %}#failover) process, use `COMPLETE REPLICATION` and provide the timestamp to restore as of:
68+
To start the [failover]({% link {{ page.version.version }}/failover-replication.md %}#failover) process from the standby cluster, use `COMPLETE REPLICATION` and provide the timestamp to restore as of:
7069

7170
{% include_cached copy-clipboard.html %}
7271
~~~ sql
@@ -112,7 +111,7 @@ ALTER VIRTUAL CLUSTER main SET REPLICATION RETENTION = '24h';
112111

113112
### Start a virtual cluster
114113

115-
When a virtual cluster is [`ready`]({% link {{ page.version.version }}/show-virtual-cluster.md %}#responses) after initiating the failover process, you must start the service so that the virtual cluster is ready to accept SQL connections:
114+
When a virtual cluster is [`ready`]({% link {{ page.version.version }}/show-virtual-cluster.md %}#responses) after initiating the failover process, you must start the service so that the virtual cluster is ready to accept SQL connections. On the standby cluster, run:
116115

117116
{% include_cached copy-clipboard.html %}
118117
~~~ sql

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ Physical cluster replication is only supported in CockroachDB {{ site.data.produ
1919

2020
## Required privileges
2121

22-
`CREATE VIRTUAL CLUSTER` requires one of the following privileges:
22+
{% include_cached new-in.html version="v25.2" %} The following [privileges]({% link {{ page.version.version }}/security-reference/authorization.md %}) are required to start a PCR stream with `CREATE VIRTUAL CLUSTER`:
2323

24-
- The `admin` role.
25-
- The `MANAGEVIRTUALCLUSTER` [system privilege]({% link {{ page.version.version }}/security-reference/authorization.md %}#privileges) allows the user to run all the related `VIRTUAL CLUSTER` SQL statements for PCR.
24+
- The `REPLICATIONDEST` and `MANAGEVIRTUALCLUSTER` system privileges: The user starting the PCR stream from the standby cluster.
25+
- The `REPLICATIONSOURCE` system privilege: The user specified in the connection string for the primary cluster.
2626

27-
Use the [`GRANT SYSTEM`]({% link {{ page.version.version }}/grant.md %}) statement:
27+
Use the [`GRANT SYSTEM`]({% link {{ page.version.version }}/grant.md %}) statement to grant the necessary privileges to users:
2828

2929
{% include_cached copy-clipboard.html %}
3030
~~~ sql

src/current/v25.2/drop-virtual-cluster.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The `DROP VIRTUAL CLUSTER` statement will delete all data related to the specifi
2424
`DROP VIRTUAL CLUSTER` requires one of the following privileges:
2525

2626
- The `admin` role.
27-
- The `MANAGEVIRTUALCLUSTER` [system privilege]({% link {{ page.version.version }}/security-reference/authorization.md %}#privileges) allows the user to run all the related `VIRTUAL CLUSTER` SQL statements for PCR.
27+
- The `MANAGEVIRTUALCLUSTER` [system privilege]({% link {{ page.version.version }}/security-reference/authorization.md %}#privileges).
2828

2929
Use the [`GRANT SYSTEM`]({% link {{ page.version.version }}/grant.md %}) statement:
3030

src/current/v25.2/set-up-physical-cluster-replication.md

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Connect to your primary cluster's system virtual cluster using [`cockroach sql`]
105105

106106
### Create a replication user and password
107107

108-
The standby cluster connects to the primary cluster's system virtual cluster using an identity with the `REPLICATION` privilege. Connect to the primary cluster's system virtual cluster and create a user with a password:
108+
The standby cluster connects to the primary cluster's system virtual cluster using an identity with the `REPLICATIONSOURCE` privilege. Connect to the primary cluster's system virtual cluster and create a user with a password:
109109

110110
1. From the primary's system virtual cluster SQL shell, create a user and password:
111111
@@ -114,14 +114,14 @@ The standby cluster connects to the primary cluster's system virtual cluster usi
114114
CREATE USER {your username} WITH PASSWORD '{your password}';
115115
~~~
116116
117-
1. Grant the [`REPLICATION` system privilege]({% link {{ page.version.version }}/security-reference/authorization.md %}#supported-privileges) to your user:
117+
1. Grant the [`REPLICATIONSOURCE` privilege]({% link {{ page.version.version }}/security-reference/authorization.md %}#supported-privileges) to your user:
118118
119119
{% include_cached copy-clipboard.html %}
120120
~~~ sql
121-
GRANT SYSTEM REPLICATION TO {your username};
121+
GRANT SYSTEM REPLICATIONSOURCE TO {your username};
122122
~~~
123123
124-
If you need to change the password later, refer to [`ALTER USER`]({% link {{ page.version.version }}/alter-user.md %}).
124+
If you need to change the password later, refer to [`ALTER USER`]({% link {{ page.version.version }}/alter-user.md %}).
125125
126126
### Connect to the primary virtual cluster (optional)
127127
@@ -200,17 +200,6 @@ Connect to your standby cluster's system virtual cluster using [`cockroach sql`]
200200
--certs-dir "certs"
201201
~~~
202202

203-
1. Add your cluster organization and [{{ site.data.products.enterprise }} license]({% link {{ page.version.version }}/licensing-faqs.md %}#types-of-licenses) to the cluster:
204-
205-
{% include_cached copy-clipboard.html %}
206-
~~~ sql
207-
SET CLUSTER SETTING cluster.organization = 'your organization';
208-
~~~
209-
{% include_cached copy-clipboard.html %}
210-
~~~ sql
211-
SET CLUSTER SETTING enterprise.license = 'your enterprise license';
212-
~~~
213-
214203
1. Set the `kv.rangefeed.enabled` cluster setting to `true`. The replication job connects to a long-lived request, a _rangefeed_, which pushes changes as they happen:
215204

216205
{% include_cached copy-clipboard.html %}
@@ -236,7 +225,7 @@ Connect to your standby cluster's system virtual cluster using [`cockroach sql`]
236225

237226
### Create a user for the standby cluster
238227

239-
If you would like to access the [DB Console]({% link {{ page.version.version }}/ui-overview.md %}) to observe your replication, you will need to create a user:
228+
Create a use to run the PCR stream and access the [DB Console]({% link {{ page.version.version }}/ui-overview.md %}) to observe the job:
240229

241230
1. Create a user:
242231

@@ -249,7 +238,7 @@ If you would like to access the [DB Console]({% link {{ page.version.version }}/
249238

250239
{% include_cached copy-clipboard.html %}
251240
~~~ sql
252-
GRANT admin TO {your username};
241+
GRANT SYSTEM REPLICATIONDEST, MANAGEVIRTUALCLUSTER TO {your username};
253242
~~~
254243

255244
Open the DB Console in your web browser: `https://{node IP or hostname}:8080/`, where you will be prompted for these credentials. Refer to [Physical Cluster Replication Monitoring]({% link {{ page.version.version }}/physical-cluster-replication-monitoring.md %}) for more detail on tracking relevant metrics for your replication stream.

0 commit comments

Comments
 (0)