# Node Discovery in elasticsearch on amazon EC2

**URL:** <https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490>\
**Category:** Elasticsearch\
**Created:** [December 7, 2015, 5:39am UTC](https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490 "2015-12-07T05:39:23Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![siddharth\_gupta](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@siddharth\_gupta](https://discuss.elastic.co/u/siddharth_gupta)\
**Post date:** [December 7, 2015, 5:39am UTC](https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490/1 "2015-12-07T05:39:23Z")

</div>

Hello,

I was using elastic search 1.7.0 on amzon EC2 and everything was working fine.

The nodes were able to discover each other and joined together.

But when I switched to elasticsearch 2.1.0 things have been difficult.

The nodes are not able to discover each other.

Have they made any difference ?  
Please help me with this issue.

Thanks & regards  
Siddharth

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 7, 2015, 6:35am UTC](https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490/2 "2015-12-07T06:35:13Z")

</div>

Probably `network.host` not set.

---

<div class="post-metadata">

**Author:** ![vladmiller](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vladmiller/32/5909_2.png) [@vladmiller](https://discuss.elastic.co/u/vladmiller)\
**Post date:** [December 7, 2015, 7:23am UTC](https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490/3 "2015-12-07T07:23:50Z")

</div>

Perhaps there could be few issues.

- Make sure your ES nodes listen on correct interface
- Make sure your security groups are open and set to allow 9300-9400 traffic between nodes
- Use aws-ec2 discovery plugin to discover other nodes

Also check error logs to see if there any useful information

---

<div class="post-metadata">

**Author:** ![siddharth\_gupta](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@siddharth\_gupta](https://discuss.elastic.co/u/siddharth_gupta)\
**Post date:** [December 7, 2015, 11:42am UTC](https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490/4 "2015-12-07T11:42:12Z")

</div>

Thanks for your reply!  
When i set  
\*\*network.host : _ec2:publicIpv4_ \*\*  
the publish address is same as the IP of my instance but when I start the nodes it says bound address could not be assigned.  
Do you know what can be the missing part ?

Thanks & regards  
Siddharth Gupta

---

<div class="post-metadata">

**Author:** ![siddharth\_gupta](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@siddharth\_gupta](https://discuss.elastic.co/u/siddharth_gupta)\
**Post date:** [December 7, 2015, 11:45am UTC](https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490/5 "2015-12-07T11:45:04Z")

</div>

@vladmiller Thanks for the reply.  
I am sure about the last two points in your reply.  
Can you please elaborate a little about the first one ?  
Error logs do not show any useful information.

Thanks & Regards  
Siddharth Gupta.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 7, 2015, 1:47pm UTC](https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490/6 "2015-12-07T13:47:07Z")

</div>

Can you share your logs?

---

<div class="post-metadata">

**Author:** ![vladmiller](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vladmiller/32/5909_2.png) [@vladmiller](https://discuss.elastic.co/u/vladmiller)\
**Post date:** [December 8, 2015, 3:53am UTC](https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490/7 "2015-12-08T03:53:38Z")

</div>

Here is my config. I am using cloud-aws plugin to discover other nodes

Sorry, cannot paste it properly here  
[http://pastebin.com/e8Ert1h7](http://pastebin.com/e8Ert1h7)

---

<div class="post-metadata">

**Author:** ![siddharth\_gupta](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@siddharth\_gupta](https://discuss.elastic.co/u/siddharth_gupta)\
**Post date:** [December 8, 2015, 9:07am UTC](https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490/8 "2015-12-08T09:07:30Z")

</div>

@dadoonet  
[m] publish\_address {52.23.160.86:9300}, bound\_addresses {127.0.0.1:9300}, {[::1]:9300}

where 'm' is the name of my node. publish address is fine but I think there is some problem with bound\_address. Am I right ?

When I use network.host: ec2:publicIpv4 it says:

Exception in thread "main" BindTransportException[Failed to bind to [9300-9400]]; nested: ChannelException[Failed to bind to: /52.23.160.86:9400]; nested: BindException[Cannot assign requested address];  
Likely root cause: java.net.BindException: Cannot assign requested address

Can you see something through it ?

Thanks & Regards  
Sidddharth Gupta

---

<div class="post-metadata">

**Author:** ![siddharth\_gupta](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@siddharth\_gupta](https://discuss.elastic.co/u/siddharth_gupta)\
**Post date:** [December 8, 2015, 9:13am UTC](https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490/9 "2015-12-08T09:13:39Z")

</div>

> [@siddharth\_gupta](#):
>
> [m] publish\_address {52.23.160.86:9300}, bound\_addresses {127.0.0.1:9300}, {[::1]:9300}
> 
> where 'm' is the name of my node. publish address is fine but I think there is some problem with bound\_address. Am I right ?
> 
> When I use network.host: ec2:publicIpv4 it says:
> 
> Exception in thread "main" BindTransportException[Failed to bind to [9300-9400]]; nested: ChannelException[Failed to bind to: /52.23.160.86:9400]; nested: BindException[Cannot assign requested address];Likely root cause: java.net.BindException: Cannot assign requested address
> 
> Can you see something through it ?

Thanks & regards  
Siddharth

---

<div class="post-metadata">

**Author:** ![siddharth\_gupta](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@siddharth\_gupta](https://discuss.elastic.co/u/siddharth_gupta)\
**Post date:** [December 8, 2015, 9:14am UTC](https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490/10 "2015-12-08T09:14:40Z")

</div>

I used the same config on elasticsearch 2.1.0  
It is working fine in elasticsearch 1.7.1

---

<div class="post-metadata">

**Author:** ![siddharth\_gupta](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@siddharth\_gupta](https://discuss.elastic.co/u/siddharth_gupta)\
**Post date:** [December 8, 2015, 9:19am UTC](https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490/11 "2015-12-08T09:19:27Z")

</div>

When I start the other node it says::

[2015-12-08 09:18:16,192][WARN][discovery] [m+d] waited for 30s and no initial state was set by the discovery  
[2015-12-08 09:18:16,272][INFO][http] [m+d] publish\_address {52.23.160.86:9201}, bound\_addresses {127.0.0.1:9201}, {[::1]:9201}  
[2015-12-08 09:18:16,274][INFO][node] [m+d] started

That means the node has started but the node has not joined the old one.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 8, 2015, 9:22am UTC](https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490/12 "2015-12-08T09:22:49Z")

</div>

Your config is wrong for sure. May be share it with us?

---

<div class="post-metadata">

**Author:** ![siddharth\_gupta](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@siddharth\_gupta](https://discuss.elastic.co/u/siddharth_gupta)\
**Post date:** [December 8, 2015, 10:30am UTC](https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490/15 "2015-12-08T10:30:46Z")

</div>

```
cluster.name: my-app
node.name: m+d
node.data: true
node.master: true
bootstrap.mlockall: true
network.publish_host: _ec2:publicIpv4_ 
discovery.ec2.host_type: public_dns
cloud.aws.access_key: XXXXXXXXXXXXXXXXXXXXXXX
cloud.aws.secret_key: XXXXXXXXXXXXXXXXXXXXXXX
discovery.zen.ping.timeout: 30s
discovery.zen.ping.multicast.enabled: false
discovery.type: ec2
discovery.zen.ping.unicast.hosts: ["ec2-52-23-160-86.compute-1.amazonaws.com"]
discovery.zen.minimum_master_nodes: 2
http.cors.enabled: true
http.cors.allow-origin: "*"
```

---

<div class="post-metadata">

**Author:** ![siddharth\_gupta](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@siddharth\_gupta](https://discuss.elastic.co/u/siddharth_gupta)\
**Post date:** [December 8, 2015, 10:31am UTC](https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490/16 "2015-12-08T10:31:41Z")

</div>

Above is my elasticsearch.yml

Can you point out where I am messing things up

Thanks  
Siddharth

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 8, 2015, 5:12pm UTC](https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490/17 "2015-12-08T17:12:52Z")

</div>

I edited your answer to shows only uncommented settings.

Some comments:

- Set `network.publish_host: _ec2_`
- Remove `network.publish_host: _ec2:publicIpv4_`
- Remove `discovery.ec2.host_type: public_dns`
- Remove `discovery.zen.ping.unicast.hosts: ["ec2-52-23-160-86.compute-1.amazonaws.com"]`
- Remove `discovery.zen.ping.multicast.enabled: false`

And restart...

So basically try `elasticsearch.yml`:

```auto
cluster.name: my-app
node.name: m+d
bootstrap.mlockall: true
network.host: _ec2_ 
cloud.aws.access_key: XXXXXXXXXXXXXXXXXXXXXXX
cloud.aws.secret_key: XXXXXXXXXXXXXXXXXXXXXXX
discovery.type: ec2
discovery.zen.minimum_master_nodes: 2

```

Let me know how it goes.

---

<div class="post-metadata">

**Author:** ![siddharth\_gupta](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@siddharth\_gupta](https://discuss.elastic.co/u/siddharth_gupta)\
**Post date:** [December 16, 2015, 6:03am UTC](https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490/18 "2015-12-16T06:03:45Z")

</div>

That worked ! Thanks a lot!

---

<div class="post-metadata">

**Author:** ![Python\_Coder](https://avatars.discourse-cdn.com/v4/letter/p/aeb1de/32.png) [@Python\_Coder](https://discuss.elastic.co/u/Python_Coder)\
**Post date:** [February 20, 2016, 2:47pm UTC](https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490/19 "2016-02-20T14:47:01Z")

</div>

gorgeous 😉

---

<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 5, 2017, 11:14pm UTC](https://discuss.elastic.co/t/node-discovery-in-elasticsearch-on-amazon-ec2/36490/20 "2017-07-05T23:14:44Z")

</div>


