Using the Local Client from a riak-attach session

Christian Dahlqvist christian at basho.com
Fri Jan 18 12:21:55 EST 2013


Hi Derek,

The Riak Erlang client (https://github.com/basho/riak-erlang-client) has good support for mapreduce, so it may be worthwhile switching to this. 

Here is an example of how to count records returned by a 2i lookup using a map reduce query:

riakc_pb_socket:mapred(Pid, {index, <<"bucket">>, <<"index_int">>, <<"1">>, <<"50">>},
                            [{reduce, {modfun, 'riak_kv_mapreduce', 'reduce_count_inputs'}, none, true}]).

Hope this helps.

Best regards,

Christian

--------------------
Christian Dahlqvist
Client Services Engineer
Basho Technologies
EMEA Office
E-mail: christian at basho.com
Skype: c.dahlqvist
Mobile: +44 7890 590 910

On 18 Jan 2013, at 09:48, Evan Vigil-McClanahan <emcclanahan at basho.com> wrote:

> Note that this uses the luke mapreduce subsystem, which isn't a good
> idea as it's been deprecated going forward.
> 
> Unfortunately there doesn't seem to be a way that's as simple to do
> pipe mapreduce jobs.  I'll ping people and see if we can't get you all
> some code that's slightly easier to use.
> 
> On Fri, Jan 18, 2013 at 5:09 AM, Derek Sanderson <zapphutz at gmail.com> wrote:
>> I love this mailing list
>> 
>> Thank you Daniil! I had almost exactly the first thing you recommended, but
>> the example I found had a slightly different notation, and was throwing
>> errors that I couldn't figure out.
>> 
>> Your example seems to be working, and I think I can get past my issue
>> 
>> Thanks again
>> 
>> 
>> On Thu, Jan 17, 2013 at 10:30 PM, Daniil Churikov <ddosia at gmail.com> wrote:
>>> 
>>> Another option, if you want range query:
>>> 
>>>    {ok, C} = riak:local_client(),
>>>    {ok, Keys} = C:get_index(<<"bucket_name">>, {range,
>>> <<"key_name_bin">>,
>>> KeyStart, KeyTo}),
>>>    ...
>>> 
>>> 
>>> 
>>> --
>>> View this message in context:
>>> http://riak-users.197444.n3.nabble.com/Using-the-Local-Client-from-a-riak-attach-session-tp4026572p4026578.html
>>> Sent from the Riak Users mailing list archive at Nabble.com.
>>> 
>>> _______________________________________________
>>> riak-users mailing list
>>> riak-users at lists.basho.com
>>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>> 
>> 
>> 
>> _______________________________________________
>> riak-users mailing list
>> riak-users at lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>> 
> 
> _______________________________________________
> 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/20130118/e46a66ad/attachment.html>


More information about the riak-users mailing list