0f36c5d35acbfffcbb417b30c6faf352076b06d4
[arvados.git] / doc / install / install-keepstore.html.textile.liquid
1 ---
2 layout: default
3 navsection: installguide
4 title: Install Keepstore servers
5 ...
6
7 We are going to install two Keepstore servers. By convention, we use the following hostname pattern:
8
9 <div class="offset1">
10 table(table table-bordered table-condensed).
11 |_Hostname_|
12 |keep0.@uuid_prefix@.your.domain|
13 |keep1.@uuid_prefix@.your.domain|
14 </div>
15
16 Because the Keepstore servers are not directly accessible from the internet, these hostnames only need to resolve on the local network.
17
18 h2. Install Keepstore
19
20 On Debian-based systems:
21
22 <notextile>
23 <pre><code>~$ <span class="userinput">sudo apt-get install keepstore</span>
24 </code></pre>
25 </notextile>
26
27 On Red Hat-based systems:
28
29 <notextile>
30 <pre><code>~$ <span class="userinput">sudo yum install keepstore</span>
31 </code></pre>
32 </notextile>
33
34 Verify that Keepstore is functional:
35
36 <notextile>
37 <pre><code>~$ <span class="userinput">keepstore -h</span>
38 2015/05/08 13:41:16 keepstore starting, pid 2565
39 Usage of ./keepstore:
40   -azure-storage-account-key-file="": File containing the account key used for subsequent --azure-storage-container-volume arguments.
41   -azure-storage-account-name="": Azure storage account name used for subsequent --azure-storage-container-volume arguments.
42   -azure-storage-container-volume=[]: Use the given container as a storage volume. Can be given multiple times.
43   -azure-storage-replication=3: Replication level to report to clients when data is stored in an Azure container.
44   -blob-signature-ttl=1209600: Lifetime of blob permission signatures. This will become a part of the signing key, and will cause clients to retry or fail if changed while they are in progress. See services/api/config/application.default.yml.
45   -blob-signing-key-file="": File containing the secret key for generating and verifying blob permission signatures.
46   -data-manager-token-file="": File with the API token used by the Data Manager. All DELETE requests or GET /index requests must carry this token.
47   -enforce-permissions=false: Enforce permission signatures on requests.
48   -listen=":25107": Listening address, in the form "host:port". e.g., 10.0.1.24:8000. Omit the host part to listen on all interfaces.
49   -max-buffers=128: Maximum RAM to use for data buffers, given in multiples of block size (64 MiB). When this limit is reached, HTTP requests requiring buffers (like GET and PUT) will wait for buffer space to be released.
50   -never-delete=false: If set, nothing will be deleted. HTTP 405 will be returned for valid DELETE requests.
51   -permission-key-file="": Synonym for -blob-signing-key-file.
52   -permission-ttl=0: Synonym for -blob-signature-ttl.
53   -pid="": Path to write pid file during startup. This file is kept open and locked with LOCK_EX until keepstore exits, so `fuser -k pidfile` is one way to shut down. Exit immediately if there is an error opening, locking, or writing the pid file.
54   -readonly=false: Do not write, delete, or touch anything on the following volumes.
55   -serialize=false: Serialize read and write operations on the following volumes.
56   -volume=[]: Local storage directory. Can be given more than once to add multiple directories. If none are supplied, the default is to use all directories named "keep" that exist in the top level directory of a mount point at startup time. Can be a comma-separated list, but this is deprecated: use multiple -volume arguments instead.
57   -volumes=[]: Deprecated synonym for -volume.
58 </code></pre>
59 </notextile>
60
61 h3. Prepare storage volumes
62
63 {% include 'notebox_begin' %}
64 This section uses a local filesystem as a backing store. If you are using Azure Storage, follow the setup instructions on the "Azure Blob Storage":configure-azure-blob-storage.html page instead.
65 {% include 'notebox_end' %}
66
67 There are two ways to specify a set of local directories where keepstore should store its data files.
68 # Implicitly, by creating a directory called @keep@ at the top level of each filesystem you intend to use, and omitting @-volume@ arguments.
69 # Explicitly, by providing a @-volume@ argument for each directory.
70
71 For example, if there are filesystems mounted at @/mnt@ and @/mnt2@:
72
73 <notextile>
74 <pre><code>~$ <span class="userinput">mkdir /mnt/keep /mnt2/keep</span>
75 ~$ <span class="userinput">keepstore</span>
76 2015/05/08 13:44:26 keepstore starting, pid 2765
77 2015/05/08 13:44:26 Using volume [UnixVolume /mnt/keep] (writable=true)
78 2015/05/08 13:44:26 Using volume [UnixVolume /mnt2/keep] (writable=true)
79 2015/05/08 13:44:26 listening at :25107
80 </code></pre>
81 </notextile>
82
83 Equivalently:
84
85 <notextile>
86 <pre><code>~$ <span class="userinput">mkdir /mnt/keep /mnt2/keep</span>
87 ~$ <span class="userinput">keepstore -volume=/mnt/keep -volume=/mnt2/keep</span>
88 2015/05/08 13:44:26 keepstore starting, pid 2765
89 2015/05/08 13:44:26 Using volume [UnixVolume /mnt/keep] (writable=true)
90 2015/05/08 13:44:26 Using volume [UnixVolume /mnt2/keep] (writable=true)
91 2015/05/08 13:44:26 listening at :25107
92 </code></pre>
93 </notextile>
94
95 h3. Run keepstore as a supervised service
96
97 Install runit to supervise the keepstore daemon.  {% include 'install_runit' %}
98
99 Install this script as the run script for the keepstore service, modifying it as directed below.
100
101 <notextile>
102 <pre><code>#!/bin/sh
103
104 exec 2>&1
105 exec GOGC=10 GOMAXPROCS=<span class="userinput">4</span> keepstore \
106  -enforce-permissions=true \
107  -blob-signing-key-file=<span class="userinput">/etc/keepstore/blob-signing.key</span> \
108  -max-buffers=<span class="userinput">100</span> \
109  -serialize=true \
110  -volume=<span class="userinput">/mnt/keep</span> \
111  -volume=<span class="userinput">/mnt2/keep</span>
112 </code></pre>
113 </notextile>
114
115 The @GOMAXPROCS@ environment variable determines the maximum number of concurrent threads, and should normally be set to the number of CPU cores present.
116
117 The @-max-buffers@ argument limits keepstore's memory usage. It should be set such that @max-buffers * 64MiB + 10%@ fits comfortably in memory. For example, @-max-buffers=100@ is suitable for a host with 8 GiB RAM.
118
119 If you want access control on your Keepstore server(s), you must specify the @-enforce-permissions@ flag and provide a signing key. The @-blob-signing-key-file@ argument should be a file containing a long random alphanumeric string with no internal line breaks (it is also possible to use a socket or FIFO: keepstore reads it only once, at startup). This key must be the same as the @blob_signing_key@ configured in the "API server's":install-api-server.html configuration file, @/etc/arvados/api/application.yml@.
120
121 The @-serialize=true@ (default: @false@) argument limits keepstore to one reader/writer process per storage partition. This avoids thrashing by allowing the storage device underneath the storage partition to do read/write operations sequentially. Enabling @-serialize@ can improve Keepstore performance if the storage partitions map 1:1 to physical disks that are dedicated to Keepstore, particularly so for mechanical disks. In some cloud environments, enabling @-serialize@ has also also proven to be beneficial for performance, but YMMV. If your storage partition(s) are backed by network or RAID storage that can handle many simultaneous reader/writer processes without thrashing, you probably do not want to set @-serialize@.
122
123 h3. Set up additional servers
124
125 Repeat the above sections to prepare volumes and bring up supervised services on each Keepstore server you are setting up.
126
127 h3. Tell the API server about the Keepstore servers
128
129 The API server needs to be informed about the presence of your Keepstore servers. For each of the Keepstore servers you have created, please execute the following commands on your <strong>shell server</strong>.
130
131 Make sure to update the @service_host@ value to match each of your Keepstore servers.
132
133 <notextile>
134 <pre><code>~$ <span class="userinput">prefix=`arv --format=uuid user current | cut -d- -f1`</span>
135 ~$ <span class="userinput">echo "Site prefix is '$prefix'"</span>
136 ~$ <span class="userinput">read -rd $'\000' keepservice &lt;&lt;EOF; arv keep_service create --keep-service "$keepservice"</span>
137 <span class="userinput">{
138  "service_host":"<strong>keep0.$prefix.your.domain</strong>",
139  "service_port":25107,
140  "service_ssl_flag":false,
141  "service_type":"disk"
142 }
143 EOF</span>
144 </code></pre></notextile>