13647: Merge branch 'master' into 13647-keepstore-config
[arvados.git] / doc / install / install-keepstore.html.textile.liquid
1 ---
2 layout: default
3 navsection: installguide
4 title: Install Keepstore servers
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 Keepstore provides access to underlying storage for reading and writing content-addressed blocks, with enforcement of Arvados permissions.  Keepstore supports a variety of cloud object storage and POSIX filesystems for its backing store.
13
14 h3. Plan your storage layout
15
16 In the steps below, you will configure a number of backend storage volumes (like local filesystems and S3 buckets) and specify which keepstore servers have read-only and read-write access to which volumes.
17
18 It is possible to configure arbitrary server/volume layouts. However, in order to provide good performance and efficient use of storage resources, we strongly recommend using one of the following layouts:
19
20 # Each volume is writable by exactly one server, and optionally readable by one or more other servers. The total capacity of all writable volumes is the same for each server.
21 # Each volume is writable by all servers. Each volume has enough built-in redundancy to satisfy your requirements, i.e., you do not need Arvados to mirror data across multiple volumes.
22
23 We recommend starting off with two Keepstore servers.  Exact server specifications will be site and workload specific, but in general keepstore will be I/O bound and should be set up to maximize aggregate bandwidth with compute nodes.  To increase capacity (either space or throughput) it is straightforward to add additional servers, or (in cloud environments) to increase the machine size of the existing servers.
24
25 By convention, we use the following hostname pattern:
26
27 <div class="offset1">
28 table(table table-bordered table-condensed).
29 |_Hostname_|
30 |keep0.@uuid_prefix@.your.domain|
31 |keep1.@uuid_prefix@.your.domain|
32 </div>
33
34 Keepstore servers should not be directly accessible from the Internet (they are accessed via "keepproxy":install-keepproxy.html), so the hostnames only need to resolve on the private network.
35
36 h2. Install Keepstore
37
38 On Debian-based systems:
39
40 <notextile>
41 <pre><code>~$ <span class="userinput">sudo apt-get install keepstore</span>
42 </code></pre>
43 </notextile>
44
45 On Red Hat-based systems:
46
47 <notextile>
48 <pre><code>~$ <span class="userinput">sudo yum install keepstore</span>
49 </code></pre>
50 </notextile>
51
52 Verify that Keepstore is functional:
53
54 <notextile>
55 <pre><code>~$ <span class="userinput">keepstore --version</span>
56 </code></pre>
57 </notextile>
58
59 h3. Create a superuser token
60
61 If you haven't already done so, create a superuser token.
62
63 {% include 'create_superuser_token' %}
64
65 h3. Update cluster config file
66
67 Add or update the following sections of @/etc/arvados/config.yml@ as needed. Refer to the examples and comments in the "default config.yml file":{{site.baseurl}}/admin/config.html for more information.
68
69 <notextile>
70 <pre><code>Clusters:
71   <span class="userinput">uuid_prefix</span>:
72     SystemRootToken: zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
73     Services:
74       Keepstore:
75         InternalURLs:
76           "http://<span class="userinput">keep0.uuid_prefix.example.com</span>:25107/": {}
77     API:
78       MaxKeepBlobBuffers: 128
79 </code></pre>
80 </notextile>
81
82 h3. Notes on storage management
83
84 On its own, a keepstore server never deletes data.  The "keep-balance":install-keep-balance.html service determines which blocks are candidates for deletion and instructs the keepstore to move those blocks to the trash.
85
86 When a block is newly written, it is protected from deletion for the duration in @BlobSigningTTL@.  During this time, it cannot be trashed or deleted.
87
88 If keep-balance instructs keepstore to trash a block which is older than @BlobSigningTTL@, and @BlobTrashLifetime@ is non-zero, the block will be moved to "trash".  A block which is in the trash is no longer accessible by read requests, but has not yet been permanently deleted.  Blocks which are in the trash may be recovered using the "untrash" API endpoint.  Blocks are permanently deleted after they have been in the trash for the duration in @BlobTrashLifetime@.
89
90 Keep-balance is also responsible for balancing the distribution of blocks across keepstore servers by asking servers to pull blocks from other servers (as determined by their "storage class":{{site.baseurl}}/admin/storage-classes.html and "rendezvous hashing order":{{site.baseurl}}/api/storage.html).  Pulling a block makes a copy.  If a block is overreplicated (i.e. there are excess copies) after pulling, it will be subsequently trashed and deleted on the original server, subject to @BlobTrash@ and @BlobTrashLifetime@ settings.
91
92 h3. Configure storage volumes
93
94 Available storage volume types include POSIX filesystems and cloud object storage.
95
96 * To use a POSIX filesystem, including both local filesystems (ext4, xfs) and network file system such as GPFS or Lustre, follow the setup instructions on "Filesystem storage":configure-fs-storage.html
97 * If you are using S3-compatible object storage (including Amazon S3, Google Cloud Storage, and Ceph RADOS), follow the setup instructions on "S3 Object Storage":configure-s3-object-storage.html
98 * If you are using Azure Blob Storage, follow the setup instructions on "Azure Blob Storage":configure-azure-blob-storage.html
99
100 h2. Run keepstore as a supervised service
101
102 h3. Start the service (option 1: systemd)
103
104 If your system does not use systemd, skip this section and follow the "runit instructions":#runit instead.
105
106 If your system uses systemd, the keepstore service should already be set up. Restart it to read the updated configuration, and check its status:
107
108 <notextile>
109 <pre><code>~$ <span class="userinput">sudo systemctl restart keepstore</span>
110 ~$ <span class="userinput">sudo systemctl status keepstore</span>
111 &#x25cf; keepstore.service - Arvados Keep Storage Daemon
112    Loaded: loaded (/etc/systemd/system/keepstore.service; enabled; vendor preset: enabled)
113    Active: active (running) since Tue 2019-09-10 14:16:29 UTC; 1s ago
114      Docs: https://doc.arvados.org/
115  Main PID: 25465 (keepstore)
116     Tasks: 9 (limit: 4915)
117    CGroup: /system.slice/keepstore.service
118            └─25465 /usr/bin/keepstore
119 [...]
120 </code></pre>
121 </notextile>
122
123 h3(#runit). Start the service (option 2: runit)
124
125 Install runit to supervise the keepstore daemon.  {% include 'install_runit' %}
126
127 Install this script as the run script @/etc/sv/keepstore/run@ for the keepstore service:
128
129 <notextile>
130 <pre><code>#!/bin/sh
131
132 exec 2>&1
133 GOGC=10 exec keepstore
134 </code></pre>
135 </notextile>
136
137 h2. Set up additional servers
138
139 Repeat the above sections to prepare volumes and bring up supervised services on each Keepstore server you are setting up.
140
141 h2. Restart the API server and controller
142
143 After adding all of your keepstore servers to the Services section, make sure the cluster config file is up to date on the API server host, and restart the API server and controller processes to ensure the changes are applied.
144
145 <pre>
146 sudo systemctl restart nginx arvados-controller
147 </pre>
148
149 h2(#testing). Testing keep
150
151 Install the "Python SDK":{{site.baseurl}}/sdk/python/sdk-python.html
152
153 @ARVADOS_API_HOST@ and @ARVADOS_API_TOKEN@ must be set in the environment.
154
155 You should now be able to use @arv-put@ to upload collections and @arv-get@ to fetch collections:
156
157 <pre>
158 $ echo "hello world!" > hello.txt
159
160 $ arv-put --portable-data-hash hello.txt
161 2018-07-12 13:35:25 arvados.arv_put[28702] INFO: Creating new cache file at /home/example/.cache/arvados/arv-put/1571ec0adb397c6a18d5c74cc95b3a2a
162 0M / 0M 100.0% 2018-07-12 13:35:27 arvados.arv_put[28702] INFO:
163
164 2018-07-12 13:35:27 arvados.arv_put[28702] INFO: Collection saved as 'Saved at 2018-07-12 17:35:25 UTC by example@example'
165 59389a8f9ee9d399be35462a0f92541c+53
166
167 $ arv-get 59389a8f9ee9d399be35462a0f92541c+53/hello.txt
168 hello world!
169 </pre>