Skip to content

Commit d662973

Browse files
committed
Add cross-cluster restore operation examples
1 parent 4610218 commit d662973

File tree

1 file changed

+48
-6
lines changed

1 file changed

+48
-6
lines changed

src/current/_includes/cockroachcloud/backups/cloud-api-restore-endpoint.md

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ curl --request POST \
8787
"database": "tpcc"
8888
}
8989
]
90-
}
90+
}'
9191
~~~
9292

9393
By default the database will be restored into the original database name from the cluster backup. To restore the database contents into a new database, include the field `restore_opts.new_db_name` with the new database name:
@@ -107,7 +107,7 @@ curl --request POST \
107107
"restore_opts": {
108108
"new_db_name": "tpcc2"
109109
}
110-
}
110+
}'
111111
~~~
112112

113113
To restore a specific backup rather than the most recently created managed backup, include the `backup_id` field specifying a backup ID:
@@ -125,8 +125,28 @@ curl --request POST \
125125
"database": "tpcc"
126126
}
127127
],
128-
}
128+
}'
129+
~~~
130+
131+
{% if page.name == "managed-backups-advanced.md" %}
132+
To restore a database from a managed backup into a different cluster, send the restore request to the target cluster ID. Specify the ID of the backup's cluster as `source_cluster_id`. Both the source cluster and the target cluster must use the Advanced plan.
133+
134+
{% include_cached copy-clipboard.html %}
135+
~~~ shell
136+
curl --request POST \
137+
--url 'https://cockroachlabs.cloud/api/v1/clusters/{target_cluster_id}/restores' \
138+
--header "Authorization: Bearer {secret_key}" \
139+
--json '{
140+
"source_cluster_id": "{source_cluster_id}",
141+
"type": "DATABASE",
142+
"objects": [
143+
{
144+
"database": "tpcc"
145+
}
146+
],
147+
}'
129148
~~~
149+
{% endif %}
130150

131151
You can specify additional options for the restore operations in the `restore_opts` object. For more information, see the [API endpoint documentation](https://www.cockroachlabs.com/docs/api/cloud/v1#get-/api/v1/clusters/-cluster_id-/restores-config).
132152

@@ -161,7 +181,7 @@ curl --request POST \
161181
"table": "warehouse"
162182
}
163183
]
164-
}
184+
}'
165185
~~~
166186

167187
By default the table will be restored into the original database name from the cluster backup. To restore the table into a different database, include the field `restore_opts.into_name` with the database name. The following example restores the `tpcc.public.warehouse` table from the most recent managed backup into `tpcc2.public.warehouse` on the cluster:
@@ -183,7 +203,7 @@ curl --request POST \
183203
"restore_opts": {
184204
"into_db": "tpcc2"
185205
}
186-
}
206+
}'
187207
~~~
188208

189209
To restore a specific backup rather than the most recently created managed backup, include the `backup_id` field specifying a backup ID:
@@ -203,8 +223,30 @@ curl --request POST \
203223
"table": "warehouse"
204224
}
205225
]
206-
}
226+
}'
227+
~~~
228+
229+
{% if page.name == "managed-backups-advanced.md" %}
230+
To restore a table from a managed backup into a different cluster, send the restore request to the target cluster ID. Specify the ID of the backup's cluster as `source_cluster_id`. Both the source cluster and the target cluster must use the Advanced plan.
231+
232+
{% include_cached copy-clipboard.html %}
233+
~~~ shell
234+
curl --request POST \
235+
--url 'https://cockroachlabs.cloud/api/v1/clusters/{target_cluster_id}/restores' \
236+
--header "Authorization: Bearer {secret_key}" \
237+
--json '{
238+
"source_cluster_id": "{source_cluster_id}",
239+
"type": "TABLE",
240+
"objects": [
241+
{
242+
"database": "tpcc",
243+
"schema": "public",
244+
"table": "warehouse"
245+
}
246+
]
247+
}'
207248
~~~
249+
{% endif %}
208250

209251
You can specify additional options for the restore operations in the `restore_opts` object. For more information, see the [API endpoint documentation](https://www.cockroachlabs.com/docs/api/cloud/v1#get-/api/v1/clusters/-cluster_id-/restores-config).
210252

0 commit comments

Comments
 (0)