Product tutorials, how-tos, and fully-documented APIs.

Configuration Files

    Riak has two configuration files located in etc/ if you are using a source install and in /etc/riak if you used a binary install. The files are app.config and vm.args.

    The app.config file is used to set various attributes for the node such as the backend the node will use to store data. The vm.args file is used to pass parameters to the Erlang node such as the name or cookie of the Erlang node.

    app.config

    Riak and the Erlang applications it depends on are configured by settings in the app.config file in the etc directory of the Riak node.

    [
        {riak_core, [
            {ring_state_dir, "data/ring"}
            %% More riak_core settings...
                ]},
        {riak_kv, [
            {storage_backend, riak_kv_bitcask_backend},
            %% More riak_kv settings...
                ]},
        %% Other application configurations...
    ].
    

    riak_api settings

    riak_core settings

    riak_kv settings

    webmachine_logger_module

    This needs to be set in order to enable access logs.

    {webmachine, [{webmachine_logger_module, webmachine_logger}]}

    Note

    The additional disk I/O of an access log imposes a performance cost you may not wish to pay. Therefore, by default, Riak does not produce access logs.

    riak_search settings

    %% Riak Search Config
    {riak_search, [
        %% To enable Search functionality set this 'true'.
        {enabled, false}
        ]},
    

    lager

    Lager is the logging engine introduced in Riak 1.0. It is designed to be more stable than Erlang's error_logger, as well as play nicely with standard logging tools.

    The default lager options are like so:

    {lager, [
        {handlers, [
            {lager_console_backend, info},
                {lager_file_backend, [
                    {"/opt/riak/log/error.log", error},
                    {"/opt/riak/log/console.log", info}
                    ]}
                    ]},.
                    {crash_log, "/crash.log"},
                    {crash_log_size, 65536},
                    {error_logger_redirect, true}
                    ]},
    

    vm.args

    Parameters for the Erlang node on which Riak runs are set in the vm.args file in the etc directory of the embedded Erlang node. Most of these settings can be left at their defaults until you are ready to tune performance.

    Two settings you may be interested in right away, though, are -name and -setcookie. These control the Erlang node names (possibly host-specific), and Erlang inter-node communication access (cluster-specific), respectively.

    The format of the file is fairly loose: lines which do not begin with the “#” character are concatenated, and passed to the erl on the command line as is.

    More details about each of these settings can be found in the Erlang documentation for the erl Erlang virtual machine.

    Erlang Runtime Configuration Options

    -name

    Name of the Erlang node. (default: riak@127.0.0.1)

    The default value, riak@127.0.0.1 will work for running Riak locally, but for distributed (multi-node) use, the portion of the name after the “@” should be changed to the IP address of the machine on which the node is running.

    If you have properly-configured DNS, the short-form of this name can be used (for example: “riak”). The name of the node will then be “riak@Host.Domain”.

    -setcookie

    Cookie of the Erlang node. (default: riak)

    Erlang nodes grant or deny access based on the sharing of a previously-shared cookie. You should use the same cookie for every node in your Riak cluster, but it should be a not-easily-guessed string unique to your deployment, to prevent non-authorized access.

    -heart

    Enable “heart” node monitoring. (default: disabled)

    Heart will restart nodes automatically, should they crash. However, heart is so good at restarting nodes that it can be difficult to prevent it from doing so. Enable heart once you are sure that you wish to have the node restarted automatically on failure.

    +K

    Enable kernel polling. (default: true)

    +A

    Number of threads in the async thread pool. (default: 64)

    -pa

    Adds the specified directories to the beginning of the code path, similar to code:add_pathsa/1. See code(3). As an alternative to -pa, if several directories are to be prepended to the code and the directories have a common parent directory, that parent directory could be specified in the ERL_LIBS environment variable.

    -env

    Set host environment variables for Erlang.

    -smp

    Enables Erlang's SMP support. (default: enable)

    -env ERL_LIBS

    Alternate method to add directories to the code path (see -pa above)

    -env ERL_MAX_PORTS 4096

    Maximum number of concurrent ports/sockets. (default: 4096)

    -env ERL_FULLSWEEP_AFTER 0

    Run garbage collection more often.

    -env ERL_CRASH_DUMP ./log/erl_crash.dump

    Set the location of crash dumps.

    Rebar Overlays

    If you are going to be rebuilding Riak often, you will want to edit the vm.args and app.config files in the rel/files directory. These files are used whenever a new release is generated using “make rel” or “rebar generate”. Each time a release is generated any existing release must first be destroyed. Changes made to release files (rel/riak/etc/vm.args, rel/riak/etc/app.config, etc.) would be lost when the release is destroyed.