elasticsearch None of the configured nodes are available遇到的坑


           今天在使用 TransportClient时候  execute时候一直 报错

         

Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{kN4hYC9KTmC-yK1pRDESsQ}{localhost}{127.0.0.1:9300}]]
	at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:347)
	at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:245)
	at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:59)
	at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:363)
	at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:408)
	at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:80)
	at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:54)
	at com.wp.es.EsDemoApplication.testGetNearbyPeople(EsDemoApplication.java:172)
	at com.wp.es.EsDemoApplication.main(EsDemoApplication.java:210)

创建客户端代码如下:

Client client = new PreBuiltTransportClient(Settings.EMPTY).addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));


自己问题有两点:

1.按照了X-Pack插件  具体原因没弄清楚 反正我装上这个插件 就会出现上面错误

2.没有配置 cluster.name 集群名称  







       

你可能感兴趣的:(elastic)