# Elasticsearch java client on EC2

**URL:** <https://discuss.elastic.co/t/elasticsearch-java-client-on-ec2/15461>\
**Category:** Elasticsearch\
**Created:** [January 29, 2014, 1:04am UTC](https://discuss.elastic.co/t/elasticsearch-java-client-on-ec2/15461 "2014-01-29T01:04:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maxime\_Nay](https://avatars.discourse-cdn.com/v4/letter/m/edb3f5/32.png) [@Maxime\_Nay](https://discuss.elastic.co/u/Maxime_Nay)\
**Post date:** [January 29, 2014, 1:04am UTC](https://discuss.elastic.co/t/elasticsearch-java-client-on-ec2/15461/1 "2014-01-29T01:04:36Z")

</div>

Hi,

For some reason I can't get the java client working on EC2.

My elasticsearch cluster and the cluster running my java application are in  
two different security groups ('elasticsearchrealtime' and 'storm'), in the  
same aws region.  
I am using elasticsearch version 0.90.2 and using the cloud aws plugin  
version 1.12.0. (in my es cluster and in my java application)

I tried lot of combinations for the properties, and none of them worked.  
I always get the following warning :

[Elastic Search Realtime Client] waited for 30s and no initial state was  
set by the discovery

And after that, each time the java application is trying to interact with  
the client the following exception is thrown :  
org.elasticsearch.discovery.MasterNotDiscoveredException: waited for [30s]  
at  
org.elasticsearch.action.support.master.TransportMasterNodeOperationAction$3.onTimeout(TransportMasterNodeOperationAction.java:169)  
at  
org.elasticsearch.cluster.service.InternalClusterService$NotifyTimeout.run(InternalClusterService.java:377)  
at  
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)  
at java.lang.Thread.run(Thread.java:722)

The elasticsearchrealtime security group authorizes storm security group on  
every tcp,udp and icmp ports.  
The storm security group authorizes elasticsearchrealtime security group on  
every tcp,udp and icmp ports.

Here are my current properties for the client :

################################### Cluster  
###################################

cluster.name: elasticsearchrealtime

#################################### Index  
####################################

index.number\_of\_shards: 16  
index.number\_of\_replicas: 1

################################### Memory  
####################################

bootstrap.mlockall: true

################################## Discovery  
##################################

discovery.zen.ping.timeout: 5m  
discovery.type=ec2  
discovery.ec2.groups: elasticsearchrealtime,storm  
discovery.ec2.ping\_timeout: 60s  
discovery.ec2.any\_group: true

################################# AWS Settings  
###################################

cloud.aws.region: us-east-1  
cloud.aws.access\_key: xxxx  
cloud.aws.secret\_key: xxxx  
cloud.aws.s3.endpoint: [s3.amazonaws.com](http://s3.amazonaws.com)  
cloud.aws.ec2.endpoint: [ec2.us-east-1.amazonaws.com](http://ec2.us-east-1.amazonaws.com)  
gateway.s3.region: us-east-1

################################### Client  
###################################

node.name: Elastic Search Realtime Client  
node.client: true  
node.data: false

And here is the elasticsearch.yml file for one of my elasticsearch node :

################################### Cluster  
###################################

cluster.name: elasticsearchrealtime

#################################### Index  
####################################

index.number\_of\_shards: 16  
index.number\_of\_replicas: 1

################################### Memory  
####################################

bootstrap.mlockall: true

################################## Discovery  
##################################

discovery.zen.ping.timeout: 5m  
discovery.type: ec2  
discovery.ec2.groups: elasticsearchrealtime,storm  
discovery.ec2.ping\_timeout: 60s  
discovery.ec2.any\_group: true

####################### AWS Settings  
cloud.aws.region: us-east-1  
cloud.aws.access\_key: xxxxx  
cloud.aws.secret\_key: xxxxxx  
cloud.aws.s3.endpoint: [s3.amazonaws.com](http://s3.amazonaws.com)  
cloud.aws.ec2.endpoint: [ec2.us-east-1.amazonaws.com](http://ec2.us-east-1.amazonaws.com)  
gateway.s3.region: us-east-1

node.name: Elastic Search Realtime 1

Any help would be greatly appreciated !

Maxime

--  
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/58880718-a1cd-4a8f-8bbd-84dbc71d4805%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/58880718-a1cd-4a8f-8bbd-84dbc71d4805%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [January 29, 2014, 1:38am UTC](https://discuss.elastic.co/t/elasticsearch-java-client-on-ec2/15461/2 "2014-01-29T01:38:01Z")

</div>

Is this a typo?

discovery.type=ec2

Jörg

--  
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/CAKdsXoF8mo64zwmiyYwQ6FQQPLX9iuPT8-G2O50-mSdnAUFVnQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoF8mo64zwmiyYwQ6FQQPLX9iuPT8-G2O50-mSdnAUFVnQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Maxime\_Nay](https://avatars.discourse-cdn.com/v4/letter/m/edb3f5/32.png) [@Maxime\_Nay](https://discuss.elastic.co/u/Maxime_Nay)\
**Post date:** [January 29, 2014, 1:49am UTC](https://discuss.elastic.co/t/elasticsearch-java-client-on-ec2/15461/3 "2014-01-29T01:49:56Z")

</div>

Nope, I just made a typo by translating my elasticsearch properties file  
here. 🙂  
I use spring to inject all my properties into my Client. All the properties  
for the client are actually like this :

node.name=Elastic Search Realtime Client  
node.client=true  
node.data=false  
cluster.name=elasticsearchrealtime

#################################### Index  
####################################

index.number\_of\_shards=16  
index.number\_of\_replicas=1

################################### Memory  
####################################

# Elasticsearch performs poorly when JVM starts swapping=you should ensure

that

# it _never_ swaps.

# 

# Set this property to true to lock the memory:

# 

bootstrap.mlockall=true

################################## Discovery  
##################################

discovery.type=ec2  
discovery.ec2.groups=elasticsearchrealtime,storm  
discovery.ec2.ping\_timeout=60s  
discovery.ec2.any\_group=true

####################### AWS Settings  
cloud.aws.region=us-east-1  
cloud.aws.access\_key=xxxx  
cloud.aws.secret\_key=xxxx

Thanks though!

On Tuesday, January 28, 2014 5:38:01 PM UTC-8, Jörg Prante wrote:

> Is this a typo?
> 
> discovery.type=ec2
> 
> Jörg

--  
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/f3c995a0-52c7-4984-b80f-dc0143a4abdc%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f3c995a0-52c7-4984-b80f-dc0143a4abdc%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 1:54am UTC](https://discuss.elastic.co/t/elasticsearch-java-client-on-ec2/15461/4 "2017-07-06T01:54:17Z")

</div>


