Erlang PB Client Put Issue

Zheng Zhibin witeman.g at gmail.com
Sat Nov 12 23:18:16 EST 2011


Both the bucket name, key, and value should be binary format

Best regards,
Zheng Zhibin

在 2011-11-13,上午6:19,Geeth Narayanan <gnarayan1 at gmail.com> 写道:

> Hi,
> 
> I am trying to put some erlang record item to my dev riak nodes. I get the following error at the bottom. Can you please help?
> 
> 1> code:which(riakc_pb_socket).
> "/Users/geeth/Apps/riak-erlang-client/ebin/riakc_pb_socket.beam"
> 
> 2> {ok, Pid} = riakc_pb_socket:start_link("127.0.0.1", 8081).
> {ok,<0.34.0>}
> 
> 3> rd(item, {id, name, desc}).     
> item
> 
> 4>     
> 4> It = #item{id=1, name="Item1", desc="Some desc"}.
> #item{id = 1,name = "Item1",desc = "Some desc"}
> 
> 5> MyRec = riakc_obj:new(<<"Items">>, list_to_binary(integer_to_list(It#item.id)), It).   
> {riakc_obj,<<"Items">>,<<"1">>,undefined,[],undefined,
>            #item{id = 1,name = "Item1",desc = "Some desc"}}
> 
Try term_to_binary(It)
> 6> Rec = riakc_pb_socket:put(Pid, MyRec).
> ** exception exit: {noproc,
>                     {gen_server,call,
>                      [<0.34.0>,
>                       {req,
>                        {rpbputreq,<<"Items">>,<<"1">>,undefined,
>                         {rpbcontent,
>                          <<131,104,4,100,0,4,105,116,101,109,97,1,107,...>>,
>                          "application/x-erlang-binary",undefined,undefined,
>                          undefined,undefined,undefined,undefined,undefined,
>                          undefined},
>                         undefined,undefined,undefined,undefined,undefined,
>                         undefined,undefined},
>                        60000},
>                       infinity]}}
>      in function  gen_server:call/3
> 
> 
> Thanks.
> Geeth
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20111113/3d268b8e/attachment.html>


More information about the riak-users mailing list