Reputation: 3110
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?
--
Note that this was also sent to the riak-user mailing list
Upvotes: 0
Views: 90
Reputation: 3110
I figured out what the problem was. I had another instance of Riak running on the machine where my application was running, and the app was defaulting to "localhost" when connecting to Riak, rather than connecting to my test cluster.
The data was written correctly, just to the wrong instance.
Upvotes: 1