Project

General

Profile

Keep server » History » Version 13

Tom Clegg, 05/23/2014 05:10 PM

1 7 Tom Clegg
h1. Keep server
2 1 Tom Clegg
3 7 Tom Clegg
This page describes the Keep backing store server component, keepd.
4 1 Tom Clegg
5
{{toc}}
6
7
See also:
8 7 Tom Clegg
* [[Keep]] (overview, design goals, client/server responsibilities, intro to content addressing)
9 5 Tim Pierce
* [[Keep manifest format]]
10
* [[Keep index]]
11 13 Tom Clegg
* source:services/keep
12 5 Tim Pierce
13 4 Tom Clegg
h2. Todo
14
15 13 Tom Clegg
* Spec private key deployment mechanism
16 4 Tom Clegg
* Spec event-reporting API
17
* Spec quota mechanism
18
19 2 Tom Clegg
h2. Responsibilities
20
21
* Read and write blobs on disk
22 8 Tom Clegg
* Remember when each blob was last written[1]
23 2 Tom Clegg
* Enforce maximum blob size
24
* Enforce key=hash(value) during read and write
25
* Enforce permissions when reading data (according to permissions on Collections in the metadata DB)
26
* Enforce usage quota when writing data
27
* Delete blobs (only when requested by data manager!)
28 1 Tom Clegg
* Report read/write/exception events
29 8 Tom Clegg
* Report used & free space
30 1 Tom Clegg
* Report hardware status (SMART)
31 8 Tom Clegg
* Report list of blobs on disk (hash, size, time last stored)
32
33
fn1. This helps with garbage collection. Re-writing an already-stored blob should push it to the back of the garbage collection queue. Ordering garbage collection this way provides a fair and more or less predictable interval between write (from the client's perspective) and earliest potential deletion.
34 2 Tom Clegg
35
h2. Other parties
36
37
* Client distributes data across the available Keep servers (using the content hash)
38
* Client attains initial replication level when writing blobs (by writing to multiple Keep servers)
39
* Data manager decides which blobs to delete (e.g., garbage collection, rebalancing)
40 1 Tom Clegg
41 2 Tom Clegg
h2. Discovering Keep server URIs
42 1 Tom Clegg
43
* @GET https://endpoint/arvados/v1/keep_disks@
44
* see http://doc.arvados.org/api/schema/KeepDisk.html
45 13 Tom Clegg
* Initially "list of Keep servers" was "list of unique {host,port} across all Keep disks". Proper "keep services" API added in #2776.
46 1 Tom Clegg
47
h2. Supported methods
48
49
For storage clients
50
* GET /hash
51
* GET /hash?checksum=true → verify checksum before sending
52
* PUT /hash (body=content) → hash
53
* HEAD /hash → does it exist here?
54
* HEAD /hash?checksum=true → read the data and verify checksum
55
56
For system (monitoring, indexing, garbage collection)
57
* DELETE /hash → delete all copies of this blob (requires privileged token!)
58 11 Tom Clegg
* GET /index.txt → get full list of blocks stored here, including size and unix timestamp of most recent PUT (requires privileged token)
59 1 Tom Clegg
* GET /state.json → get list of backing filesystems, disk fullness, IO counters, perhaps recent IO statistics (requires privileged token)
60 9 Tom Clegg
61
Example index.txt:
62
63
<pre>
64
37b51d194a7513e45b56f6524f2d51f2+3 1396976219
65
acbd18db4cc2f85cedef654fccc4a4d8+3 1396976187
66
</pre>
67
68
Example status.json:
69
70
<pre><code class="javascript">
71
{
72
 "volumes":[
73
  {"mount_point":"/data/disk0","bytes_free":4882337792,"bytes_used":5149708288},
74
  {"mount_point":"/data/disk1","bytes_free":39614472192,"bytes_used":3314229248}
75
 ]
76
}
77
</code></pre>
78 1 Tom Clegg
79
h2. Authentication
80
81
* Client provides API token in Authorization header
82
* Config knob to ignore authentication & permissions (for fully-shared site, and help transition from Keep1)
83
84
h2. Permission
85
86
A signature token, unique to a {blob_hash, arvados_api_token, expiry_time}, establishes permission to read a block.
87
88 10 Tom Clegg
The controller and each Keep server has a private key.
89 1 Tom Clegg
90
Writing:
91
* If the given hash and content agree, whether or not a disk write is required, Keep server creates a +Asignature@expirytime portion to the returned blob locator.
92
* The API server @collections.create@ method verifies signatures before giving the current user can_read permission on the collection.
93 4 Tom Clegg
* A suitably intelligent client can notice that the expirytimes on its blob hashes are getting old, and refresh them by generating a partial manifest, calling @collections.create@ followed by @collections.get@, and optionally deleting the partial manifest(s) when the full manifest is written. If extra partial manifests are left around, garbage collection will take care of them eventually; the only odd side effect is the existence of partial manifests. *(Should there be a separate "refresh all of these tokens for me" API call to avoid creating these intermediate manifests?)*
94 1 Tom Clegg
95
Reading:
96
* The API server @collections.get@ method returns two manifests. One has plain hashes (this is the one whose content hash is the collection UUID). The other has a @+Asignature@expirytime@ portion on each blob locator.
97
* Keep server verifies signatures before honoring @GET@ requests.
98
* The signature might come from either the Keep node itself, a different Keep node, or the API server.
99
* A suitably intelligent client can notice that the expirytime on its blob hashes is too old, and request a fresh set via @collections.get@.