Error connecting to elasticsearch hosted on AWS via AWS EC2 instance


(Shashank Raghuveer) #1

Hello

Can anyone please help me with an issue I am facing with regards to connecting to elasticsearch hosted on AWS. I am using the High level Rest client to make requests and running the java application as Jar.

Error that I am currently running into:
java.net.ConnectException: Connection refused
at org.elasticsearch.client.RestClient$SyncResponseListener.get(RestClient.java:943)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:227)
at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1256)
at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1231)
at org.elasticsearch.client.RestHighLevelClient.get(RestHighLevelClient.java:416)
at org.onlineadvocate.elasticload.LoadTimeService.getLoadTime(LoadTimeService.java:82)
at org.onlineadvocate.elasticload.ElasticSearchLoader.getLastLoadTime(ElasticSearchLoader.java:48)
at org.onlineadvocate.elasticload.ElasticSearchLoader.loadSiteResourcesIntoElastic(ElasticSearchLoader.java:35)
at org.onlineadvocate.elasticload.SiteLoader.loadSites(SiteLoader.java:50)
at org.onlineadvocate.elasticload.SiteLoaderMain.main(SiteLoaderMain.java:28)
Caused by: java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:171)
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:145)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:348)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:192)
at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64)
at java.lang.Thread.run(Thread.java:748)

However, I was able to successfully make curl requests from the EC2 instance and receive successful response.

Thanks for your help.


(David Pilato) #2

Are you hosting it yourself?

May be share node logs and your code.
Formatted please so it's readable


(Shashank Raghuveer) #3

I am not hosting the elasticsearch . We are using the AWS Elasticsearch service and unfortunately I don't have any node logs and cannot share the source code. We use High level Rest client to make requests and it runs just fine, if I make requests as part of War vs Jar.


(David Pilato) #4

I can't help then.

BTW did you look at https://www.elastic.co/cloud and https://aws.amazon.com/marketplace/pp/B01N6YCISK ?

Cloud by elastic is one way to have access to all features, all managed by us. Think about what is there yet like Security, Monitoring, Reporting, SQL and what is coming like Canvas...

I'm using this one with the HLRest Client without any problem.


(system) #5

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