java客户端连接es5.0(基于xpack安全管理)

 
Settings settings = Settings.builder().put("cluster.name", "xxx")
.put("xpack.security.transport.ssl.enabled", false)
.put("xpack.security.user", "xxx:xxx")
.put("client.transport.sniff", true).build();
try {
client = new PreBuiltXPackTransportClient(settings)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("xxx.xxx.xxx.xxx"), 9300))
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("xxx.xxx.xxx.xxx"), 9300));
} catch (UnknownHostException e) {
e.printStackTrace();
}

9 个评论

java.lang.IllegalArgumentException: unknown setting [xpack.security.transport.ssl.enabled] please check that any required plugins are installed, or check the breaking changes documentation for removed settings
我的是5.0.1,安装了x-pack,采用楼主相同的写法,但是报错,求指导
你访问集群需要密码吗?
需要密码
PreBuiltXPackTransportClient这个来源于哪个jar包,我下了transport包但是没有该类
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>x-pack-transport</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
完美解决问题,谢谢楼主
楼主我还是没法导x-pack-transport啊,它不在elasticsearch5.0.0的Bin里,求问怎么办
啊啊啊我傻了,是lib里面

要回复文章请先登录注册