es 6.2.4 xpack权限认证 PreBuiltXPackTransportClient
Elasticsearch | 作者 JeremyJiang | 发布于2018年09月20日 | 阅读数:4650
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端口)
.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端口)
3 个回复
JeremyJiang
赞同来自:
wocan23
赞同来自:
hanyaoyang
赞同来自: