I have an ES 2.3.2 cluster configured and running in AWS EC2 (VPC). I've opened up both the REST and Transport ports in the security group. I want to be able to connect a TransportClient to the remote cluster running AWS EC2 but it can never seem to connect
tl;dr; To cluster properly publish_host
has to be the EC2 Internal Ip
so the hosts can cluster within the VPC; External to VPC the internal ip
address is unreachable; but the TransportClient seems to only connect if the addedTransportAddress
matches the publish_host
.
Ports are correct and open with connection to host from external
I'm able to curl against both ports the rest port returns as expected
{
"name" : "NODE_NAME",
"cluster_name" : "CLUSTER_NAME",
"version" : {
"number" : "2.3.2",
"build_hash" : "b9e4a6acad4008027e4038f6abed7f7dba346f94",
"build_timestamp" : "2016-04-21T16:03:47Z",
"build_snapshot" : false,
"lucene_version" : "5.5.0"
},
"tagline" : "You Know, for Search"
}
When I curl against the Transport port it is connecting to the cluster but obviously does not serve HTTP traffic and returns the following message:
This is not a HTTP port
Yet whenever I attempt to initialize a TransportClient using the following configuration it has no available nodes:
Settings.settingsBuilder()
.put(ELASTICSEARCH_CLIENT_TRANSPORT_SNIFF_KEY, false)
.put(ELASTICSEARCH_CLIENT_TRANSPORT_IGNORE_CLUSTER_NAME_KEY, true)
.put(ELASTICSEARCH_CLIENT_TRANSPORT_PING_TIMEOUT_KEY, "30s")
.put(ELASTICSEARCH_CLIENT_TRANSPORT_NODES_SAMPLER_INTERVAL_KEY, "30s")
.build()
...
transportClient.addTransportAddress(EC2_INSTANCE_PUBLIC_IP)
I am using the EC2 Discovery mechanism
Pertinent config section(s)
transport.tcp.port: 8193
transport.tcp.compress: true
http.compression: true
http.cors.enabled: true
http.port: 8192
discovery.type: ec2
discovery.ec2.tag.ElasticSearch: DeviceProfileLookup
network.host: ["_site_"]
network.bind_host: 0.0.0.0
I've tried setting network.host to ["_ec2:publicIp_", "_ec2:privateIp_"]
which then prevents the cluster from clustering on startup.
It sounds like the TransportClient is only able to connect to the cluster if the address used is the same as the publish_host
. When I tried setting the publish_host
to _ec2:publicIp_
, the TransportClient was able to connect, but then then the hosts that live in EC2 are unable to connect to each other.
Any insight or advice would be much appreciated.
Thanks.