None of the configured nodes are availableException错误解决

来源:互联网 发布:美国非农数据最新消息 编辑:程序博客网 时间:2024/05/22 08:01

1.利用TransportClient对elastic进行操作时,报错如下

2.问题原因:

@SuppressWarnings({ "unchecked", "resource" })public static void main(String[] args) throws Exception {// 先构建clientSettings settings = Settings.builder().put("cluster.name", "my-application1").build();TransportClient client = new PreBuiltTransportClient(settings).addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("192.168.251.130"), 9300));System.out.println(client);createEmployee(client); //getEmployee(client);//updateEmployee(client); //deleteEmployee(client); client.close();}

3.问题解决

1.cluster.name与服务器中配置的名称不符合, 

2.服务器中的配合文件中的cluster.name仍然是被注释的   

3.解决方法: 将名称改为一样即可 

  参考: http://blog.csdn.net/yilan1993/article/details/50955039


阅读全文
0 0