# EC2 client node cluster discovery

**URL:** <https://discuss.elastic.co/t/ec2-client-node-cluster-discovery/22934>\
**Category:** Elasticsearch\
**Created:** [March 26, 2015, 9:08pm UTC](https://discuss.elastic.co/t/ec2-client-node-cluster-discovery/22934 "2015-03-26T21:08:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jerry\_Pattenaude](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@Jerry\_Pattenaude](https://discuss.elastic.co/u/Jerry_Pattenaude)\
**Post date:** [March 26, 2015, 9:08pm UTC](https://discuss.elastic.co/t/ec2-client-node-cluster-discovery/22934/1 "2015-03-26T21:08:46Z")

</div>

I am running elasticsearch 1.4.4 and the aws plugin 2.4.1

I am trying to run multiple clusters on the same machine with the same es  
install. It's a small dataset and I'm running a qe, demo, and staging  
cluster.

My java api client won't connect to a running es server after a tomcat  
restart, but when I restart the es cluster it discovers the running client.  
I have opened ports 9200-9400 for internal communication using a security  
group that is also used for ec2 discovery

When I restart the staging tomcat instance it rejoins elastic search. When  
I restart qe it does not rejoin with the warning:  
"org.elasticsearch.discovery: 91 - [Peter Noble] waited for 30s and no  
initial state was set by the discovery"

If I restart the qe es cluster it picks up Peter Noble right away.

Earlier today this situation was switched where the staging cluster would  
have to be restarted. I think the change was after I brought down both  
clusters and brought staging up first.

_Additional config details:_  
The web servers a all seperate AWS servers in the same subnet and the 3 es  
clusters are all running on the same box.

I'm passing cluster name and node name in when starting elastic search

elasticsearch --cluster.name=QE --node.name=es-qe-1

My es master has the config:

discovery.zen.ping.multicast.enabled: false  
discovery.type: ec2  
discovery.ec2.groups: elasticsearch  
cloud.aws.protocol: http  
cloud.aws.region: us-east-1  
cloud.aws.access\_key: \*\*\*\*\*\*  
cloud.aws.secret\_key: \*\*\*\*\*\*  
discovery.ec2.ping\_timeout: 10s

I'm using the java api from a node client

NodeBuilder nodeBuilder = nodeBuilder().clusterName(clusterName).client(true);  
if (isAws) {  
ImmutableSettings.Builder settings =  
ImmutableSettings.settingsBuilder()  
.put("cloud.aws.access\_key", "**_")  
.put("cloud.aws.secret\_key", "_**")  
.put("cloud.aws.region", "us-east-1")  
.put("cloud.aws.protocol", "http")  
.put("discovery.type", "ec2")  
.put("discovery.ec2.groups", "elasticsearch")  
.put("discovery.zen.ping.multicast.enabled", "false");  
nodeBuilder = nodeBuilder.settings(settings);

Any ideas would be appreciated!

Jerry

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/090d6bab-0ace-4537-99f7-547410fa5372%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/090d6bab-0ace-4537-99f7-547410fa5372%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Jerry\_Pattenaude](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@Jerry\_Pattenaude](https://discuss.elastic.co/u/Jerry_Pattenaude)\
**Post date:** [March 28, 2015, 3:02am UTC](https://discuss.elastic.co/t/ec2-client-node-cluster-discovery/22934/2 "2015-03-28T03:02:05Z")

</div>

Still trying to figure out a way past this issue but I actually know what's going on now. The first cluster takes port 9300 and anything looking for a different cluster on that same machine stops when it sees 9300 is in use by a different cluster. Elasticsearch used to scan the port range but they removed that code because it's expensive to check so many ports. There is a pull request to make the number of ports to scan configurable.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/870412d3-95dd-4b5b-b42e-60dc16411c78%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/870412d3-95dd-4b5b-b42e-60dc16411c78%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Jerry\_Pattenaude](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@Jerry\_Pattenaude](https://discuss.elastic.co/u/Jerry_Pattenaude)\
**Post date:** [March 31, 2015, 1:12pm UTC](https://discuss.elastic.co/t/ec2-client-node-cluster-discovery/22934/3 "2015-03-31T13:12:47Z")

</div>

Seems like not many other people have this problem...

In my case this was only a problem using unicast (which cloud-aws does), so  
I changed the cloud plugin to work for my case. The file that needed to be  
changed was AwsEc2UnicastHostsProvider.java. Look for UnicastZenPing.LIMIT\_PORTS\_COUNT.  
That const is hard coded to 1 in ES v1.5. I changed it to read a config  
value or use the const if no config was found. This worked fine for me  
with the es-1.5 2.5.0 version of the plugin.

Seems like anyone running more than one node on a server not using  
multicast could have this issue.

On Friday, March 27, 2015 at 11:02:05 PM UTC-4, Jerry Pattenaude wrote:

> Still trying to figure out a way past this issue but I actually know  
> what's going on now. The first cluster takes port 9300 and anything looking  
> for a different cluster on that same machine stops when it sees 9300 is in  
> use by a different cluster. Elasticsearch used to scan the port range but  
> they removed that code because it's expensive to check so many ports. There  
> is a pull request to make the number of ports to scan configurable.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/ccafba78-3c68-40e8-9e0b-0f6618517abc%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ccafba78-3c68-40e8-9e0b-0f6618517abc%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:22am UTC](https://discuss.elastic.co/t/ec2-client-node-cluster-discovery/22934/4 "2017-07-06T00:22:46Z")

</div>


