Riak Yokuzuna架构上传,创建索引和搜索查询总是导致错误60,56,27

时间:2015-09-10 06:19:05

标签: riak riak-search yokozuna

public class RiakSearch {
public static final String RIAK_SERVER = "10.11.172.17";

private static RiakCluster setUpCluster() throws UnknownHostException {
    // This example will use only one node listening on localhost:10017
    RiakNode node = new RiakNode.Builder()
            .withRemoteAddress("10.11.172.17")
            .withAuth("administrator", "password@123", null).build();

    // This cluster object takes our one node as an argument
    RiakCluster cluster = new RiakCluster.Builder(node).build();

    // The cluster must be started to work, otherwise you will see errors
    cluster.start();

    return cluster;
}

public void uploadSchema() {
    try {
        RiakCluster cluster = setUpCluster();
        RiakClient client = new RiakClient(cluster);
        System.out.println("Client object successfully created");
        File xml = new File("blog_post_schema.xml");
        String xmlString = FileUtils.readFileToString(xml);
        YokozunaSchema schema = new YokozunaSchema("blog_post_schema",
                xmlString);
        StoreSchema storeSchemaOp = new StoreSchema.Builder(schema).build();
        client.execute(storeSchemaOp);
    } catch (UnknownHostException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (ExecutionException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

public static void main(String[] args) {
    // TODO Auto-generated method stub
    RiakSearch obj = new RiakSearch();
    obj.uploadSchema();

}

}
  

java.util.concurrent.ExecutionException:com.basho.riak.client.core.netty.RiakResponseException:未知消息代码:56       在com.basho.riak.client.core.FutureOperation.get(FutureOperation.java:260)       在com.basho.riak.client.api.commands.CoreFutureAdapter.get(CoreFutureAdapter.java:52)       在com.basho.riak.client.api.RiakCommand.execute(RiakCommand.java:89)       在com.basho.riak.client.api.RiakClient.execute(RiakClient.java:293)       在com.search.RiakSearch.main(RiakSearch.java:64)   引起:com.basho.riak.client.core.netty.RiakResponseException:未知消息代码:56       在com.basho.riak.client.core.netty.RiakResponseHandler.channelRead(RiakResponseHandler.java:52)       在io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:84)       at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153)       at io.netty.channel.PausableChannelEventExecutor.invokeChannelRead(PausableChannelEventExecutor.java:86)       at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:389)       at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:243)       at io.netty.handler.codec.ByteToMessageCodec.channelRead(ByteToMessageCodec.java:103)       在io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:84)       at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153)       at io.netty.channel.PausableChannelEventExecutor.invokeChannelRead(PausableChannelEventExecutor.java:86)       at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:389)       at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:956)       at io.netty.channel.nio.AbstractNioByteChannel $ NioByteUnsafe.read(AbstractNioByteChannel.java:127)       在io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:514)       at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:471)       at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:385)       在io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:351)       at io.netty.util.concurrent.SingleThreadEventExecutor $ 2.run(SingleThreadEventExecutor.java:116)       at io.netty.util.internal.chmv8.ForkJoinTask $ RunnableExecuteAction.exec(ForkJoinTask.java:1412)       at io.netty.util.internal.chmv8.ForkJoinTask.doExec(ForkJoinTask.java:280)       at io.netty.util.internal.chmv8.ForkJoinPool $ WorkQueue.runTask(ForkJoinPool.java:877)       在io.netty.util.internal.chmv8.ForkJoinPool.scan(ForkJoinPool.java:1706)       在io.netty.util.internal.chmv8.ForkJoinPool.runWorker(ForkJoinPool.java:1661)       在io.netty.util.internal.chmv8.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:126)

1 个答案:

答案 0 :(得分:1)

我有类似的问题 RiakError: 'Unknown message code: 56'

我通过更改'riak.conf'文件中的搜索参数来解决它 这是文件位置,如果您使用的是mac并通过brew安装

/usr/local/Cellar/riak/2.2.2/libexec/etc/riak.conf

以下是我从off更改为on

的代码行
## To enable Search set this 'on'.
## 
## Default: off
## 
## Acceptable values:
##   - on or off
search = on

我发现documentation解释有点难以理解,但或多或​​少是解决问题的参考。