Riak mapreduce error

Magnus Kessler mkessler at basho.com
Mon Feb 6 10:48:20 EST 2017


On 3 February 2017 at 18:31, raghuveer sj <raghuveersj at gmail.com> wrote:

> Hi Team,
>
> I am trying to run mapreduce in erlang.
>
> curl -XPUT http://localhost:8098/buckets/training/keys/foo -H
> 'Content-Type: text/plain' -d 'caremad data goes here'
> curl -XPUT http://localhost:8098/buckets/training/keys/bar -H
> 'Content-Type: text/plain' -d 'caremad caremad caremad caremad'
> curl -XPUT http://localhost:8098/buckets/training/keys/baz -H
> 'Content-Type: text/plain' -d 'nothing to see here'
> curl -XPUT http://localhost:8098/buckets/training/keys/bam -H
> 'Content-Type: text/plain' -d 'caremad caremad caremad'
>
> *Running in erlang shell :*
>
> ReFun = fun(O, _, Re) -> case re:run(riak_object:get_value(O), Re,
> [global]) of
>     {match, Matches} -> [{riak_object:key(O), length(Matches)}];
>     nomatch -> [{riak_object:key(O), 0}]
> end end.
>
> code:which(riakc_pb_socket).
> "./ebin/riakc_pb_socket.beam"
>
> {ok, Pid} = riakc_pb_socket:start_link("127.0.0.1", 8087).
> {ok,<0.36.0>}
>
> riakc_pb_socket:ping(Pid).
> pong
>
> {ok, Re} = re:compile("caremad").
> {ok,{re_pattern,0,0,0,
>                 <<69,82,67,80,85,0,0,0,0,0,0,0,81,0,0,0,255,255,255,255,
>                   255,255,...>>}}
>
> {ok, Riak} = riakc_pb_socket:start_link("127.0.0.1", 8087).
> {ok,<0.42.0>}
>
> riakc_pb_socket:mapred_bucket(Riak, <<"training">>, [{map, {qfun, ReFun},
> Re, true}]).
> ** 1: variable 'ReFun' is unbound*
>
> Trying to run the famous erlang sample program sample. I am stuck at this
> error. Kindly help me out.
>
> Regards,
> Raghuveer
>
>
Hi Raghuveer,

I have run the steps you provided, and found that they work fine for me.
Can you let me know which version of Riak you are running this against, and
which version of Erlang is used on the client side? Has the
riak-erlang-client been compiled with the same Erlang version?

Kind Regards,

Magnus

-- 
Magnus Kessler
Client Services Engineer
Basho Technologies Limited

Registered Office - 8 Lincoln’s Inn Fields London WC2A 3BP Reg 07970431
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20170206/5f478519/attachment-0002.html>


More information about the riak-users mailing list