ElasticSearch x-pack ssl使用transportclient连接

ElasticSearch x-pack使用transportclient连接

setting设置

String absolutePath = ResourceUtils.getFile(ResourceUtils.CLASSPATH_URL_PREFIX + keystorePath).getAbsolutePath();

settings = builder.put("xpack.security.enabled", true)
                        .put("xpack.security.user", username + ":" + password)
                        .put("xpack.security.transport.ssl.enabled", true)
                        .put("xpack.security.transport.ssl.keystore.path", absolutePath)
                        .put("xpack.security.transport.ssl.truststore.path", absolutePath)
                        .put("xpack.security.transport.ssl.verification_mode", "certificate")
                        .put("cluster.name", clusterName).put("client.transport.sniff", isCluster).build();

使用PreBuiltXPackTransportClient

beanDefinitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(PreBuiltXPackTransportClient.class);

你可能感兴趣的:(工具使用方法)