Fix 2.4.2 upgrade notes formatting refs #19330
[arvados.git] / doc / user / topics / arv-copy.html.textile.liquid
1 ---
2 layout: default
3 navsection: userguide
4 title: "Using arv-copy"
5 ...
6 {% comment %}
7 Copyright (C) The Arvados Authors. All rights reserved.
8
9 SPDX-License-Identifier: CC-BY-SA-3.0
10 {% endcomment %}
11
12 This tutorial describes how to copy Arvados objects from one cluster to another by using @arv-copy@.
13
14 {% include 'tutorial_expectations' %}
15
16 h2. arv-copy
17
18 @arv-copy@ allows users to copy collections, workflow definitions and projects from one cluster to another.
19
20 For projects, @arv-copy@ will copy all the collections workflow definitions owned by the project, and recursively copy subprojects.
21
22 For workflow definitions, @arv-copy@ will recursively go through the workflow and copy all associated dependencies (input collections and Docker images).
23
24 For example, let's copy from the <a href="https://playground.arvados.org/">Arvados playground</a>, also known as *pirca*, to *dstcl*. The names *pirca* and *dstcl* are interchangable with any cluster id. You can find the cluster name from the prefix of the uuid of the object you want to copy. For example, in *zzzzz*-4zz18-tci4vn4fa95w0zx, the cluster name is *zzzzz* .
25
26 In order to communicate with both clusters, you must create custom configuration files for each cluster.  The "Getting an API token":{{site.baseurl}}/user/reference/api-tokens.html page describes how to get a token and create a configuration file.  However, instead of "settings.conf" in @~/.config/arvados@ you need two configuration files, one for each cluster, with filenames in the format of *ClusterID.conf*.
27
28 In this example, navigate to the *Current token* page on each of *pirca* and *dstcl* to get the @ARVADOS_API_HOST@ and @ARVADOS_API_TOKEN@.
29
30 The config file consists of two lines, one for ARVADOS_API_HOST and one for ARVADOS_API_TOKEN:
31
32 <pre>
33 ARVADOS_API_HOST=zzzzz.arvadosapi.com
34 ARVADOS_API_TOKEN=v2/zzzzz-gj3su-xxxxxxxxxxxxxxx/123456789abcdefghijkl
35 </pre>
36
37 Copy your @ARVADOS_API_HOST@ and @ARVADOS_API_TOKEN@ into the config files as shown below in the shell account from which you are executing the commands.  In our example, you need two files, @~/.config/arvados/pirca.conf@ and @~/.config/arvados/dstcl.conf@.
38
39 Now you're ready to copy between *pirca* and *dstcl*!
40
41 h3. How to copy a collection
42
43 First, determine the uuid or portable data hash of the collection you want to copy from the source cluster. The uuid can be found in the collection display page in the collection summary area (top left box), or from the URL bar (the part after @collections/...@)
44
45 Now copy the collection from *pirca* to *dstcl*. We will use the uuid @jutro-4zz18-tv416l321i4r01e@ as an example. You can find this collection on <a href="https://playground.arvados.org/collections/jutro-4zz18-tv416l321i4r01e">playground.arvados.org</a>.
46 <notextile>
47 <pre><code>~$ <span class="userinput">arv-copy --src pirca --dst dstcl jutro-4zz18-tv416l321i4r01e</span>
48 jutro-4zz18-tv416l321i4r01e: 6.1M / 6.1M 100.0%
49 arvados.arv-copy[1234] INFO: Success: created copy with uuid dstcl-4zz18-xxxxxxxxxxxxxxx
50 </code></pre>
51 </notextile>
52
53 You can also copy by content address:
54
55 <notextile>
56 <pre><code>~$ <span class="userinput">arv-copy --src pirca --dst dstcl 2463fa9efeb75e099685528b3b9071e0+438</span>
57 2463fa9efeb75e099685528b3b9071e0+438: 6.1M / 6.1M 100.0%
58 arvados.arv-copy[1234] INFO: Success: created copy with uuid dstcl-4zz18-xxxxxxxxxxxxxxx
59 </code></pre>
60 </notextile>
61
62 The output of arv-copy displays the uuid of the collection generated in the destination cluster. By default, the output is placed in your home project in the destination cluster. If you want to place your collection in an existing project, you can specify the project you want it to be in using the tag @--project-uuid@ followed by the project uuid.
63
64 For example, this will copy the collection to project @dstcl-j7d0g-a894213ukjhal12@ in the destination cluster.
65
66 <notextile> <pre><code>~$ <span class="userinput">arv-copy --src pirca --dst dstcl --project-uuid dstcl-j7d0g-a894213ukjhal12 jutro-4zz18-tv416l321i4r01e
67 </code></pre>
68 </notextile>
69
70 Additionally, if you need to specify the storage classes where to save the copied data on the destination cluster, you can do that by using the @--storage-classes LIST@ argument, where @LIST@ is a comma-separated list of storage class names.
71
72 h3. How to copy a workflow
73
74 We will use the uuid @jutro-7fd4e-mkmmq53m1ze6apx@ as an example workflow.
75
76 <notextile>
77 <pre><code>~$ <span class="userinput">arv-copy --src jutro --dst pirca --project-uuid pirca-j7d0g-ecak8knpefz8ere jutro-7fd4e-mkmmq53m1ze6apx</span>
78 ae480c5099b81e17267b7445e35b4bc7+180: 23M / 23M 100.0%
79 2463fa9efeb75e099685528b3b9071e0+438: 156M / 156M 100.0%
80 jutro-4zz18-vvvqlops0a0kpdl: 94M / 94M 100.0%
81 2020-08-19 17:04:13 arvados.arv-copy[4789] INFO:
82 2020-08-19 17:04:13 arvados.arv-copy[4789] INFO: Success: created copy with uuid pirca-7fd4e-s0tw9rfbkpo2fmx
83 </code></pre>
84 </notextile>
85
86 The name, description, and workflow definition from the original workflow will be used for the destination copy. In addition, any *collections* and *docker images* referenced in the source workflow definition will also be copied to the destination.
87
88 If you would like to copy the object without dependencies, you can use the @--no-recursive@ flag.
89
90 h3. How to copy a project
91
92 We will use the uuid @jutro-j7d0g-xj19djofle3aryq@ as an example project.
93
94 <notextile>
95 <pre><code>~$ <span class="userinput">peteramstutz@shell:~$ arv-copy --project-uuid pirca-j7d0g-lr8sq3tx3ovn68k jutro-j7d0g-xj19djofle3aryq
96 2021-09-08 21:29:32 arvados.arv-copy[6377] INFO:
97 2021-09-08 21:29:32 arvados.arv-copy[6377] INFO: Success: created copy with uuid pirca-j7d0g-ig9gvu5piznducp
98 </code></pre>
99 </notextile>
100
101 The name and description of the original project will be used for the destination copy.  If a project already exists with the same name, collections and workflow definitions will be copied into the project with the same name.
102
103 If you would like to copy the project but not its subproject, you can use the @--no-recursive@ flag.