16421: documentation: check in all new files.
[arvados.git] / doc / admin / keep-recovering-data.html.textile.liquid
1 ---
2 layout: default
3 navsection: admin
4 title: "Recovering data"
5 ...
6
7 {% comment %}
8 Copyright (C) The Arvados Authors. All rights reserved.
9
10 SPDX-License-Identifier: CC-BY-SA-3.0
11 {% endcomment %}
12
13 h2(#recover_collection). Recovering collections
14
15 To recover a collection the manifest is required. Arvados has a built-in audit log, which consists of a row added to the "logs" table in the PostgreSQL database each time an Arvados object is created, modified, or deleted. Collection manifests are included, unless they are listed in the @UnloggedAttributes@ configuration parameter. The audit log is retained for up to @MaxAge@.
16
17 In some cases, it is possible to recover files that have been lost by modifying or deleting a collection.
18
19 Possibility of recovery depends on many factors, including:
20 * Whether the collection manifest is still available, e.g., in an audit log entry
21 * Whether the data blocks are also referenced by other collections
22 * Whether the data blocks have been unreferenced long enough to be marked for deletion/trash by keep-balance
23 * Blob signature TTL, trash lifetime, trash check interval, and other config settings
24
25 To attempt recovery of a previous version of a deleted/modified collection, use the @arvados-server recover-collection@ command. It should be run on one of your server nodes where the @arvados-server@ package is installed and the @/etc/arvados/config.yml@ file is up to date.
26
27 Specify the collection you want to recover by passing either the UUID of an audit log entry, or a file containing the manifest.
28
29 If recovery is successful, the @recover-collection@ program saves the recovered data a new collection belonging to the system user, and prints the new collection's UUID on stdout.
30
31 <pre>
32 # arvados-server recover-collection 9tee4-57u5n-nb5awmk1pahac2t
33 INFO[2020-06-05T19:52:29.557761245Z] loaded log entry                              logged_event_time="2020-06-05 16:48:01.438791 +0000 UTC" logged_event_type=update old_collection_uuid=9tee4-4zz18-1ex26g95epmgw5w src=9tee4-57u5n-nb5awmk1pahac2t
34 INFO[2020-06-05T19:52:29.642145127Z] recovery succeeded                            UUID=9tee4-4zz18-5trfp4k4xxg97f1 src=9tee4-57u5n-nb5awmk1pahac2t
35 9tee4-4zz18-5trfp4k4xxg97f1
36 INFO[2020-06-05T19:52:29.644699436Z] exiting
37 </pre>
38
39 In this example, the original data has been restored and saved in a new collection with UUID @9tee4-4zz18-5trfp4k4xxg97f1@.
40
41 For more options, run @arvados-server recover-collection -help@.
42
43 h2(#untrashing_lost_blocks). Untrashing lost blocks
44
45 In some cases it is possible to recover data blocks that were trashed erroneously by @keep-balance@ (e.g. due to an install/config error).
46
47 If you suspect blocks have been trashed erroneously, you should immediately:
48
49 * On all keepstore servers: set @BlobTrashCheckInterval@ to a long time like 2400h
50 * On all keepstore servers: restart keepstore
51 * Stop the keep-balance service
52
53 When you think you have corrected the underlying problem, you should:
54
55 * Set @BlobMissingReport@ to a suitable value (perhaps "/tmp/keep-balance-lost-blocks.txt").
56 * Start @keep-balance@
57 * After @keep-balance@ completes its first sweep, inspect /tmp/keep-balance-lost-blocks.txt. If it's not empty, you can request all keepstores to untrash any blocks that are still recoverable with a script like this:
58
59 <notextile>
60 <pre><code>
61 #!/bin/bash
62 set -e
63
64 # see Client.AuthToken in /etc/arvados/keep-balance/keep-balance.yml
65 token=xxxxxxx-your-system-auth-token-xxxxxxx
66
67 # all keep server hostnames
68 hosts=(keep0 keep1 keep2 keep3 keep4 keep5)
69
70 while read hash pdhs; do
71   echo "${hash}"
72   for h in ${hosts[@]}; do
73     if curl -fgs -H "Authorization: Bearer $token" -X PUT "http://${h}:25107/untrash/$hash"; then
74       echo "${hash} ok ${host}"
75     fi
76   done
77 done < /tmp/keep-balance-lost-blocks.txt
78 </code>
79 </pre>
80 </notextile>
81
82 Obviously this could be improved upon with increased parallelism for large scale tasks, if needed. Any blocks which were successfully untrashed can be removed from the list of blocks and collections which need to be recovered.
83
84 h2(#regenerating_lost_blocks). Regenerating lost blocks
85
86 For blocks which were trashed long enough ago that they've been deleted, it may be possible to regenerate them by rerunning the workflows which generated them. To do this, the process is:
87
88 * Delete the affected collections so that job reuse doesn't attempt to reuse them (it's likely that if one block is missing, they all are, so they're unlikely to contain any useful data)
89 * Resubmit any container requests for which you want the output collections regenerated
90
91 The Arvados repository contains a tool that can be used to generate a report to help with this task at "arvados/tools/keep-xref/keep-xref.py":https://github.com/arvados/arvados/blob/master/tools/keep-xref/keep-xref.py