“节点发现已禁用”在弹性搜索 [英] "Node Discovery Disabled" in Elastic Search

查看:575
本文介绍了“节点发现已禁用”在弹性搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在UBUNTU下面使用了Java代码,我得到了Node Discovery Disabled。因此,我无法向前迈进。

I used below Java code on UBUNTU and I am getting "Node Discovery Disabled". Because of this I am not able move forward.

任何人都可以帮我解决这个问题。

Could anyone please help me out solving this problem.

    public static JestClient JestConfiguration(){

    // Configuration
    ClientConfig client = new ClientConfig.Builder("http://localhost:9200")
                              .multiThreaded(true).build();

    System.out.println("\nclient configured via:- "+client);

    // Construct a new Jest client according to configuration via factory

    JestClientFactory factory = new JestClientFactory();
    factory.setClientConfig(client);
    System.out.println("\nJestClientFactory Via:-"+factory);

    JestClient jestClient = factory.getObject();
    System.out.println("\njestClient via:-"+jestClient);

    //jestClient.shutdownClient();
    return jestClient;
    }


推荐答案

我不知道什么版本你正在使用我使用的是0.1.2,工厂里我只有一个 setHttpClientConfig 方法。所以我使用了 HttpClientConfig ,它扩展了 ClientConfig 。除此之外,建设者有两种方法需要:

I am not sure what version you are using. I am using 0.1.2 and the factory I have only has a setHttpClientConfig method. So I used the HttpClientConfig instead, which extends ClientConfig. That point aside, the builder has two methods you'll want:


  • discoveryEnabled

  • discoveryFrequency

这些设置节点节点发现和轮询频率。

These set node node discovery and how frequently to poll.

HttpClientConfig httpClientConfig = new HttpClientConfig.Builder("http://localhost:9200") 
        .discoveryEnabled(true)
        .discoveryFrequency(10l, TimeUnit.SECONDS)
        .multiThreaded(true)
        .build();

JestClientFactory factory = new JestClientFactory();
factory.setHttpClientConfig(httpClientConfig);

这篇关于“节点发现已禁用”在弹性搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆