Merge pull request #416 from dshulyak/conf_riak

Use riak with custom configuration
This commit is contained in:
Jędrzej Nowak 2015-12-10 12:39:30 +01:00
commit 1d89628e25
3 changed files with 251 additions and 1 deletions

View File

@ -20,7 +20,9 @@ solar-celery:
- redis
riak:
image: tutum/riak
image: solarproject/riak
volumes:
- ./utils/riak/app.config:/etc/riak/app.config
ports:
- 8087:8087
- 8098:8098

3
utils/riak/Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM tutum/riak:latest
ADD ./app.config /etc/riak/app.config

245
utils/riak/app.config Normal file
View File

@ -0,0 +1,245 @@
%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ft=erlang ts=4 sw=4 et
[
%% Riak Client APIs config
{riak_api, [
%% pb_backlog is the maximum length to which the queue of pending
%% connections may grow. If set, it must be an integer >= 0.
%% By default the value is 5. If you anticipate a huge number of
%% connections being initialised *simultaneously*, set this number
%% higher.
%% {pb_backlog, 64},
%% pb is a list of IP addresses and TCP ports that the Riak
%% Protocol Buffers interface will bind.
{pb, [ {"0.0.0.0", 8087 } ]}
]},
%% Riak Core config
{riak_core, [
%% Default location of ringstate
{ring_state_dir, "/var/lib/riak/ring"},
{default_bucket_props, [
{n_val,1}]
},
%% Default ring creation size. Make sure it is a power of 2,
%% e.g. 16, 32, 64, 128, 256, 512 etc
{ring_creation_size, 8},
%% http is a list of IP addresses and TCP ports that the Riak
%% HTTP interface will bind.
%{http, [ {"0.0.0.0", 8098 } ]},
%% https is a list of IP addresses and TCP ports that the Riak
%% HTTPS interface will bind.
{https, [ { "0.0.0.0", 8098 }] },
%% Default cert and key locations for https can be overridden
%% with the ssl config variable, for example:
{ssl, [
{certfile, "/etc/riak/host.crt"},
{keyfile, "/etc/riak/host.key"},
{cacertfile, "/etc/riak/rootCA.crt"}
]},
%% riak_handoff_port is the TCP port that Riak uses for
%% intra-cluster data handoff.
{handoff_port, 8099 },
%% 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.)
%{handoff_ssl_options, [{certfile, "/tmp/erlserver.pem"}]},
%% DTrace support
%% Do not enable 'dtrace_support' 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.
{dtrace_support, false},
%% Health Checks
%% If disabled, health checks registered by an application will
%% be ignored. NOTE: this option cannot be changed at runtime.
%% To re-enable, the setting must be changed and the node restarted.
%% NOTE: As of Riak 1.3.2, health checks are deprecated as they
%% may interfere with the new overload protection mechanisms.
%% If there is a good reason to re-enable them, you must uncomment
%% this line and also add an entry in the riak_kv section:
%% {riak_kv, [ ..., {enable_health_checks, true}, ...]}
%% {enable_health_checks, true},
%% Platform-specific installation paths (substituted by rebar)
{platform_bin_dir, "/usr/sbin"},
{platform_data_dir, "/var/lib/riak"},
{platform_etc_dir, "/etc/riak"},
{platform_lib_dir, "/usr/lib/riak/lib"},
{platform_log_dir, "/var/log/riak"}
]},
%% Riak KV config
{riak_kv, [
{storage_backend, riak_kv_multi_backend},
{multi_backend_default, <<"eleveldb_mult">>},
{multi_backend, [
{<<"eleveldb_mult">>, riak_kv_eleveldb_backend, [
{data_root, "/var/lib/riak/leveldb"},
{anti_entropy, {on, []}},
{anti_entropy_build_limit, {1, 3600000}},
{anti_entropy_expire, 604800000},
{anti_entropy_concurrency, 2},
{anti_entropy_tick, 15000},
{anti_entropy_data_dir, "/var/lib/riak/anti_entropy"},
{anti_entropy_leveldb_opts, [
{write_buffer_size, 4194304},
{max_open_files, 20}]},
{vnode_vclocks, true},
{http_url_encoding, on},
{fsm_limit, 50000},
{object_format, v1}
]},
{<<"lock_bitcask_mult">>, riak_kv_bitcask_backend, [
{data_root, "/var/lib/riak/bitcask"},
{expiry_secs, 120}
]}
]}
]},
%% Merge Index Config
{merge_index, [
%% The root dir to store search merge_index data
{data_root, "/var/lib/riak/merge_index"},
%% Size, in bytes, of the in-memory buffer. When this
%% threshold has been reached the data is transformed
%% into a segment file which resides on disk.
{buffer_rollover_size, 1048576},
%% Overtime the segment files need to be compacted.
%% This is the maximum number of segments that will be
%% compacted at once. A lower value will lead to
%% quicker but more frequent compactions.
{max_compact_segments, 20}
]},
%% Bitcask Config
{bitcask, [
%% Configure how Bitcask writes data to disk.
%% erlang: Erlang's built-in file API
%% nif: Direct calls to the POSIX C API
%%
%% The NIF mode provides higher throughput for certain
%% workloads, but has the potential to negatively impact
%% the Erlang VM, leading to higher worst-case latencies
%% and possible throughput collapse.
{io_mode, erlang},
{data_root, "/var/lib/riak/bitcask"}
]},
%% eLevelDB Config
{eleveldb, [
{data_root, "/var/lib/riak/leveldb"}
]},
%% Lager Config
{lager, [
%% What handlers to install with what arguments
%% The defaults for the logfiles are to rotate the files when
%% they reach 10Mb or at midnight, whichever comes first, and keep
%% the last 5 rotations. See the lager README for a description of
%% the time rotation format:
%% https://github.com/basho/lager/blob/master/README.org
%%
%% If you wish to disable rotation, you can either set the size to 0
%% and the rotation time to "", or instead specify a 2-tuple that only
%% consists of {Logfile, Level}.
%%
%% If you wish to have riak log messages to syslog, you can use a handler
%% like this:
%% {lager_syslog_backend, ["riak", daemon, info]},
%%
{handlers, [
{lager_file_backend, [
{"/var/log/riak/error.log", error, 10485760, "$D0", 5},
{"/var/log/riak/console.log", info, 10485760, "$D0", 5}
]}
] },
%% Whether to write a crash log, and where.
%% Commented/omitted/undefined means no crash logger.
{crash_log, "/var/log/riak/crash.log"},
%% Maximum size in bytes of events in the crash log - defaults to 65536
{crash_log_msg_size, 65536},
%% Maximum size of the crash log in bytes, before its rotated, set
%% to 0 to disable rotation - default is 0
{crash_log_size, 10485760},
%% What time to rotate the crash log - default is no time
%% rotation. See the lager README for a description of this format:
%% https://github.com/basho/lager/blob/master/README.org
{crash_log_date, "$D0"},
%% Number of rotated crash logs to keep, 0 means keep only the
%% current one - default is 0
{crash_log_count, 5},
%% Whether to redirect error_logger messages into lager - defaults to true
{error_logger_redirect, true},
%% maximum number of error_logger messages to handle in a second
%% lager 2.0.0 shipped with a limit of 50, which is a little low for riak's startup
{error_logger_hwm, 100}
]},
%% riak_sysmon config
{riak_sysmon, [
%% To disable forwarding events of a particular type, use a
%% limit of 0.
{process_limit, 30},
{port_limit, 2},
%% Finding reasonable limits for a given workload is a matter
%% of experimentation.
%% NOTE: Enabling the 'gc_ms_limit' monitor (by setting non-zero)
%% can cause performance problems on multi-CPU systems.
{gc_ms_limit, 0},
{heap_word_limit, 40111000},
%% Configure the following items to 'false' to disable logging
%% of that event type.
{busy_port, true},
{busy_dist_port, true}
]},
%% SASL config
{sasl, [
{sasl_error_logger, false}
]},
%% riak_control config
{riak_control, [
%% Set to false to disable the admin panel.
{enabled, false},
%% Authentication style used for access to the admin
%% panel. Valid styles are 'userlist' <TODO>.
{auth, userlist},
%% If auth is set to 'userlist' then this is the
%% list of usernames and passwords for access to the
%% admin panel.
{userlist, [{"user", "pass"}
]},
%% The admin panel is broken up into multiple
%% components, each of which is enabled or disabled
%% by one of these settings.
{admin, true}
]}
].