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 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 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). |
This file contains 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 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 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 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) , |
This file contains 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
#!/bin/sh | |
# | |
# ./generate-node.sh -p 8087 -P 192.168.1.201 -h 8098 -H 192.168.1.201 -d 8099 -D 192.168.1.201 -s riak_kv_eleveldb_backend /mnt/riak/bin/riak /data/solid/riak | |
while [ "${1:0:1}" = "-" -a "${#1}" -eq 2 ]; do | |
case ${1:1:1} in | |
p) | |
shift | |
pb_port="$1" | |
shift |
This file contains 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
extract () { | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xvjf $1 && cd $(basename "$1" .tar.bz2) ;; | |
*.tar.gz) tar xvzf $1 && cd $(basename "$1" .tar.gz) ;; | |
*.tar.xz) tar Jxvf $1 && cd $(basename "$1" .tar.xz) ;; | |
*.bz2) bunzip2 $1 && cd $(basename "$1" /bz2) ;; | |
*.rar) unrar x $1 && cd $(basename "$1" .rar) ;; | |
*.gz) gunzip $1 && cd $(basename "$1" .gz) ;; | |
*.tar) tar xvf $1 && cd $(basename "$1" .tar) ;; |
This file contains 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
#!/bin/sh | |
# | |
# ./generate-node.sh -p 8087 -P 192.168.1.201 -h 8098 -H 192.168.1.201 -d 8099 -D 192.168.1.201 -s riak_kv_eleveldb_backend /mnt/riak/bin/riak /data/solid/riak | |
while [ "${1:0:1}" = "-" -a "${#1}" -eq 2 ]; do | |
case ${1:1:1} in | |
p) | |
shift | |
pb_port="$1" | |
shift |