# Cluster setup using aws Ec2 discovery module

**URL:** <https://discuss.elastic.co/t/cluster-setup-using-aws-ec2-discovery-module/93058>\
**Category:** Elasticsearch\
**Created:** [July 13, 2017, 4:38pm UTC](https://discuss.elastic.co/t/cluster-setup-using-aws-ec2-discovery-module/93058 "2017-07-13T16:38:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajayrc](https://avatars.discourse-cdn.com/v4/letter/a/c77e96/32.png) [@ajayrc](https://discuss.elastic.co/u/ajayrc)\
**Post date:** [July 13, 2017, 4:38pm UTC](https://discuss.elastic.co/t/cluster-setup-using-aws-ec2-discovery-module/93058/1 "2017-07-13T16:38:12Z")

</div>

## Vm1: [cluster.name](http://cluster.name): cluster-elastic [node.name](http://node.name): node 1 node.master: true node.data: false node.ingest: false network.host: _ec2:privateIpv4_ http.port: 9200 cloud.aws.access\_key: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* cloud.aws.secret\_key: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* cloud.aws.protocol: http cloud.aws.ec2.protocol: http cloud.aws.region: us-east-2 discovery.zen.hosts\_provider: ec2 discovery.ec2.host\_type: tag:tagname discovery.ec2.availability\_zones: "us-east-2c" discovery.zen.minimum\_master\_nodes: 2 discovery.zen.ping\_timeout: 60s discovery.zen.fd.ping\_retries: 20

## Vm2: [cluster.name](http://cluster.name): cluster-elastic [node.name](http://node.name): node 2 node.master: true node.data: true node.ingest: false network.host: _ec2:privateIpv4_ http.port: 9200 cloud.aws.access\_key: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* cloud.aws.secret\_key: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* cloud.aws.protocol: http cloud.aws.ec2.protocol: http cloud.aws.region: us-east-2 discovery.zen.hosts\_provider: ec2 discovery.ec2.host\_type: tag:tagname discovery.ec2.availability\_zones: "us-east-2a" discovery.zen.minimum\_master\_nodes: 2 discovery.zen.ping\_timeout: 60s discovery.zen.fd.ping\_retries: 20

## Vm3: [cluster.name](http://cluster.name): cluster-elastic [node.name](http://node.name): node 3 node.master: true node.data: true node.ingest: false network.host: _ec2:privateIpv4_ http.port: 9200 cloud.aws.access\_key: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* cloud.aws.secret\_key: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* cloud.aws.protocol: http cloud.aws.ec2.protocol: http cloud.aws.region: us-east-2 discovery.zen.hosts\_provider: ec2 discovery.ec2.host\_type: tag:tagname discovery.ec2.availability\_zones: "us-east-2a" discovery.zen.minimum\_master\_nodes: 2 discovery.zen.ping\_timeout: 60s discovery.zen.fd.ping\_retries: 20

## log:

## [root@ip-172-31-34-82 elasticsearch]# tail -100 monitorpro-es.log at org.elasticsearch.discovery.ec2.AwsEc2UnicastHostsProvider$DiscoNodesCache.refresh(AwsEc2UnicastHostsProvider.java:227) [discovery-ec2-5.5.0.jar:5.5.0] at org.elasticsearch.common.util.SingleObjectCache.getOrRefresh(SingleObjectCache.java:54) [elasticsearch-5.5.0.jar:5.5.0] at org.elasticsearch.discovery.ec2.AwsEc2UnicastHostsProvider.buildDynamicNodes(AwsEc2UnicastHostsProvider.java:102) [discovery-ec2-5.5.0.jar:5.5.0] at org.elasticsearch.discovery.zen.UnicastZenPing.ping(UnicastZenPing.java:309) [elasticsearch-5.5.0.jar:5.5.0] at org.elasticsearch.discovery.zen.UnicastZenPing.ping(UnicastZenPing.java:286) [elasticsearch-5.5.0.jar:5.5.0] at org.elasticsearch.discovery.zen.ZenDiscovery.pingAndWait(ZenDiscovery.java:1010) [elasticsearch-5.5.0.jar:5.5.0] at org.elasticsearch.discovery.zen.ZenDiscovery.findMaster(ZenDiscovery.java:869) [elasticsearch-5.5.0.jar:5.5.0] at org.elasticsearch.discovery.zen.ZenDiscovery.innerJoinCluster(ZenDiscovery.java:378) [elasticsearch-5.5.0.jar:5.5.0] at org.elasticsearch.discovery.zen.ZenDiscovery.access$4100(ZenDiscovery.java:83) [elasticsearch-5.5.0.jar:5.5.0] at org.elasticsearch.discovery.zen.ZenDiscovery$JoinThreadControl$1.run(ZenDiscovery.java:1188) [elasticsearch-5.5.0.jar:5.5.0] at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:569) [elasticsearch-5.5.0.jar:5.5.0] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0\_131] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0\_131] at java.lang.Thread.run(Thread.java:748) [?:1.8.0\_131] [2017-07-13T16:34:31,035][WARN][o.e.d.z.ZenDiscovery] [node-1] not enough master nodes discovered during pinging (found [[Candidate{node={node-1}{YiDgHjVITcyCJtUqtaH8\_w}{2WDApO52Q-aAEbEri8PJTg}{172.31.34.82}{172.31.34.82:9300}, clusterStateVersion=-1}]], but needed [2]), pinging again [2017-07-13T16:34:31,159][WARN][o.e.d.e.AwsEc2UnicastHostsProvider] [node-1] failed to add i-0c031afbfc1c808bb, address node1 java.net.UnknownHostException: node1: Name or service not known at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) ~[?:1.8.0\_131] at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928) ~[?:1.8.0\_131] at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323) ~[?:1.8.0\_131] at java.net.InetAddress.getAllByName0(InetAddress.java:1276) ~[?:1.8.0\_131] at java.net.InetAddress.getAllByName(InetAddress.java:1192) ~[?:1.8.0\_131] at java.net.InetAddress.getAllByName(InetAddress.java:1126) ~[?:1.8.0\_131] at org.elasticsearch.transport.TcpTransport.parse(TcpTransport.java:921) ~[elasticsearch-5.5.0.jar:5.5.0] at org.elasticsearch.transport.TcpTransport.addressesFromString(TcpTransport.java:876) ~[elasticsearch-5.5.0.jar:5.5.0] at org.elasticsearch.transport.TransportService.addressesFromString(TransportService.java:691) ~[elasticsearch-5.5.0.jar:5.5.0] at org.elasticsearch.discovery.ec2.AwsEc2UnicastHostsProvider.fetchDynamicNodes(AwsEc2UnicastHostsProvider.java:181) [discovery-ec2-5.5.0.jar:5.5.0] at org.elasticsearch.discovery.ec2.AwsEc2UnicastHostsProvider$DiscoNodesCache.refresh(AwsEc2UnicastHostsProvider.java:242) [discovery-ec2-5.5.0.jar:5.5.0] at org.elasticsearch.discovery.ec2.AwsEc2UnicastHostsProvider$DiscoNodesCache.refresh(AwsEc2UnicastHostsProvider.java:227) [discovery-ec2-5.5.0.jar:5.5.0] at org.elasticsearch.common.util.SingleObjectCache.getOrRefresh(SingleObjectCache.java:54) [elasticsearch-5.5.0.jar:5.5.0] at org.elasticsearch.discovery.ec2.AwsEc2UnicastHostsProvider.buildDynamicNodes(AwsEc2UnicastHostsProvider.java:102) [discovery-ec2-5.5.0.jar:5.5.0] at org.elasticsearch.discovery.zen.UnicastZenPing.ping(UnicastZenPing.java:309) [elasticsearch-5131]

using ec2 dicovery module and tagname for creating a cluster and am getting this error while i try to setup my elastic search cluster kindly help me in resolving this

---

<div class="post-metadata">

**Author:** ![outcoldman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/outcoldman/32/20061_2.png) [@outcoldman](https://discuss.elastic.co/u/outcoldman)\
**Post date:** [July 14, 2017, 4:43am UTC](https://discuss.elastic.co/t/cluster-setup-using-aws-ec2-discovery-module/93058/2 "2017-07-14T04:43:56Z")

</div>

> [@ajayrc](#):
>
> node 1

You have a space in node name, curious if that can be a reason for this issue. I would assume that maybe some uri compatible name should be used. Maybe `node-1`

---

<div class="post-metadata">

**Author:** ![ajayrc](https://avatars.discourse-cdn.com/v4/letter/a/c77e96/32.png) [@ajayrc](https://discuss.elastic.co/u/ajayrc)\
**Post date:** [July 14, 2017, 9:32am UTC](https://discuss.elastic.co/t/cluster-setup-using-aws-ec2-discovery-module/93058/3 "2017-07-14T09:32:51Z")

</div>

i haven't given any spaces for node name

---

<div class="post-metadata">

**Author:** ![outcoldman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/outcoldman/32/20061_2.png) [@outcoldman](https://discuss.elastic.co/u/outcoldman)\
**Post date:** [July 14, 2017, 3:44pm UTC](https://discuss.elastic.co/t/cluster-setup-using-aws-ec2-discovery-module/93058/4 "2017-07-14T15:44:50Z")

</div>

> [@ajayrc](#):
>
> i haven't given any spaces for node name

it is in your example above

> [@ajayrc](#):
>
> network.host: ec2:privateIpv4

And just to clarify - is that getting replaced by real `ec2:privateIpv4`? Or you keep it this way?

> [@ajayrc](#):
>
> [2017-07-13T16:34:31,159][WARN][o.e.d.e.AwsEc2UnicastHostsProvider] [node-1] failed to add i-0c031afbfc1c808bb, address node1

this log message is very clear says that the node `node-1` advertises its address as `node1`, not the `ec2:privateIpv4`

---

<div class="post-metadata">

**Author:** ![ajayrc](https://avatars.discourse-cdn.com/v4/letter/a/c77e96/32.png) [@ajayrc](https://discuss.elastic.co/u/ajayrc)\
**Post date:** [July 14, 2017, 4:03pm UTC](https://discuss.elastic.co/t/cluster-setup-using-aws-ec2-discovery-module/93058/5 "2017-07-14T16:03:23Z")

</div>

yes actually the node names are like node-1,node-2,node-3 am just keeping (ec2:privateIpv4) it that way should change it like for eg 12.23.45.56

---

<div class="post-metadata">

**Author:** ![outcoldman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/outcoldman/32/20061_2.png) [@outcoldman](https://discuss.elastic.co/u/outcoldman)\
**Post date:** [July 14, 2017, 4:27pm UTC](https://discuss.elastic.co/t/cluster-setup-using-aws-ec2-discovery-module/93058/6 "2017-07-14T16:27:26Z")

</div>

I prefer to set `network.bind_host` (localhost and external) and `network.publish_host` (only external) instead of `network.host`.  
Curious if this is some kind of bug, that node is advertising node name, not the ip address specified in the `network.host`.

Also you can take a look on more verbose logging. Try to set `logger.discovery.ec2` to more verbose level.

---

<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:** [August 11, 2017, 4:27pm UTC](https://discuss.elastic.co/t/cluster-setup-using-aws-ec2-discovery-module/93058/7 "2017-08-11T16:27:40Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
