Skip to content

Commit 4728ca3

Browse files
kbatuigasDeflaimunFeediver1JakeSCahillpgellert
authored
Single source mount/unmount (#874)
Co-authored-by: Paulo Borges <[email protected]> Co-authored-by: Joyce Fee <[email protected]> Co-authored-by: Jake Cahill <[email protected]> Co-authored-by: Gellért Peresztegi-Nagy <[email protected]> Co-authored-by: Angela Simms <[email protected]> Co-authored-by: Michele Cyran <[email protected]> Co-authored-by: JakeSCahill <[email protected]>
1 parent 89c5a90 commit 4728ca3

File tree

3 files changed

+141
-11
lines changed

3 files changed

+141
-11
lines changed

local-antora-playbook.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ content:
1717
- url: https://github.com/redpanda-data/docs
1818
branches: [v/*, api, shared, site-search,'!v-end-of-life/*']
1919
- url: https://github.com/redpanda-data/cloud-docs
20-
branches: main
20+
branches: 'main'
2121
- url: https://github.com/redpanda-data/redpanda-labs
2222
branches: main
2323
start_paths: [docs,'*/docs']

modules/manage/pages/mountable-topics.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
:page-categories: Management
55
:env-linux: true
66

7+
For topics with Tiered Storage enabled, you can unmount a topic to safely detach it from a cluster and keep the topic data in the cluster's object storage bucket or container. You can mount the detached topic to either the same origin cluster, or a different one. This allows you to hibernate a topic and free up system resources taken up by the topic, or migrate a topic to a different cluster.
8+
79
include::manage:partial$mountable-topics.adoc[]

modules/manage/partials/mountable-topics.adoc

Lines changed: 138 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1-
For topics with Tiered Storage enabled, you can unmount a topic to safely detach it from a cluster and keep the topic data in the cluster's object storage bucket or container. You can mount the detached topic to either the same origin cluster, or a different one. This allows you to hibernate a topic and free up system resources taken up by the topic, or migrate a topic to a different cluster.
2-
31
== Prerequisites
42

53
[NOTE]
64
====
75
include::shared:partial$enterprise-license.adoc[]
86
====
97

8+
ifndef::env-cloud[]
109
. xref:get-started:rpk-install.adoc[Install `rpk`], or ensure that you have access to the Admin API.
1110
. Enable xref:manage:tiered-storage.adoc[Tiered Storage] for specific topics, or for the entire cluster (all topics).
11+
endif::[]
12+
ifdef::env-cloud[]
13+
. xref:manage:rpk/rpk-install.adoc[Install `rpk`] to run cluster mount and unmount operations on the command line, or xref:manage:api/cloud-api-authentication.adoc[authenticate] to the Cloud API and execute these operations programmatically.
14+
+
15+
If using the Cloud API, you'll make requests against Data Plane APIs. Make sure you xref:manage:api/cloud-dataplane-api.adoc#get-data-plane-api-url[retrieve the Data Plane API URL] and use this URL to perform a mount or unmount operation.
16+
. Enable xref:ROOT:manage:tiered-storage.adoc[Tiered Storage] for the topics you want to unmount or mount.
17+
endif::[]
18+
1219

1320
== Unmount a topic from a cluster to object storage
1421

@@ -32,6 +39,7 @@ In your cluster, run this command to unmount a topic to object storage:
3239
rpk cluster storage unmount <namespace>/<topic-name>
3340
```
3441
--
42+
ifndef::env-cloud[]
3543
Admin API::
3644
+
3745
--
@@ -55,9 +63,27 @@ curl -X POST http://localhost:9644/v1/topics/unmount -d {
5563
5664
You may optionally include the topic namespace (`ns`). Only `kafka` is supported.
5765
--
66+
endif::[]
67+
ifdef::env-cloud[]
68+
Cloud API::
69+
+
70+
--
71+
To unmount topics from a cluster using the Cloud API, issue a POST request to the `/v1alpha2/cloud-storage/unmount` endpoint. Specify the names of the desired topics in the request body:
72+
73+
[,bash]
74+
----
75+
curl -X POST "<dataplane-api-url>/v1alpha2/cloud-storage/topics/unmount" \
76+
-H "Authorization: Bearer <token>" \
77+
-H "accept: application/json" \
78+
-H "content-type: application/json" \
79+
-d '{"topics":"<topic-name>"}'
80+
----
81+
82+
--
83+
endif::[]
5884
======
5985

60-
You can use the ID returned by the command to <<monitor-progress,monitor the progress>> of the unmount operation using `rpk` or the Admin API.
86+
You can use the ID returned by the command to <<monitor-progress,monitor the progress>> of the unmount operation using `rpk` or the API.
6187

6288
== Mount a topic to a cluster
6389

@@ -99,6 +125,7 @@ rpk cluster storage mount <topic-reference> --to <new-topic-name>
99125
+
100126
You only use the new name for the topic in the target cluster. This name does not persist if you unmount this topic again. Redpanda keeps the original name in object storage if you remount the topic later.
101127
--
128+
ifndef::env-cloud[]
102129
Admin API::
103130
+
104131
--
@@ -110,7 +137,7 @@ curl http://localhost:9644/v1/topics/mountable
110137
+
111138
The response object contains an array of topics:
112139
+
113-
[,bash,role=no-placeholders]
140+
[,bash]
114141
----
115142
"topics": [
116143
{
@@ -133,28 +160,74 @@ curl -X POST http://localhost:9644/v1/topics/mount -d {
133160
"topics": [
134161
{
135162
"source_topic_reference": {"ns": "kafka", "topic": "<topic-1-name>/<cluster-1-uuid>/<initial-revision>"},
136-
"alias": {"ns": "kafka", "topic": "<new-topic-1-name>"}
163+
"alias": {"topic": "<new-topic-1-name>"}
137164
},
138165
{
139166
"source_topic_reference": {"ns": "kafka", "topic": "<topic-2-name>"}
167+
}
168+
]
169+
}
170+
```
171+
+
172+
* `ns` is the topic namespace. This field is optional and only `kafka` is supported.
173+
* You may have multiple topics with the same name that are available to mount from object storage. This can happen if you have unmounted topics using the same name in different clusters. To uniquely identify a source topic, use `<topic-name>/<cluster-uuid>/<initial-revision>` as the topic reference.
174+
* To rename a topic in the target cluster, use the optional `alias` object in the request body. The following example shows how to specify a new name for topic 1 in the target cluster, while topic 2 retains its original name in the target cluster.
175+
176+
--
177+
endif::[]
178+
ifdef::env-cloud[]
179+
Cloud API::
180+
+
181+
--
182+
. List the topics that are available to mount from object storage by making a GET request to the `/v1alpha2/cloud-storage/topics/mountable` endpoint.
183+
+
184+
```
185+
curl "<dataplane-api-url>/v1alpha2/cloud-storage/topics/mountable"
186+
```
187+
+
188+
The response object contains an array of topics:
189+
+
190+
[,bash,role=no-placeholders]
191+
----
192+
"topics": [
193+
{
194+
"name": "topic-1-name",
195+
"topic_location": "topic-1-name/<cluster-1-uuid>/<initial-revision>"
196+
},
197+
{
198+
"name": "topic-2-name",
199+
"topic_location": "topic-2-name/<cluster-1-uuid>/<initial-revision>"
200+
}
201+
]
202+
----
203+
+
204+
The `topic_location` is the unique topic location in object storage, in the format `<topic-name>/<cluster-uuid>/<initial-revision>`. Redpanda assigns the number `initial-revision` to a topic upon creation. You can use `topic-location` as the topic reference instead of just the topic name to identify a unique topic to mount in the next step.
205+
206+
. To mount topics to a target cluster using the Cloud API, make a POST request to the `/cloud-storage/topics/mount` endpoint. Specify the names of the topics in the request body:
207+
+
208+
```
209+
curl -X POST "<dataplane-api-url>/v1alpha2/cloud-storage/topics/mount" -d {
210+
"topics": [
211+
{
212+
"alias": "<new-topic-1-name>",
213+
"source_topic_reference": "<topic-1-name>/<cluster-1-uuid>/<initial-revision>"
140214
},
141215
{
142-
"source_topic_reference": {"ns": "kafka", "topic": "<topic-3-name>/<cluster-2-uuid>/<initial-revision>"},
143-
"alias": {"ns": "kafka", "topic": "<new-topic-3-name>"}
216+
"source_topic_reference": "<topic-2-name>"
144217
}
145218
]
146219
}
147220
```
148221
+
149-
* `ns` is the topic namespace. This field is optional and only `kafka` is supported.
150222
* You may have multiple topics with the same name that are available to mount from object storage. This can happen if you have unmounted topics with this name from different clusters. To uniquely identify a source topic, use `<topic-name>/<cluster-uuid>/<initial-revision>` as the topic reference.
151-
* To rename a topic in the target cluster, use the optional `alias` object in the request body. In the example, you specify new names for topics 1 and 3 in the target cluster, but topic 2 retains its original name in the target cluster.
223+
* To rename a topic in the target cluster, use the optional `alias` object in the request body. The following example shows how to specify a new name for topic 1 in the target cluster, while topic 2 retains its original name in the target cluster.
152224
153225
--
226+
endif::[]
154227
155228
======
156229

157-
You can use the ID returned by the operation to <<monitor-progress,monitor its progress>> using `rpk` or the Admin API.
230+
You can use the ID returned by the operation to <<monitor-progress,monitor its progress>> using `rpk` or the API.
158231

159232
When the mount operation is complete, the target cluster handles produce and consume workloads for the topics.
160233

@@ -172,6 +245,7 @@ rpk cluster storage list-mount
172245
```
173246
--
174247
248+
ifndef::env-cloud[]
175249
Admin API::
176250
+
177251
--
@@ -181,6 +255,23 @@ Issue a GET request to the `/migrations` endpoint to view the status of topic mo
181255
curl http://localhost:9644/v1/migrations
182256
```
183257
--
258+
endif::[]
259+
260+
ifdef::env-cloud[]
261+
Cloud API::
262+
+
263+
--
264+
Issue a GET request to the `/cloud-storage/mount-tasks` endpoint to view the status of topic mount and unmount operations:
265+
266+
[,bash]
267+
----
268+
curl "<dataplane-api-url>/v1alpha2/cloud-storage/mount-tasks" \
269+
-H "Authorization: Bearer <token>" \
270+
-H "accept: application/json"
271+
----
272+
273+
--
274+
endif::[]
184275
======
185276

186277
You can also retrieve the status of a specific operation by running the command:
@@ -195,13 +286,28 @@ rpk::
195286
rpk cluster storage status-mount <migration-id>
196287
```
197288
--
289+
ifndef::env-cloud[]
198290
Admin API::
199291
+
200292
--
201293
```
202294
curl http://localhost:9644/v1/migrations/<migration-id>
203295
```
204296
--
297+
endif::[]
298+
299+
ifdef::env-cloud[]
300+
Cloud API::
301+
+
302+
--
303+
[,bash]
304+
----
305+
curl "<dataplane-api-url>/v1alpha2/cloud-storage/mount-tasks/<migration-id>" \
306+
-H "Authorization: Bearer <token>"
307+
----
308+
309+
--
310+
endif::[]
205311
======
206312

207313
`<migration-id>` is the unique identifier of the operation. Redpanda returns this ID when you start a mount or unmount. You can also retrieve the ID by listing <<monitor-progress,existing operations>>.
@@ -260,18 +366,40 @@ rpk cluster storage cancel-mount <migration-id>
260366
```
261367
--
262368
369+
ifndef::env-cloud[]
263370
Admin API::
264371
+
265372
--
266373
```
267374
curl -X POST http://localhost:9644/v1/<migration-id>/?action=cancel
268375
```
269376
--
377+
endif::[]
378+
ifdef::env-cloud[]
379+
Cloud API::
380+
+
381+
--
382+
[,bash]
383+
----
384+
curl -X POST "<dataplane-api-url>/v1alpha2/cloud-storage/mount-tasks/<id>" \
385+
-H "Authorization: Bearer <token>" \
386+
-H "accept: application/json" \
387+
-H "content-type: application/json" \
388+
-d '{"action":"ACTION_CANCEL"}'
389+
----
390+
391+
--
392+
endif::[]
270393
======
271394

272395
You cannot cancel mount and unmount operations in the following <<monitor-progress,states>>:
273396

397+
ifndef::env-cloud[]
274398
- `planned` (but you may still xref:api:ROOT:admin-api.adoc#delete-/v1/migrations/-id-[delete] a planned mount or unmount)
399+
endif::[]
400+
ifdef::env-cloud[]
401+
- `planned` (but you may still delete a planned mount or unmount)
402+
endif::[]
275403
- `cut_over`
276404
- `finished`
277405
- `canceling`

0 commit comments

Comments
 (0)