Indexes = [{<<"index1_bin">>, <<"val">>}, {<<"index2_int">>, 1}], Meta = dict:store(<<"index">>, Indexes, dict:new()), Obj = riakc_obj:new(<<"mybucket">>, <<"mykey">>, <<"myval">>), Obj1 = riakc_obj:update_metadata(Obj, Meta), riakc_pb_socket:put(RiakPid, Obj1).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -module(cs_manifest_siblings). | |
| -compile(export_all). | |
| start() -> | |
| start(1). | |
| %% @doc Trace to determine the number of siblings of Riak CS manifest | |
| %% objects. The `Threshold' parameter is used to limit the output to | |
| %% manifest objects whose sibling count is >= to `Threshold'. | |
| start(Threshold) -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env escript | |
| %% -*- coding: utf-8 -*- | |
| %%! -pa /usr/lib64/riak-cs/lib/riakc-1.4.1/ebin /usr/lib64/riak-cs/lib/riak_pb-1.4.4.0/ebin /usr/lib64/riak-cs/lib/protobuffs-0.8.1/ebin /usr/lib64/riak-cs/lib/riak_cs-1.4.5/ebin /usr/lib/riak-cs/lib/riakc-1.4.1/ebin /usr/lib/riak-cs/lib/riak_pb-1.4.4.0/ebin /usr/lib/riak-cs/lib/protobuffs-0.8.1/ebin /usr/lib/riak-cs/lib/riak_cs-1.4.5/ebin | |
| %%! -pa /usr/lib64/riak-cs/lib/riakc-1.3.1.1/ebin /usr/lib64/riak-cs/lib/riak_pb-1.3.0/ebin /usr/lib64/riak-cs/lib/protobuffs-0.8.0/ebin /usr/lib/riak-cs/lib/riakc-1.3.1.1/ebin /usr/lib/riak-cs/lib/riak_pb-1.3.0/ebin /usr/lib/riak-cs/lib/protobuffs-0.8.0/ebin /usr/lib/riak-cs/ebin | |
| %%! -pa /Users/kelly/basho/repos/riak_cs/deps/riakc/ebin /Users/kelly/basho/repos/riak_cs/deps/riak_pb/ebin /Users/kelly/basho/repos/riak_cs/deps/protobuffs/ebin /Users/kelly/basho/repos/riak_cs/deps/riakc/ebin /Users/kelly/basho/repos/riak_cs/deps/riak_pb/ebin /Users/kelly/basho/repos/riak_cs/deps/protobuffs/ebin /Users/kelly/basho/repos/riak_cs/dep |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %% Get current number of online schedulers | |
| Schedulers = erlang:system_info(schedulers_online). | |
| %% Reduce number online to 1 | |
| erlang:system_flag(schedulers_online, 1). | |
| %% Restore to original number of online schedulers | |
| erlang:system_flag(schedulers_online, Schedulers). |
ulimit -n 4096
for i in ./dev*/bin/riak ; do $i stop ; done
for i in ./dev*/bin/riak ; do $i start; done
./dev2/bin/riak-admin cluster join dev1@127.0.0.1
./dev3/bin/riak-admin cluster join dev2@127.0.0.1
./dev1/bin/riak-admin cluster plan
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| krab$ ../ej | |
| ** Erjang R15B03 ** [root:/usr/local/lib/erlang] [erts:5.9.3.1] [unicode] | |
| Eshell V5.9.3.1 (abort with ^G) | |
| 1> erlang:load_nif("/Users/krab/Projects/riak/deps/bitcask/priv/bitcask.so", any). | |
| ok | |
| 2> {ok,KeyDir} = bitcask_nifs:keydir_new(). | |
| {ok,<<>>} | |
| 3> bitcask_nifs:keydir_put_int(KeyDir, <<"key">>, 2, 100, <<123:64>>, 2222, 3333, 3, <<123:64>>). | |
| already_exists | |
| 4> bitcask_nifs:keydir_put_int(KeyDir, <<"key">>, 2, 100, <<123:64>>, 2222, 3333, 0, <<123:64>>). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/lib/riak/erts-5.7.5/bin/escript | |
| %% -*- erlang -*- | |
| %%! -pa /usr/lib/riak/lib/bitcask-1.1.6/ebin | |
| %% Note: this script is designed for Riak 0.14.2 on Debian/Ubuntu | |
| main([Root]) -> | |
| case file:list_dir(filename:absname(Root)) of | |
| {ok, VnodeDirs} -> | |
| [ check_bitcask(filename:absname(Dir, Root)) || Dir <- VnodeDirs]; | |
| {error, Reason} -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ListCask = fun(Vnode,OutFile) -> | |
| Fold_data = fun(Handle) -> | |
| FoldFun = fun(Key, _Ts, _PosInfo, {ok,Acc}) -> io:format(OutFile, "~p~n",[binary_to_term(Key)]),{ok,Acc + 1} end, | |
| try bitcask_fileops:fold_keys(Handle, FoldFun, {ok,0}, datafile) of | |
| {ok,A} -> A; | |
| {error,E} -> {error, E} | |
| catch | |
| _Error -> | |
| {error, io_lib:format("~s~s~n",["Corrupted datafile: ",bitcask_fileops:datafile_name(Handle)])} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -module(extract_bitcask). | |
| main([Dir, Output]) -> | |
| {ok, Fh} = file:open(Output,[write]), | |
| io:format("Dumping bucket/keys for partition: ~p to output file: ~p\n", [Dir,Output]), | |
| F = fun(Entry, _Acc) -> | |
| case Entry of | |
| {bitcask_entry, Key, _S, _T, _F, _U} -> | |
| {B, K} = binary_to_term(Key), | |
| erlang:put(extraction_counter, erlang:get(extraction_counter) + 1) , |