erlang client

Michael Martin mmartin4242 at gmail.com
Sun Feb 1 13:34:52 EST 2015


Hello, I'm working on a little e2 application that needs to put/get data 
to/from riak. I apparently have a misunderstanding
about some things.

I can successfully put and get key-value pairs to a bucket using the 
erlang client. However, when I try to curl the
data out, I get nothing. In fact, doing curl -X GET 
"http://riak1:8098/riak?buckets=true" returns '{"buckets":[]}'.
Ditto for curl -X GET "http://192.168.29.11:8098/buckets?buckets=true".

In my application, though, I can do this:

8> Object = riakc_obj:new(<<"testbucket">>, <<"testkey">>, 
<<"testdata">>). {riakc_obj,<<"testbucket">>,<<"testkey">>,undefined,[],
            undefined,<<"testdata">>}
9> riakc_pb_socket:put(Pid, Object).
ok
10> riakc_pb_socket:get(Pid, <<"testbucket">>, <<"testkey">>).
{ok,{riakc_obj,<<"testbucket">>,<<"testkey">>,
<<107,206,97,96,96,96,204,96,202,5,82,28,202,156,255,126,
                  238,185,94,62,53,131,41,...>>,
                [{{dict,2,16,16,8,80,48,
                        {[],[],[],[],[],[],[],[],[],[],[],[],...},
                        {{[],[],[],[],[],[],[],[],[],[],...}}},
                  <<"testdata">>}],
                undefined,undefined}}
11> riakc_pb_socket:list_buckets(Pid).
{ok,[<<"tb1">>,<<"testbucket">>]}

So what is the difference between the two? How can I use curl (or any 
other client) to see the buckets, and retrieve
data?

Thanks,
Michael Martin





More information about the riak-users mailing list