Merge branch 'master' into 13822-nm-delayed-daemon
[arvados.git] / services / keep-balance / usage.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 package main
6
7 import (
8         "flag"
9         "fmt"
10         "os"
11 )
12
13 var exampleConfigFile = []byte(`
14 Client:
15     APIHost: zzzzz.arvadosapi.com:443
16     AuthToken: xyzzy
17     Insecure: false
18 KeepServiceTypes:
19     - disk
20 RunPeriod: 600s
21 CollectionBatchSize: 100000
22 CollectionBuffers: 1000
23 RequestTimeout: 30m`)
24
25 func usage() {
26         fmt.Fprintf(os.Stderr, `
27
28 keep-balance rebalances a set of keepstore servers. It creates new
29 copies of underreplicated blocks, deletes excess copies of
30 overreplicated and unreferenced blocks, and moves blocks to better
31 positions (according to the rendezvous hash algorithm) so clients find
32 them faster.
33
34 Usage: keep-balance [options]
35
36 Options:
37 `)
38         flag.PrintDefaults()
39         fmt.Fprintf(os.Stderr, `
40 Example config file:
41 %s
42
43     Client.AuthToken must be recognized by Arvados as an admin token,
44     and must be recognized by all Keep services as a "data manager
45     key".
46
47     Client.Insecure should be true if your Arvados API endpoint uses
48     an unverifiable SSL/TLS certificate.
49
50 Periodic scanning:
51
52     By default, keep-balance operates periodically, i.e.: do a
53     scan/balance operation, sleep, repeat.
54
55     RunPeriod determines the interval between start times of
56     successive scan/balance operations. If a scan/balance operation
57     takes longer than RunPeriod, the next one will follow it
58     immediately.
59
60     If SIGUSR1 is received during an idle period between operations,
61     the next operation will start immediately.
62
63 One-time scanning:
64
65     Use the -once flag to do a single operation and then exit. The
66     exit code will be zero if the operation was successful.
67
68 Committing:
69
70     By default, keep-service computes and reports changes but does not
71     implement them by sending pull and trash lists to the Keep
72     services.
73
74     Use the -commit-pull and -commit-trash flags to implement the
75     computed changes.
76
77 Tuning resource usage:
78
79     CollectionBatchSize limits the number of collections retrieved per
80     API transaction. If this is zero or omitted, page size is
81     determined by the API server's own page size limits (see
82     max_items_per_response and max_index_database_read configs).
83
84     CollectionBuffers sets the size of an internal queue of
85     collections. Higher values use more memory, and improve throughput
86     by allowing keep-balance to fetch the next page of collections
87     while the current page is still being processed. If this is zero
88     or omitted, pages are processed serially.
89
90     RequestTimeout is the maximum time keep-balance will spend on a
91     single HTTP request (getting a page of collections, getting the
92     block index from a keepstore server, or sending a trash or pull
93     list to a keepstore server). Defaults to 30 minutes.
94
95 Limitations:
96
97     keep-balance does not attempt to discover whether committed pull
98     and trash requests ever get carried out -- only that they are
99     accepted by the Keep services. If some services are full, new
100     copies of underreplicated blocks might never get made, only
101     repeatedly requested.
102
103 `, exampleConfigFile)
104 }