-
Notifications
You must be signed in to change notification settings - Fork 393
/
riak_core.schema
256 lines (229 loc) · 7.91 KB
/
riak_core.schema
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
%%-*- mode: erlang -*-
%% Default Bucket Properties
%% @doc The number of replicas stored. Note: See Replication
%% Properties for further discussion.
%% http://docs.basho.com/riak/latest/dev/advanced/cap-controls/
{mapping, "buckets.default.n_val", "riak_core.default_bucket_props.n_val", [
{datatype, integer},
{default, 3},
hidden
]}.
%% @doc Number of partitions in the cluster (only valid when first
%% creating the cluster). Must be a power of 2, minimum 8 and maximum
%% 1024.
{mapping, "ring_size", "riak_core.ring_creation_size", [
{datatype, integer},
{default, 64},
{validators, ["ring_size^2", "ring_size_max", "ring_size_min"]},
{commented, 64}
]}.
%% ring_size validators
{validator, "ring_size_max",
"2048 and larger are supported, but considered advanced config",
fun(Size) ->
Size =< 1024
end}.
{validator, "ring_size^2", "not a power of 2",
fun(Size) ->
(Size band (Size-1) =:= 0)
end}.
{validator, "ring_size_min", "must be at least 8",
fun(Size) ->
Size >= 8
end}.
%% @doc Number of concurrent node-to-node transfers allowed.
{mapping, "transfer_limit", "riak_core.handoff_concurrency", [
{datatype, integer},
{default, 2},
{commented, 2}
]}.
%% @doc Default location of ringstate
{mapping, "ring.state_dir", "riak_core.ring_state_dir", [
{datatype, directory},
{default, "$(platform_data_dir)/ring"},
hidden
]}.
%% @doc Default cert location for https can be overridden
%% with the ssl config variable, for example:
{mapping, "ssl.certfile", "riak_core.ssl.certfile", [
{datatype, file},
{commented, "$(platform_etc_dir)/cert.pem"}
]}.
%% @doc Default key location for https can be overridden with the ssl
%% config variable, for example:
{mapping, "ssl.keyfile", "riak_core.ssl.keyfile", [
{datatype, file},
{commented, "$(platform_etc_dir)/key.pem"}
]}.
%% @doc Default signing authority location for https can be overridden
%% with the ssl config variable, for example:
{mapping, "ssl.cacertfile", "riak_core.ssl.cacertfile", [
{datatype, file},
{commented, "$(platform_etc_dir)/cacertfile.pem"}
]}.
%% @doc handoff.ip is the network address that Riak binds to for
%% intra-cluster data handoff.
{mapping, "handoff.ip", "riak_core.handoff_ip", [
{default, "{{handoff_ip}}" },
{datatype, string},
{validators, ["valid_ipaddr"]},
hidden
]}.
{validator,
"valid_ipaddr",
"must be a valid IP address",
fun(AddrString) ->
case inet_parse:address(AddrString) of
{ok, _} -> true;
{error, _} -> false
end
end}.
%% @doc handoff.port is the TCP port that Riak uses for
%% intra-cluster data handoff.
{mapping, "handoff.port", "riak_core.handoff_port", [
{default, {{handoff_port}} },
{datatype, integer},
hidden
]}.
%% @doc To encrypt riak_core intra-cluster data handoff traffic,
%% uncomment the following line and edit its path to an appropriate
%% certfile and keyfile. (This example uses a single file with both
%% items concatenated together.)
{mapping, "handoff.ssl.certfile", "riak_core.handoff_ssl_options.certfile", [
%% {commented, "/tmp/erlserver.pem"},
{datatype, file},
hidden
]}.
%% @doc if you need a seperate keyfile for handoff
{mapping, "handoff.ssl.keyfile", "riak_core.handoff_ssl_options.keyfile", [
{datatype, file},
hidden
]}.
%% @doc Enables/disables outbound handoff transfers for this node. If you
%% turn this setting off at runtime with riak-admin, it will kill any
%% outbound handoffs currently running.
{mapping, "handoff.outbound", "riak_core.disable_outbound_handoff", [
{default, on},
{datatype, {flag, off, on}},
hidden
]}.
%% @doc Enables/disables inbound handoff transfers for this node. If you
%% turn this setting off at runtime with riak-admin, it will kill any
%% inbound handoffs currently running.
{mapping, "handoff.inbound", "riak_core.disable_inbound_handoff", [
{default, on},
{datatype, {flag, off, on}},
hidden
]}.
%% @doc DTrace support Do not enable 'dtrace' unless your Erlang/OTP
%% runtime is compiled to support DTrace. DTrace is available in
%% R15B01 (supported by the Erlang/OTP official source package) and in
%% R14B04 via a custom source repository & branch.
{mapping, "dtrace", "riak_core.dtrace_support", [
{default, off},
{datatype, flag}
]}.
%% @doc Platform-specific installation paths (substituted by rebar)
{mapping, "platform_bin_dir", "riak_core.platform_bin_dir", [
{datatype, directory},
{default, "{{platform_bin_dir}}"}
]}.
%% @see platform_bin_dir
{mapping, "platform_data_dir", "riak_core.platform_data_dir", [
{datatype, directory},
{default, "{{platform_data_dir}}"}
]}.
%% @see platform_bin_dir
{mapping, "platform_etc_dir", "riak_core.platform_etc_dir", [
{datatype, directory},
{default, "{{platform_etc_dir}}"}
]}.
%% @see platform_bin_dir
{mapping, "platform_lib_dir", "riak_core.platform_lib_dir", [
{datatype, directory},
{default, "{{platform_lib_dir}}"}
]}.
%% @see platform_bin_dir
{mapping, "platform_log_dir", "riak_core.platform_log_dir", [
{datatype, directory},
{default, "{{platform_log_dir}}"}
]}.
%% @doc Enable consensus subsystem. Set to 'on' to enable the
%% consensus subsystem used for strongly consistent Riak operations.
{mapping, "strong_consistency", "riak_core.enable_consensus", [
{datatype, flag},
{default, off},
{commented, on}
]}.
%% @doc Whether to enable the background manager globally. When
%% enabled, participating Riak subsystems will coordinate access to
%% shared resources. This will help to prevent system response
%% degradation under times of heavy load from multiple background
%% tasks. Specific subsystems may also have their own controls over
%% use of the background manager.
{mapping, "background_manager", "riak_core.use_background_manager", [
{datatype, flag},
{default, off},
hidden
]}.
%% @doc Interval of time between vnode management
%% activities. Modifying this will change the amount of time between
%% attemps to trigger handoff between this node and any other member
%% of the cluster.
{mapping, "vnode_management_timer", "riak_core.vnode_management_timer", [
{default, "10s"},
{datatype, {duration, ms}},
hidden
]}.
%% Async Job Management
%%
%% This is a translation for mappings that appear in other schema files.
%% Mappings are from "cluster.job.$namespace.$operation"* to
%% "riak_core.job_accept_class" with required attributes
%% [merge, {datatype, {flag, enabled, disabled}}].**
%% * Mappings are only performed on elements with exactly the number of
%% segments shown - any other number of elements, even with a matching
%% prefix, is ignored.
%% ** The 'datatype' should be 'flag', and 'enabled'/'disabled' are our
%% conventions, but any OnFlag/OffFlag pair can be used as long as they map
%% to boolean values.
%% Other attributes, such as 'hidden' or {default, X} are fine, since they
%% don't make it down the stack to here.
%% Job classes that should be enabled by default MUST have a {default, enabled}
%% attribute, as the runtime filter only defaults to accept when no values have
%% been set from ANY schema file.
%%
%% Example:
%% {mapping, "cluster.job.harry.fold", "riak_core.job_accept_class", [
%% merge,
%% {datatype, {flag, enabled, disabled}},
%% {default, enabled}
%% ]}.
%% {mapping, "cluster.job.alice.list", "riak_core.job_accept_class", [
%% merge,
%% {datatype, {flag, enabled, disabled}},
%% {default, disabled}
%% ]}.
%% Results in:
%% {riak_core, [
%% ...
%% {job_accept_class, [{harry, fold}]}
%% ...
%% ]}.
%%
{translation,
"riak_core.job_accept_class",
fun(Conf) ->
Fold =
fun({[_, _, Mod, Op], true}, Result) ->
[{erlang:list_to_atom(Mod), erlang:list_to_atom(Op)} | Result];
({[_, _, _, _], false}, Result) ->
Result;
({[_, _, _, _], _} = Setting, _) ->
cuttlefish:invalid(io_lib:format("~p", [Setting]));
(_, Result) ->
Result
end,
lists:sort(lists:foldl(Fold, [],
cuttlefish_variable:filter_by_prefix(["cluster", "job"], Conf)))
end}.