私はこのガイドに従っています http://docs.basho.com/riak/latest/dev/advanced/mapreduce/
このガイドに従って 5 つのノードをセットアップした後 http://docs.basho.com/riak/latest/quickstart/
start() ->
{ok, Client} = riakc_pb_socket:start("127.0.0.1", 10018),
Mine = riakc_obj:new(<<"groceries">>, <<"mine">>,
term_to_binary(["eggs", "bacon"])),
Yours = riakc_obj:new(<<"groceries">>, <<"yours">>,
term_to_binary(["bread", "bacon"])),
riakc_pb_socket:put(Client, Yours, [{w, 1}]),
riakc_pb_socket:put(Client, Mine, [{w, 1}]).
このクエリを実行すると、このエラーが発生します
** Reason for termination ==
** {{badrecord,rpbputreq},
[{riak_kv_pb,iolist,2,[{file,"src/riak_kv_pb.erl"},{line,48}]},
{riak_kv_pb,encode,2,[{file,"src/riak_kv_pb.erl"},{line,40}]},
{riak_pb_codec,encode,1,[{file,"src/riak_pb_codec.erl"},{line,77}]},
{riakc_pb_socket,send_request,2,
[{file,"src/riakc_pb_socket.erl"},{line,2066}]},
{riakc_pb_socket,handle_call,3,
[{file,"src/riakc_pb_socket.erl"},{line,1252}]},
{gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,588}]},
{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]}
** Last message in was {req,
{rpbputreq,<<"groceries">>,<<"yours">>,undefined,
{rpbcontent,
<<131,108,0,0,0,2,107,0,5,98,114,101,97,100,
107,0,5,98,97,99,111,110,106>>,
undefined,undefined,undefined,undefined,[],
undefined,undefined,[],[],undefined},
1,undefined,undefined,undefined,undefined,
undefined,undefined,undefined,undefined,
undefined,undefined,undefined},
60000}
** When Server state == {state,"127.0.0.1",10018,false,false,#Port<0.3496>,
gen_tcp,undefined,
{[],[]},
1,[],infinity,undefined,undefined,undefined,
undefined,100}
コミットが原因
riakc_pb_socket:put(Client, Yours, [{w, 1}]),
実行中のノードのコンソールに接続していません。このコマンドをerlangで実行します
erl -sname foo -pa ~/e/riak-erlang-client/ebin -pa /usr/lib/riak/lib/riak_kv-1.4.2-0-g61ac9d8/ebin -pa /usr/lib/riak/lib/riak_core-1.4.2/ebin -pa /usr/lib/riak/lib/riak_pb-1.4.1.1/ebin/
不良レコードはで定義されています
/usr/lib/riak/lib/riak_pb-1.4.1.1/include/riak_kv_pb.hrl
-record(rpbputreq, {
bucket = erlang:error({required, bucket}),
key,
vclock,
content = erlang:error({required, content}),
w,
dw,
return_body,
pw,
if_not_modified,
if_none_match,
return_head,
timeout,
asis,
sloppy_quorum,
n_val
}).