Get conn
{ok, Pid} = riakc_pb_socket:start_link("127.0.0.1", 8081).
Set variables
Bucket = <<"spam">>.
Query = <<"Scott">>.
Phases = [ {reduce,{modfun, riak_kv_mapreduce, reduce_identity},[{reduce_phase_only_1, true}],true} ].
#! /bin/bash | |
# | |
# Pull a random sample of size 1000 from a directory of files and | |
# write to standard out. | |
# | |
# Usage: | |
# ./sample-lines /path/to/dir > mysample.log | |
if [ $# -lt 1 ] | |
then |
{ok, C} = riak:local_client(). | |
{ok, F} = luwak_file:get(C, <<"filename">>). | |
PrevRoot = hd(luwak_file:get_property(F, ancestors)). | |
V = riak_object:get_value(F). | |
V2 = lists:keyreplace(root, 1, V, {root, PrevRoot}). | |
TempF = riak_object:apply_updates(riak_object:update_value(F, V2)). | |
Bytes = luwak_io:get_range(C, TempF, 0, Length). % where Length is number of bytes you want to read |
Get conn
{ok, Pid} = riakc_pb_socket:start_link("127.0.0.1", 8081).
Set variables
Bucket = <<"spam">>.
Query = <<"Scott">>.
Phases = [ {reduce,{modfun, riak_kv_mapreduce, reduce_identity},[{reduce_phase_only_1, true}],true} ].
./dev/dev1/bin/riak-admin transfers
'[email protected]' waiting to handoff 6 partitions
'[email protected]' waiting to handoff 4 partitions
'[email protected]' waiting to handoff 6 partitions
Active Transfers:
transfer type: ownership_handoff
#!/usr/bin/env escript | |
%% -*- erlang -*- | |
-include_lib("kernel/include/file.hrl"). | |
-compile(export_all). | |
-define(LOG(S), io:format(S)). | |
-define(LOG(S,A), io:format(S,A)). | |
main(Dirs) -> | |
CodePath = case os:getenv("RIAK_LIB") of |
Cut disk usage by half and makes query easier to debug if necessary. | |
$ curl -vv 'http://localhost:8091/search/fruit?q=text:apple&wt=json' | jsonpp | tee result.out | |
{ | |
"responseHeader": { | |
"status": 0, | |
"QTime": 126, | |
"params": { | |
"shards": "127.0.0.1:7981/solr/fruit", |
This is a demo of Active Anti-Entropy (AAE) in action on Yokozuna.
Three modifications were made to the app.config
Set ring_creation_size
to 8.
Comment out the lager console logger (KV AAE is still spammy)
Add {yokozuna, [{entropy_tick, 5000}]}
curl -XPUT -H 'content-type: text/plain' -H 'x-riak-meta-yz-tags: X-Riak-Meta-Name_s' -H 'x-riak-meta-name_s: zezeski' 'http://localhost:8098/riak/people/ryan' -d "You gonna drink that?" | |
curl 'http://localhost:8098/search/people?q=X-Riak-Meta-Name_s:zezeski&wt=json' | jsonpp | |
{ | |
"responseHeader": { | |
"status": 0, | |
"QTime": 22, | |
"params": { | |
"shards": "127.0.0.1:8093/solr/people", |
17:39:48 <{mochiweb_acceptor,init,3}> {erlang,decode_packet, | |
[httph, | |
<<"x-riak-meta-user_s: foo\r\nx-riak-meta-description_t: bar\r\nContent-Length: 153426\r\nExpect: 100-continue\r\n\r\n">>, | |
[]]} | |
17:39:48 <{mochiweb_acceptor,init,3}> {erlang,decode_packet,3} -> {ok, | |
{http_header, | |
0, | |
"X-Riak-Meta-User_s", | |
undefined, |
SVNodes = riak_core_vnode_manager:all_vnodes(riak_search_vnode). | |
GetMIPid = fun(VNodePid) -> element(3,element(4,element(4,element(2,hd(element(2,lists:nth(3,lists:nth(5,element(4,sys:get_status(VNodePid)))))))))) end. | |
[merge_index:compact(GetMIPid(VNodePid)) || {_,_,VNodePid} <- SVNodes]. | |