嘿~ 今天天气不错嘛

ES 5.0 java api shield 连接问题

Elasticsearch | 作者 tonylyf | 发布于2016年12月12日 | 阅读数:4849

5.0 PreBuiltTransportClient连接ES,shield.user和密码在java api里如何设置,或者现在已经不使用这个方法了?通过shield.plugin设置一直会报错。
已邀请:

novia - 1&0

赞同来自:

看这个:http://elasticsearch.cn/article/109
 
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();
}

要回复问题请先登录注册