Find file
Fetching contributors…
Cannot retrieve contributors at this time
87 lines (59 sloc) 2.67 KB


Content type for json must be application/javascript, not application/json . Also it must use double quotes for strings, single seemingly will silently fail

If you want to have multiple map phases, the first map phase should return [bucket,key] pairs for the next phase

Some hints

Submit a query

curl -X POST -H "content-type: application/json" http://localhost:8098/mapred --data @-

Then enter the query json, return, ^D

Connect an erlang process

# replace linc with your machines hostname
/usr/local/Cellar/riak/0.8/erts-5.7.4/bin/erl -setcookie riak -name linc@
Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false]

Eshell V5.7.4  (abort with ^G)
(linc@> RiakNode = riak_util:str_to_node(riak).
(linc@> net_adm:ping(RiakNode).
(linc@> {ok, C} = riak:client_connect(RiakNode).

Bulk delete from an erlang process

This can probably be done more effiecently with key streaming. Look into mapred_bucket

linc@> {ok, Keys} = C:list_keys(<<"test5">>),
(linc@> lists:map(fun(Key)->
(linc@> C:delete(<<"test5">>, Key, 1)
(linc@> end, Keys).

Install Innostore

cd ~/tmp
hg clone && cd innostore
mkdir /usr/local/Cellar/riak/0.8/lib/innostore
cp -R ebin priv /usr/local/Cellar/riak/0.8/lib/innostore

vi /usr/local/Cellar/riak/0.8/etc/app.config


{storage_backend, riak_dets_backend}


{storage_backend, innostore_riak}

Also if you want, you can add a innostore section to the config, like the riak and sasl sections

%% Inno db config
{innostore, [
              {data_home_dir,            "/mnt/innodb"},
              {log_group_home_dir,       "/mnt/innodb"},
              {buffer_pool_size,         2147483648}, %% 2G of buffer
              {thread_concurrency,       0},
              {flush_log_at_trx_commit,  2},
              {max_dirty_pages_pct,      75},
              {thread_sleep_delay,       10}

Personally I used

{innostore, [
    {data_home_dir,            "/usr/local/var/lib/riak-innostore"},
    {log_group_home_dir,       "/usr/local/var/lib/riak-innostore"},
    {buffer_pool_size,  536870912}, %% 512m of buffer
    {thread_concurrency,       0},
    {flush_log_at_trx_commit,  2},
    {max_dirty_pages_pct,      75},
    {thread_sleep_delay,       10}

make sure to

mkdir /usr/local/var/lib/riak-innostore