Skip to content
kellymclaughlin edited this page Apr 19, 2012 · 15 revisions

The default backend used by Riak is the bitcask backend, but the Riak CS package comes with a special backend that should be used by the Riak cluster that is part of the Riak CS system. It is a custom version of the standard multibackend that ships with Riak. Some of the Riak buckets used internally by Riak CS use secondary indexes, which currently requires the eleveldb backend. Other parts of the Riak CS system can benefit more from the use of the bitcask backend. The use of the custom multibackend enables Riak CS to take advantage of the strengths of both of these backends to achieve the best blend of performance and features. The next section covers how to properly setup Riak to use this multibackend.

Additionally, the Riak CS storage calculation system uses Riak's MapReduce to sum the files in a bucket. This means you must tell all of your Riak nodes where to find Riak CS's compiled files before calculating storage.

Configuring Riak for use with Riak CS

To expose the necessary Riak CS modules to Riak and instruct Riak to use the custom multibackend, edit Riak's app.config file, and add this to the riak_kv section:

{add_paths, ["/usr/lib64/riak-cs/lib/riak_moss-X.Y.Z/ebin/"]},
{storage_backend, riak_cs_kv_multi_backend},
    {multi_backend_prefix_list, [{<<"0b:">>, be_blocks}]},
    {multi_backend_default, be_default},
    {multi_backend, [
       % format: {name, module, [Configs]}
       {be_default, riak_kv_eleveldb_backend, [
         {max_open_files, 50},
         {data_root, "DATADIR/leveldb"}
       ]},
       {be_blocks, riak_kv_bitcask_backend, [
         {data_root, "DATADIR/bitcask"}
      ]}
     ]},

where X.Y.Z is the version of Riak CS you have installed. Replace all instances of DATADIR with the appropriate directory listed below that will be storing Riak's data.

        Riak Linux data directory path:
            /var/lib/riak

        Riak Solaris data directory path:
            /opt/riak/data

        Riak developer source data directory path:
            ./data

Save and exit the editing session on the app.config file.

The location of the app.config file for different environments is shown below.

        Riak Linux config file path:
            /etc/riak/app.config

        Riak Solaris config file path:
            /opt/riak/etc/app.config

        Riak developer source config file path:
            ./rel/riak/etc/app.config

To test that you have configured a Riak node correctly, start Riak and connect to its console (using riak attach), then run:

([email protected])1> code:which(riak_cs_kv_multibackend).
"/usr/lib64/riak-cs/lib/riak_moss-X.Y.Z/ebin/riak_cs_kv_multi_backend.beam"

If the path that you added to Riak's app.config is returned, your node is configured correct. If instead, the atom non_existing is returned, Riak was unable to find the Riak CS code.

Note: To detach from the riak console after doing a riak attach it is important to use CTRL+D to detach the console and leave Riak running. CTRL+C will cause the Riak node to exit and in many cases this is not the desired outcome of detaching from the console.

Clone this wiki locally