I'm attempting to follow the elastic/found-shield-example (https://github.com/elastic/found-shield-example) to connect to a cluster running on elastic.co using the elastic Java client, however, I'm unable to connect successfully and get the following error when trying to run the example:
"Unable to get cluster health response: None of the configured nodes are available"
The cluster responds as follows when using curl:
curl -u user.name:password https://d44312.eu-west-1.aws.found.io:9243
{
"name" : "instance-0000000005",
"cluster_name" : "d44312",
"cluster_uuid" : "nFyb_Hn6RPaA4NVsBsi8Pw",
"version" : {
"number" : "5.0.2",
"build_hash" : "f6b4951",
"build_date" : "2016-11-24T10:07:18.101Z",
"build_snapshot" : false,
"lucene_version" : "6.2.1"
},
"tagline" : "You Know, for Search"
}
The Java client is using version 5.0.2 as per the following gradle configuration:
repositories {
maven {
url "https://artifacts.elastic.co/maven"
}
}
dependencies {
compile "org.elasticsearch.client:transport:5.0.2"
compile "org.elasticsearch.client:x-pack-transport:5.0.2"
compile group: 'org.apache.logging.log4j', name: 'log4j-jcl', version: '2.7'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.7'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.7'
}
Following the elastic/found-shield-example code I use the following Settings object:
Settings settings = Settings.builder()
.put("client.transport.nodes_sampler_interval", "5s")
.put("client.transport.sniff", false)
.put("transport.tcp.compress", true)
.put("cluster.name", clusterName)
.put("xpack.security.transport.ssl.enabled", enableSsl)
.put("request.headers.X-Found-Cluster", "${cluster.name}")
.put("xpack.security.user", System.getProperty("xpack.security.user"))
.build();
EnableSsl defaults to true and ip6Enabled defaults to false. All other code is as per the example and I'm running the code with the following parameters:
-Dhost=d44312.eu-west-1.aws.found.io -Dxpack.security.user='user.name:password'
This results in clusterName == d44312 when passed to the settings object and System.getProperty("xpack.security.user") returning the correct user name and password as verified using curl. When I execute the application I get the following output:
2016-12-06 11:01:10 INFO TransportExample:63 - Connecting to cluster: [d44312] via [d44312.eu-west-1.aws.found.io:9243] using ssl:[true]
2016-12-06 11:01:11 DEBUG InternalLoggerFactory:71 - Using SLF4J as the default logging framework
2016-12-06 11:01:13 DEBUG ThreadLocalRandom:71 - -Dio.netty.initialSeedUniquifier: 0x2fff87f07a81477e
2016-12-06 11:01:20 INFO TransportExample:92 - Getting cluster health...
2016-12-06 11:01:20 ERROR TransportExample:97 - Unable to get cluster health response: [None of the configured nodes are available: [{#transport#-1}{y8F-q5jKRxmNS2vq05ErBg}{176.34.254.82}{176.34.254.82:9243}, {#transport#-2}{XtAEiZuhTLqPaP6eyu_XdA}{46.137.179.48}{46.137.179.48:9243}, {#transport#-3}{q4Y3jgpVR8OMsUpJiSy5Sw}{46.137.180.129}{46.137.180.129:9243}, {#transport#-4}{MFvEEfS-R4qpJldiJhlX6g}{54.75.226.168}{54.75.226.168:9243}, {#transport#-5}{EBXGWf1sRkaWluepLYKjSQ}{54.217.237.247}{54.217.237.247:9243}, {#transport#-6}{FvNsCgSBRzqvZGvQtBUowQ}{54.217.243.67}{54.217.243.67:9243}]]
I'm somewhat stuck with this as I can't see where I'm going wrong. Could anyone suggest what the problem might be or recommend any avenues for investigation?
Thanks!