es 6.2.4 xpack权限认证 PreBuiltXPackTransportClient

作者 JeremyJiang | 发布于2018年09月20日 | 阅读数:186

Settings settings = Settings.builder()
.put("xpack.security.transport.ssl.enabled", true)
.put("xpack.security.enabled", true)
.put("xpack.security.user", "elastic:elastic")
// .put("client.transport.ignore_cluster_name", true)
.put("client.transport.sniff", false) //自动嗅探整个集群的状态,把集群中其他ES节点的ip添加到本地的客户端列表中
.put("cluster.name", esClusterName)
.put("request.headers.X-Found-Cluster",esClusterName)
.build();
PreBuiltTransportClient preBuiltTransportClient = new PreBuiltXPackTransportClient(settings);
for (String host : esHost.split(",")) {
preBuiltTransportClient.addTransportAddress(new TransportAddress(InetAddress.getByName(host), 9300));
}
 
断点发现 client存在异常(使用9300端口)
Method threw 'java.lang.StackOverflowError' exception. Cannot evaluate org.elasticsearch.common.inject.InjectorImpl.toString()
 
且 使用RestHighLevelClient 方式 获取数据没有异常(http走的9200端口) 
 
 

 
已邀请:

JeremyJiang

赞同来自:

 None of the configured nodes are available: [{#transport#-1}{toOjNsFuQd21k0H0Wl_czw}{X.X.X.X}{X.X.X.X:9300}]

要回复问题请先登录注册