繁体   English   中英

创建elasticsearch客户端抛出一个Netty IllegalStateException

[英]create elasticsearch client throws a netty IllegalStateException

elasticsearch版本5.4.3

我使用单例创建一个客户端,这是主要代码

TransportClient tclient = null;
    if (clusterName != null) {
            Settings settings = Settings.builder()
                    .put("cluster.name",clusterName)
                    .put("client.transport.sniff", true)
                    .build();
            tclient = new PreBuiltTransportClient(settings);//here will throw the exception
    } else {
        tclient = new  PreBuiltTransportClient(Settings.EMPTY);
    }

当第一次运行代码“ tclient = new PreBuiltTransportClient(settings);”时,它将引发异常

IllegalStateException:availableProcessors已经设置为[4]

但是第二次调用它会成功,并且客户端会成功,任何人都知道如何解决它?

在启动时设置以下系统属性: System.setProperty("es.set.netty.runtime.available.processors", "false");

https://discuss.elastic.co/t/elasticsearch-5-4-1-availableprocessors-is-already-set/88036/8

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM