Setting up RiakCS from source

In preparation for my talk at the
Munich Rubyshift about Riak I decided that one
topic I will talk about should be
RiakCS, since running S3 locally is just
so useful, be it for development purposes or production moving away from S3
towards a self hosted service. Setup can be really simple, just clone
the vagrant setup and run

    $ vagrant up

and be done with it.

But I still think to really explore something, I need to run it from source. Ok
so here we go, I did this on my Macbook with Erlang R15B01 installed via
kerl.

Get the source, and build it

Ok this is easy, just clone the repos needed

    $ git clone https://github.com/basho/riak.git
    $ git clone https://github.com/basho/riak_cs.git
    $ git clone https://github.com/basho/stanchion.git

Ok now to build it, since I am running erlang via kerl, I first need to make
sure the right version is activated

    $ source /path/to/erlang/activate

Now build all three projects

    $ cd riak && make rel
    $ cd riak_cs && make rel
    $ cd stanchion && make rel

This might take some time, since all dependencies need to be downloaded and
compiled as well but rebar (the Erlang build tool) will take care of this.

Configuration

For this I closely followed
this guide
the only thing to do really is to ajust the paths in the config files as needed,
so for /path/to/riak/rel/riak/etc/riak/app.config I followed the guide in step
3 but adjusted the paths to look like this

    {add_paths, ["/path/to/riak_cs/rel/riak-cs/lib/riak_cs-1.4.0/ebin"]},
    {storage_backend, riak_cs_kv_multi_backend},
    {multi_backend_prefix_list, [{>, be_blocks}]},
    {multi_backend_default, be_default},
    {multi_backend, [
        {be_default, riak_kv_eleveldb_backend, [
            {max_open_files, 50},
            {data_root, "/path/to/riak/rel/riak/data/leveldb"}
        ]},
        {be_blocks, riak_kv_bitcask_backend, [
            {data_root, "/path/to/riak/rel/riak/data/bitcask"}
        ]}
    ]},

For the IPs to listen to I decided to use 0.0.0.0 which binds it to every interface,
just to make sure I don’t run into trouble there. The guide suggest setting it to
the external interface IP which is probably the wiser choice.

Otherwise all settings apply here as given by the guide.

Startup

Ok with this little change everything is ready, and we can start each service

    $ /path/to/riak/rel/riak/bin/riak start
    $ /path/to/stanchion/rel/stanchion/bin/stanchion start
    $ /path/to/riak_cs/rel/riak-cs/bin/riak-cs start

order is important so.

Next Steps

Now it’s back to
this guide
and create a user and have fun with your own local S3.

Interested in more things Riak, and located in Munich?
Checkout Riak München

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s