I'm inexperienced with ES and EC2 so forgive me if this is a novice
I'm attempting to run a local java/tomcat application, using the
TransportClient to connect to ES running on EC2. I have the following
configuration on the server (note: some items not included for the sake of
On the client side:
So my initial connection is to the public domain, and I have the ports open
My initial connection appears to succeed, and the client also works fine
when I set client.transport.sniff to false. I have set the log level to
TRACE for org.elasticsearch.client.transport, so I can see this in my logs
on the initial connection:
2012-10-08 08:38:21 DEBUG main org.elasticsearch.client.transport -
[Gatecrasher] adding address
From here we can see that, since localhost is outside of EC2, that domain
name resolves to the external EC2 ip, 23.XX.XX.XX, and the client is able
When I set client.transport.sniff to false, my client connects, the above
is all I see in the logs, and searching/indexing works, so I don't believe
I have any issues with firewalls, open ports or security groups.
However, if I set sniff to true, the client "discovers" the node it has
already connected to - except it attempts to reconnect using the internal
2012-10-08 08:38:26 DEBUG main org.elasticsearch.client.transport -
[Gatecrasher] failed to connect to discovered node
My theory is that even though the server is publishing on public_dns, it
resolves the domain locally (to the internal ip) and then keeps the result,
and then when nodes sniff it out, they attempt to connect to that cached
result rather than resolving the domain.
I have played with various settings trying to get around this - for
example, if set network.publish_host to ec2:publicIp and restart, my
local client connects, rediscovers the node and connects again, but I see
this in the server logs, presumably because the server can't resolve the
[2012-10-08 15:04:44,338][WARN ][cluster.service ] [Abraham
Cornelius] failed to reconnect to node [Abraham
I've also messed with ec2.discovery.host_type and network.tcp.reuse_address
on the server and client sides, and network.publish_host on the client side
to no effect.
So the questions:
-Is my theory correct or am I missing something?
-Is there a way to configure my client or server such that during the
sniff/discovery process, internal nodes use the internal IP and external
nodes (i.e. transport clients on webservers) use the external IP?
-What exactly is the difference between the settings "network.publish_host"
I can work around this for now by disabling client.transport.sniff, but I'm
posting the question because I feel like I'm missing some critical aspect
of configuration that I will need down the line, and this feels like
something that ought to work. Thanks for your attention.