You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You will encounter an error if you run multiple [backup collections]({% link {{ page.version.version }}/take-full-and-incremental-backups.md %}#backup-collections) to the same storage URI. Each collection's URI must be unique.
1
+
You will encounter an error if you run multiple [backup collections]({% link {{ page.version.version }}/take-full-and-incremental-backups.md %}#backup-collections) to the same storage URI. Backup collections can contain multiple full and incremental backups, but each collection's URI must be unique. If you are using backup schedules, each schedule must have a unique URI.
Copy file name to clipboardExpand all lines: src/current/v25.4/cluster-virtualization-overview.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,7 +66,7 @@ When cluster virtualization is enabled, [backup]({% link {{ page.version.version
66
66
- If your deployment contains system-level customizations, you can take a separate backup of the system virtual cluster to capture them.
67
67
- A backup of a virtual cluster can be restored as a virtual cluster in any CockroachDB cluster with cluster virtualization enabled.
68
68
69
-
For more details about backing up and restoring a cluster with cluster virtualization enabled, refer to [Work with virtual clusters]({% link {{ page.version.version }}/work-with-virtual-clusters.md %}#disaster-recovery).
69
+
For more details about backing up and restoring a cluster with cluster virtualization enabled, refer to [Work with virtual clusters]({% link {{ page.version.version }}/work-with-virtual-clusters.md %}#backup-and-restore).
70
70
71
71
{{site.data.alerts.callout_success}}
72
72
For details about configuring and using PCR for disaster recovery, refer to [Physical Cluster Replication Overview]({% link {{ page.version.version }}/physical-cluster-replication-overview.md %}).
When connected to a virtual cluster from the DB Console, metrics which measure SQL and related activity show data scoped to the virtual cluster. All other metrics are collected system-wide and display the same data on all virtual clusters including the system virtual cluster.
116
116
117
-
## Disaster recovery
117
+
## Backup and restore
118
118
119
-
When cluster virtualization is enabled, [backup]({% link {{ page.version.version }}/backup.md %}) and [restore]({% link {{ page.version.version }}/restore.md %}) commands are scoped to the virtual cluster by default.
119
+
Cockroach Labs recommends that you regularly [back up]({% link {{ page.version.version }}/take-full-and-incremental-backups.md %}#full-backups) your data. When using virtual clusters, perform backups on the _application virtual cluster (app VC)_. Only the app VC's data and settings are included in these backups, and data and settings for other virtual clusters or for the _system virtual cluster (system VC)_ are omitted.
120
120
121
-
Cockroach Labs recommends that you regularly [back up]({% link {{ page.version.version }}/take-full-and-incremental-backups.md %}#full-backups) your _application virtual cluster (app VC)_. Only the app VC's data and settings are included in these backups, and data and settings for other virtual clusters or for the _system virtual cluster (system VC)_ are omitted. If needed, you can [restore](#restore-a-virtual-cluster) these backups to a new app VC. Use the following process to back up your app VC.
121
+
### Create a backup schedule for your app VC
122
122
123
-
1.[Connect](#connect-to-a-virtual-cluster) to the app VC as a user with the `admin` role on the app VC:
123
+
Cockroach Labs recommends using [backup schedules]({% link {{ page.version.version }}/create-schedule-for-backup.md %}) to automate full and incremental backups of your data.
124
+
125
+
Use the following process to create a schedule for a cluster-level backup of your app VC. In this example, the schedule takes revision history for the backup every day at midnight.
126
+
127
+
1.[Connect](#connect-to-a-virtual-cluster) to the app VC as a user with [supported privileges]({% link {{ page.version.version }}/security-reference/authorization.md %}#supported-privileges) on the app VC. In this example the user has the `BACKUP` privilege.
124
128
125
129
{% include_cached copy-clipboard.html %}
126
130
~~~shell
@@ -129,18 +133,127 @@ Cockroach Labs recommends that you regularly [back up]({% link {{ page.version.v
129
133
--certs-dir "certs"
130
134
~~~
131
135
132
-
1. [Perform a full backup]({% link {{ page.version.version }}/backup.md %}#back-up-a-cluster):
136
+
1. [Create a backup schedule]({% link {{ page.version.version }}/create-schedule-for-backup.md %}#create-a-scheduled-backup-for-a-cluster):
133
137
134
138
{% include_cached copy-clipboard.html %}
135
139
~~~ sql
136
-
BACKUP INTO 'external://backup_s3' AS OF SYSTEM TIME '-10s';
140
+
CREATE SCHEDULE schedule_label
141
+
FOR BACKUP INTO 's3://test/backups/schedule_test?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=x'
142
+
WITH revision_history
143
+
RECURRING '@daily';
144
+
~~~
145
+
146
+
~~~
147
+
schedule_id | name | status | first_run | schedule | backup_stmt
588796190000218113 | schedule_label | PAUSED: Waiting for initial backup to complete| NULL | @daily | BACKUP INTO LATEST IN 's3://test/schedule-test?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=x' WITH revision_history, detached
150
+
588796190012702721 | schedule_label | ACTIVE | 2020-09-10 16:52:17.280821+00:00 | @weekly | BACKUP INTO 's3://test/schedule-test?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=x' WITH revision_history, detached
151
+
(2 rows)
137
152
~~~
138
153
139
154
{% include {{ page.version.version }}/backups/backup-storage-collision.md %}
140
155
156
+
For information on scheduling backups at different levels or with other options, consult [CREATE SCHEDULE FOR BACKUP]({% link {{ page.version.version }}/create-schedule-for-backup.md %}).
157
+
158
+
### Back up your app VC
159
+
160
+
Use the following process to take a one-off full backup of your app VC.
161
+
162
+
1. [Connect](#connect-to-a-virtual-cluster) to the app VC as a user with [supported privileges]({% link {{ page.version.version }}/security-reference/authorization.md %}#supported-privileges) on the app VC. In this example the user has the `BACKUP` privilege.
163
+
164
+
{% include_cached copy-clipboard.html %}
165
+
~~~ shell
166
+
cockroach sql --url \
167
+
"postgresql://root@{primary node IP or hostname}:26257?options=-ccluster={app_virtual_cluster_name}&sslmode=verify-full" \
168
+
--certs-dir "certs"
169
+
~~~
170
+
171
+
1. [Perform a full backup]({% link {{ page.version.version }}/backup.md %}#back-up-a-cluster):
172
+
173
+
{% include_cached copy-clipboard.html %}
174
+
~~~ sql
175
+
BACKUP INTO 'external://backup_s3/app' AS OF SYSTEM TIME '-10s';
176
+
~~~
177
+
178
+
### Back up a database from your app VC
179
+
180
+
Use the following process to take a one-off database-level backup on your app VC.
181
+
182
+
1. [Connect](#connect-to-a-virtual-cluster) to the app VC as a user with [supported privileges]({% link {{ page.version.version }}/security-reference/authorization.md %}#supported-privileges) on the app VC. In this example the user has the `BACKUP` privilege.
183
+
184
+
{% include_cached copy-clipboard.html %}
185
+
~~~ shell
186
+
cockroach sql --url \
187
+
"postgresql://root@{primary node IP or hostname}:26257?options=-ccluster={app_virtual_cluster_name}&sslmode=verify-full" \
188
+
--certs-dir "certs"
189
+
~~~
190
+
191
+
1. [Back up]({% link {{ page.version.version }}/backup.md %}#back-up-a-database) a single database:
192
+
193
+
{% include_cached copy-clipboard.html %}
194
+
~~~ sql
195
+
BACKUP DATABASE bank INTO 'external://backup_s3/app/db' AS OF SYSTEM TIME '-10s';
196
+
~~~
197
+
198
+
Or back up multiple databases:
199
+
200
+
{% include_cached copy-clipboard.html %}
201
+
~~~ sql
202
+
BACKUP DATABASE bank, employees INTO 'external://backup_s3/app/db' AS OF SYSTEM TIME '-10s';
203
+
~~~
204
+
205
+
### Back up a table or view from your app VC
206
+
207
+
Use the following procecss to take a one-off table-level or view-level backup on your app VC.
208
+
209
+
1. [Connect](#connect-to-a-virtual-cluster) to the app VC as a user with [supported privileges]({% link {{ page.version.version }}/security-reference/authorization.md %}#supported-privileges) on the app VC. In this example the user has the `BACKUP` privilege.
210
+
211
+
{% include_cached copy-clipboard.html %}
212
+
~~~ shell
213
+
cockroach sql --url \
214
+
"postgresql://root@{primary node IP or hostname}:26257?options=-ccluster={app_virtual_cluster_name}&sslmode=verify-full" \
215
+
--certs-dir "certs"
216
+
~~~
217
+
218
+
1. [Back up]({% link {{ page.version.version }}/backup.md %}#back-up-a-table-or-view) a single table or view:
219
+
220
+
{% include_cached copy-clipboard.html %}
221
+
~~~ sql
222
+
BACKUP bank.customers INTO 'external://backup_s3/app/table' AS OF SYSTEM TIME '-10s';
223
+
~~~
224
+
225
+
Or back up multiple tables:
226
+
227
+
{% include_cached copy-clipboard.html %}
228
+
~~~ sql
229
+
BACKUP bank.customers, bank.accounts INTO 'external://backup_s3/app/table' AS OF SYSTEM TIME '-10s';
230
+
~~~
231
+
232
+
### Back up a schema from your app VC
233
+
234
+
Use the following procecss to take a one-off schema-level backup on your app VC using a wildcard (`*`).
235
+
236
+
1. [Connect](#connect-to-a-virtual-cluster) to the app VC as a user with [supported privileges]({% link {{ page.version.version }}/security-reference/authorization.md %}#supported-privileges) on the app VC. In this example the user has the `BACKUP` privilege.
237
+
238
+
{% include_cached copy-clipboard.html %}
239
+
~~~ shell
240
+
cockroach sql --url \
241
+
"postgresql://root@{primary node IP or hostname}:26257?options=-ccluster={app_virtual_cluster_name}&sslmode=verify-full" \
242
+
--certs-dir "certs"
243
+
~~~
244
+
245
+
1. [Back up]({% link {{ page.version.version }}/backup.md %}#back-up-all-tables-in-a-schema) all tables in a schema:
246
+
247
+
{% include_cached copy-clipboard.html %}
248
+
~~~ sql
249
+
BACKUP test_schema.* INTO 'external://backup_s3/app/schema' AS OF SYSTEM TIME '-10s';
250
+
~~~
251
+
252
+
### Back up your system VC
253
+
141
254
You can also back up your system VC to preserve metadata such as users and cluster settings. Use the following process to back up your system VC.
142
255
143
-
1. [Connect](#connect-to-the-system-virtual-cluster) to the system VC as a user with the `admin` role on the system VC:
256
+
1. [Connect](#connect-to-the-system-virtual-cluster) to the system VC as a user with [supported privileges]({% link {{ page.version.version }}/security-reference/authorization.md %}#supported-privileges) on the system VC. In this example the user has the `BACKUP` privilege.
144
257
145
258
{% include_cached copy-clipboard.html %}
146
259
~~~ shell
@@ -153,23 +266,30 @@ You can also back up your system VC to preserve metadata such as users and clust
153
266
154
267
{% include_cached copy-clipboard.html %}
155
268
~~~ sql
156
-
BACKUP INTO 'external://backup_s3' AS OF SYSTEM TIME '-10s';
269
+
BACKUP INTO 'external://backup_s3/system' AS OF SYSTEM TIME '-10s';
157
270
~~~
158
271
159
272
{% include {{ page.version.version }}/backups/backup-storage-collision.md %}
160
273
161
274
### Restore a virtual cluster
162
275
163
-
You can restore a backup of a virtual cluster to:
276
+
If needed, you can restore backups to a new app VC with no user-created databases or tables. To restore your app VC from the latest full backup:
164
277
165
-
- The original virtual cluster on the original CockroachDB cluster.
166
-
- A different virtual cluster on the original CockroachDB cluster.
167
-
- A different virtual cluster on a different CockroachDB cluster with cluster virtualization enabled.
278
+
1. [Connect to the destination app VC](#connect-to-a-virtual-cluster) as a user with [supported privileges]({% link {{ page.version.version }}/security-reference/authorization.md %}#supported-privileges) on the system VC. In this example the user has the `RESTORE` privilege.
168
279
169
-
To restore only a virtual cluster:
280
+
{% include_cached copy-clipboard.html %}
281
+
~~~ shell
282
+
cockroach sql --url \
283
+
"postgresql://root@{primary node IP or hostname}:26257?options=-ccluster={app_virtual_cluster_name}&sslmode=verify-full" \
284
+
--certs-dir "certs"
285
+
~~~
286
+
287
+
1. [Restore the cluster]({% link {{ page.version.version }}/restore.md %}):
170
288
171
-
1. [Connect to the destination virtual cluster](#connect-to-a-virtual-cluster) as a user with the `admin` role on the virtual cluster.
172
-
1. [Restore the cluster]({% link {{ page.version.version }}/restore.md %}). Only the virtual cluster's data and settings are restored.
289
+
{% include_cached copy-clipboard.html %}
290
+
~~~ sql
291
+
RESTORE FROM LATEST IN 's3://bucket/path?AUTH=implicit';
0 commit comments