None of the configured nodes are availableException错误解决

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

None of the configured nodes are availableException错误解决_第1张图片

2.问题原因:

@SuppressWarnings({ "unchecked", "resource" })
	public static void main(String[] args) throws Exception {
		// 先构建client
		Settings 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


 
  

你可能感兴趣的:(elasticsearch)