Java mapreduce和搜索Riak

时间:2016-11-14 16:02:59

标签: java riak riak-search

我看到了Riak erlang和JS mapreduce的例子。但我是一个JAVA人:),喜欢在JAVA中做到这一点。此外,JS mapreduce已被弃用。

  1. 有没有办法在Java中做到这一点?请提供样品。
  2. 我也在寻找Riak 2.0 Search的Java示例。
  3. 在Riak docs中,riak-search的步骤看起来很大。这可能看起来像mapreduce和搜索的小食谱。可以通过实例步骤进行总结。

    问题

    我尝试了github中的步骤以下是我看到的:

       ./rebar get-deps
    ==> meck (get-deps)
    ==> protobuffs (get-deps)
    ==> hamcrest (get-deps)
    ==> riak_pb (get-deps)
    ==> riak-erlang-client (get-deps)
    ./rebar compile
    ==> meck (pre_compile)
    ==> meck (compile)
    ==> protobuffs (pre_compile)
    ==> protobuffs (compile)
    ==> hamcrest (pre_compile)
    ==> hamcrest (compile)
    ==> hamcrest (post_compile)
    ==> riak_pb (pre_compile)
    ==> riak_pb (compile)
    ==> riak-erlang-client (compile)
    raghuveer@ubuntu:~/erlang-git/riak-erlang-client$ erl -pa $PATH_TO_RIAKC/ebin $PATH_TO_RIAKC/deps/*/ebin
    Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]
    
    Eshell V7.3  (abort with ^G)
    1> code:which(riakc_pb_socket).
    non_existing
    

1 个答案:

答案 0 :(得分:2)

map和reduce阶段代码必须是erlang或javascript。 您可以在客户端使用java,但是mapreduce代码需要在Riak节点中执行,该节点本身使用erlang并且使用spidermonkey来运行javascript。

有一些预定义的功能可以帮助您从https://github.com/basho/riak_kv/blob/develop/src/riak_kv_mapreduce.erl

开始

该文档包含将java与搜索结合使用的示例:https://docs.basho.com/riak/kv/2.1.4/developing/usage/search/

相关问题