Riak mapreduce error

raghuveer sj raghuveersj at gmail.com
Fri Feb 3 13:31:05 EST 2017


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20170204/39c88d11/attachment-0002.html>


More information about the riak-users mailing list