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
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to