# NoNodeAvailableException: No node available on Elastic Beanstalk

**URL:** <https://discuss.elastic.co/t/nonodeavailableexception-no-node-available-on-elastic-beanstalk/6033>\
**Category:** Elasticsearch\
**Created:** [December 1, 2011, 12:38am UTC](https://discuss.elastic.co/t/nonodeavailableexception-no-node-available-on-elastic-beanstalk/6033 "2011-12-01T00:38:11Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eugene\_Strokin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eugene_strokin/32/1238_2.png) [@Eugene\_Strokin](https://discuss.elastic.co/u/Eugene_Strokin)\
**Post date:** [December 1, 2011, 12:38am UTC](https://discuss.elastic.co/t/nonodeavailableexception-no-node-available-on-elastic-beanstalk/6033/1 "2011-12-01T00:38:11Z")

</div>

Hello,  
I have a cluster set up in AWS, and it looks fine.  
Now, my application, which connects to ES via TransportClient is  
running on ElasticBeanstalk.  
I have set client.transport.sniff=true and cluster name is set as  
well.  
I don't set any inetSockerTransportAddresses  
Once my app is started I'm getting  
org.elasticsearch.client.transport.NoNodeAvailableException: No node  
available  
at  
org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:  
170)  
at  
org.elasticsearch.client.transport.support.InternalTransportClient.search(InternalTransportClient.java:  
254)

If I set sniff to false and provide local IP addresses of the boxes  
I'm running ES on, I'm getting the same exception.  
But, if I set it to public URL as inetSockerTransportAddresses it  
works.

Honestly, I don't understand hot sniff should find my cluster in the  
first place.  
Please, any information is appreciated.

Thank you,  
E.S.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [December 1, 2011, 2:10pm UTC](https://discuss.elastic.co/t/nonodeavailableexception-no-node-available-on-elastic-beanstalk/6033/2 "2011-12-01T14:10:27Z")

</div>

sniff will not go and find the cluster automatically. You need to add the  
address of at least one node in the cluster to the transport client. What  
sniff will do when enabled, is that it will get from that node the rest of  
the nodes in the cluster, and use all of those when round robin requests.

On Thu, Dec 1, 2011 at 2:38 AM, Eugene Strokin [eugene@strokin.info](mailto:eugene@strokin.info) wrote:

> Hello,  
> I have a cluster set up in AWS, and it looks fine.  
> Now, my application, which connects to ES via TransportClient is  
> running on ElasticBeanstalk.  
> I have set client.transport.sniff=true and cluster name is set as  
> well.  
> I don't set any inetSockerTransportAddresses  
> Once my app is started I'm getting  
> org.elasticsearch.client.transport.NoNodeAvailableException: No node  
> available  
> at
> 
> org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:  
> 170)  
> at
> 
> org.elasticsearch.client.transport.support.InternalTransportClient.search(InternalTransportClient.java:  
> 254)
> 
> If I set sniff to false and provide local IP addresses of the boxes  
> I'm running ES on, I'm getting the same exception.  
> But, if I set it to public URL as inetSockerTransportAddresses it  
> works.
> 
> Honestly, I don't understand hot sniff should find my cluster in the  
> first place.  
> Please, any information is appreciated.
> 
> Thank you,  
> E.S.

---

<div class="post-metadata">

**Author:** ![Eugene\_Strokin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eugene_strokin/32/1238_2.png) [@Eugene\_Strokin](https://discuss.elastic.co/u/Eugene_Strokin)\
**Post date:** [December 1, 2011, 2:47pm UTC](https://discuss.elastic.co/t/nonodeavailableexception-no-node-available-on-elastic-beanstalk/6033/3 "2011-12-01T14:47:52Z")

</div>

I c... Thank you. I guess it would make sense to get a static IP for  
one of the nodes of the cluster, and set it in properties of the  
application. If the ES server would get restarted, I wouldn't need to  
change the IP, and the rest nodes will be sniffed even if IPs will be  
changed.

On Dec 1, 9:10 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> sniff will not go and find the cluster automatically. You need to add the  
> address of at least one node in the cluster to the transport client. What  
> sniff will do when enabled, is that it will get from that node the rest of  
> the nodes in the cluster, and use all of those when round robin requests.
> 
> On Thu, Dec 1, 2011 at 2:38 AM, Eugene Strokin [eug...@strokin.info](mailto:eug...@strokin.info) wrote:
> 
> > Hello,  
> > I have a cluster set up in AWS, and it looks fine.  
> > Now, my application, which connects to ES via TransportClient is  
> > running on ElasticBeanstalk.  
> > I have set client.transport.sniff=true and cluster name is set as  
> > well.  
> > I don't set any inetSockerTransportAddresses  
> > Once my app is started I'm getting  
> > org.elasticsearch.client.transport.NoNodeAvailableException: No node  
> > available  
> > at
> 
> > org.elasticsearch.client.transport.TransportClientNodesService.execute(Tran sportClientNodesService.java:  
> > 170)  
> > at
> 
> > org.elasticsearch.client.transport.support.InternalTransportClient.search(I nternalTransportClient.java:  
> > 254)
> 
> > If I set sniff to false and provide local IP addresses of the boxes  
> > I'm running ES on, I'm getting the same exception.  
> > But, if I set it to public URL as inetSockerTransportAddresses it  
> > works.
> 
> > Honestly, I don't understand hot sniff should find my cluster in the  
> > first place.  
> > Please, any information is appreciated.
> 
> > Thank you,  
> > E.S.

---

<div class="post-metadata">

**Author:** ![Gramby\_2](https://avatars.discourse-cdn.com/v4/letter/g/94ad74/32.png) [@Gramby\_2](https://discuss.elastic.co/u/Gramby_2)\
**Post date:** [December 4, 2011, 11:45pm UTC](https://discuss.elastic.co/t/nonodeavailableexception-no-node-available-on-elastic-beanstalk/6033/4 "2011-12-04T23:45:28Z")

</div>

I have a similar problem. Using AWS and ElasticBeanstalk on one small  
node (for the moment). The node is up & running and I'm using a simple  
Tomcat WAR to interface to the cluster. I get a  
NoNodeAvailableException using this:

client = new TransportClient(settingsBuilder()  
.put("cluster.name", "example-cluster")  
.put("client.transport.sniff", true)  
.build())  
.addTransportAddress(new  
InetSocketTransportAddress("localhost", 9300));

If I ssh into the EC2 instance, a curl'd health check to localhost:  
9200 works fine and a netstat -an gives me

tcp 0 0 :::  
9300 :::\* LISTEN

so it seems like this should work. Suggestions?

Thanks

On Dec 1, 7:10 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> sniff will not go and find the cluster automatically. You need to add the  
> address of at least one node in the cluster to the transport client. What  
> sniff will do when enabled, is that it will get from that node the rest of  
> the nodes in the cluster, and use all of those when round robin requests.

---

<div class="post-metadata">

**Author:** ![Gramby\_2](https://avatars.discourse-cdn.com/v4/letter/g/94ad74/32.png) [@Gramby\_2](https://discuss.elastic.co/u/Gramby_2)\
**Post date:** [December 5, 2011, 2:26am UTC](https://discuss.elastic.co/t/nonodeavailableexception-no-node-available-on-elastic-beanstalk/6033/5 "2011-12-05T02:26:03Z")

</div>

The short answer is "never mind".

The longer answer is that the exception was being thrown while  
preparing a search with an invalid term (using termQuery), which threw  
me off the scent.

On Dec 4, 4:45 pm, Gramby [sp...@splix.org](mailto:sp...@splix.org) wrote:

> I have a similar problem. Using AWS and ElasticBeanstalk on one small  
> node (for the moment). The node is up & running and I'm using a simple  
> Tomcat WAR to interface to the cluster. I get a  
> NoNodeAvailableException using this:
> 
> client = new TransportClient(settingsBuilder()  
> .put("cluster.name", "example-cluster")  
> .put("client.transport.sniff", true)  
> .build())  
> .addTransportAddress(new  
> InetSocketTransportAddress("localhost", 9300));
> 
> If I ssh into the EC2 instance, a curl'd health check to localhost:  
> 9200 works fine and a netstat -an gives me
> 
> tcp 0 0 :::  
> 9300 :::\* LISTEN
> 
> so it seems like this should work. Suggestions?
> 
> Thanks
> 
> On Dec 1, 7:10 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

---

<div class="post-metadata">

**Author:** ![Gramby\_2](https://avatars.discourse-cdn.com/v4/letter/g/94ad74/32.png) [@Gramby\_2](https://discuss.elastic.co/u/Gramby_2)\
**Post date:** [December 5, 2011, 3:55am UTC](https://discuss.elastic.co/t/nonodeavailableexception-no-node-available-on-elastic-beanstalk/6033/6 "2011-12-05T03:55:42Z")

</div>

In the interest of not misleading anyone based on my previous  
message...

The real problem that I had was that I was doing a client.close() at  
the end of my jsp file but only creating the connection if(client ==  
null). Since I wasn't setting client to null after the close, the  
first time the jsp was rendered it worked; subsequent times didn't.  
And since this was on Elastic Beanstalk, the health monitor was eating  
my one working session. I just happened to get lucky (unlucky?) and  
get the first execution when I was messing with the terms in my query.

My solution was to make my client object a static (I suppose I should  
make it final, too) and never close it since the transport client acts  
similarly to a connection pool.

Sorry if my previous caused any confusion.

On Dec 4, 7:26 pm, Gramby [sp...@splix.org](mailto:sp...@splix.org) wrote:

> The short answer is "never mind".
> 
> The longer answer is that the exception was being thrown while  
> preparing a search with an invalid term (using termQuery), which threw  
> me off the scent.
> 
> On Dec 4, 4:45 pm, Gramby [sp...@splix.org](mailto:sp...@splix.org) wrote:

---

<div class="post-metadata">

**Author:** ![Eugene\_Strokin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eugene_strokin/32/1238_2.png) [@Eugene\_Strokin](https://discuss.elastic.co/u/Eugene_Strokin)\
**Post date:** [December 6, 2011, 3:32am UTC](https://discuss.elastic.co/t/nonodeavailableexception-no-node-available-on-elastic-beanstalk/6033/7 "2011-12-06T03:32:43Z")

</div>

Gramby, Since you have experience with Beanstack, here is another  
problem which you could know how to solve:  
I have the same, typical situation: application which uses ES via  
TransferClient on Beanstalk, and ES Cluster on other AWS instances. I  
have a singleton which provides the client to the application, so this  
is something similar like you have it static. I nether close the  
client.  
Once I deploy a new version to Beanstalk, I'm getting NodeNotFound  
exception. This is strange, because nothing is changed on ES side at  
all.  
I don't know how to solve it really, I'm just trying different things.  
So I found out the only way it starts working, when I do following  
steps:

- Deploy new version of the application on Beanstalk, start getting  
NodeNotFound exception
- Restart ES
- Open ports 9300 and 9200 to public on ES security policy (I don't  
know if it affects the connection inside of the AWS network or not),  
I'm doing it only to check ES from my local computer, so I'm not sure  
if it affects anything.
- Wait 5 minutes while ES pics up the index files from S3
- Everything starts working
- Close ports 9300 and 9200 to public, everything works as expected.

So, I guess my questions would be: Do you have NodeNotFound problem  
when you deploy a new version of the application? Or could you suggest  
something about working with Beanstalk.  
Apparently, Beanstalk has downtime during deployment even without any  
problems, and this problem with the connection makes it even worse.

Thank you,  
any comments or suggestions are appreciated,  
Eugene S.

On Dec 4, 10:55 pm, Gramby [sp...@splix.org](mailto:sp...@splix.org) wrote:

> In the interest of not misleading anyone based on my previous  
> message...
> 
> The real problem that I had was that I was doing a client.close() at  
> the end of my jsp file but only creating the connection if(client ==  
> null). Since I wasn't setting client to null after the close, the  
> first time the jsp was rendered it worked; subsequent times didn't.  
> And since this was on Elastic Beanstalk, the health monitor was eating  
> my one working session. I just happened to get lucky (unlucky?) and  
> get the first execution when I was messing with the terms in my query.
> 
> My solution was to make my client object a static (I suppose I should  
> make it final, too) and never close it since the transport client acts  
> similarly to a connection pool.
> 
> Sorry if my previous caused any confusion.
> 
> On Dec 4, 7:26 pm, Gramby [sp...@splix.org](mailto:sp...@splix.org) wrote:
> 
> > The short answer is "never mind".
> 
> > The longer answer is that the exception was being thrown while  
> > preparing a search with an invalid term (using termQuery), which threw  
> > me off the scent.
> 
> > On Dec 4, 4:45 pm, Gramby [sp...@splix.org](mailto:sp...@splix.org) wrote:

---

<div class="post-metadata">

**Author:** ![Gramby\_2](https://avatars.discourse-cdn.com/v4/letter/g/94ad74/32.png) [@Gramby\_2](https://discuss.elastic.co/u/Gramby_2)\
**Post date:** [December 7, 2011, 4:00am UTC](https://discuss.elastic.co/t/nonodeavailableexception-no-node-available-on-elastic-beanstalk/6033/8 "2011-12-07T04:00:35Z")

</div>

Hi Eugene,

I'm not sure if I can pinpoint exactly what your problem is, but based  
on your original message and this one, I suspect you have a firewall  
problem. Let me make sure I understand this correctly:

1. You have ES running on an EC2 cluster of one or more instances.
2. You're using an Elastic Beanstalk instance to connect to that  
cluster using a fixed IP or name of some sort for the cluster.
3. When you deploy a new WAR to your Elastic Beanstalk instance, you  
can't seem to connect to ES on your EC2 cluster anymore.

Is this correct?

I'm assuming you've set up a security group for your cluster so that  
all of your nodes can talk to each other. Within that group, have you  
added your Elastic Beanstalk security group as a source for inbound  
traffic to your cluster on ports 9200 and 9300? You don't have to just  
specify a specific IP for the inbound traffic; you can also use other  
security groups as a source.

Also, if you SSH into one of your cluster nodes, you should be able to  
verify that ES is still running using:

curl -XGET '[http://localhost:9200/\_cluster/health?pretty=true](http://localhost:9200/_cluster/health?pretty=true)'

(this assumes that you're starting your nodes with IP address 0.0.0.0)

I also added the public IP address of my router to my security group  
for ports 9200 & 9300 so that I can access the cluster without  
shelling into it or making the ports open to the world.

Hope this helps.

Also, feel free to email me directly if you need a quicker response.

On Dec 5, 8:32 pm, Eugene Strokin [eug...@strokin.info](mailto:eug...@strokin.info) wrote:

> Gramby, Since you have experience with Beanstack, here is another  
> problem which you could know how to solve:  
> I have the same, typical situation: application which uses ES via  
> TransferClient on Beanstalk, and ES Cluster on other AWS instances. I  
> have a singleton which provides the client to the application, so this  
> is something similar like you have it static. I nether close the  
> client.  
> Once I deploy a new version to Beanstalk, I'm getting NodeNotFound  
> exception. This is strange, because nothing is changed on ES side at  
> all.  
> I don't know how to solve it really, I'm just trying different things.  
> So I found out the only way it starts working, when I do following  
> steps:
> 
> - Deploy new version of the application on Beanstalk, start getting  
> NodeNotFound exception
> - Restart ES
> - Open ports 9300 and 9200 to public on ES security policy (I don't  
> know if it affects the connection inside of the AWS network or not),  
> I'm doing it only to check ES from my local computer, so I'm not sure  
> if it affects anything.
> - Wait 5 minutes while ES pics up the index files from S3
> - Everything starts working
> - Close ports 9300 and 9200 to public, everything works as expected.
> 
> So, I guess my questions would be: Do you have NodeNotFound problem  
> when you deploy a new version of the application? Or could you suggest  
> something about working with Beanstalk.  
> Apparently, Beanstalk has downtime during deployment even without any  
> problems, and this problem with the connection makes it even worse.
> 
> Thank you,  
> any comments or suggestions are appreciated,  
> Eugene S.
> 
> On Dec 4, 10:55 pm, Gramby [sp...@splix.org](mailto:sp...@splix.org) wrote:

---

<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, 3:46am UTC](https://discuss.elastic.co/t/nonodeavailableexception-no-node-available-on-elastic-beanstalk/6033/9 "2017-07-06T03:46:16Z")

</div>


