question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Request error, retrying -- connect ECONNREFUSED 127.0.0.1:9200

See original GitHub issue

Hi guys, i’m hitting this over & over again.

 Elasticsearch ERROR: 2016-01-07T21:20:52Z
  Error: Request error, retrying -- connect ECONNREFUSED 127.0.0.1:9200
      at Log.error (/usr/src/project/node_modules/elasticsearch/src/lib/log.js:225:56)
      at checkRespForFailure (/usr/src/project/node_modules/elasticsearch/src/lib/transport.js:231:18)
      at HttpConnector.<anonymous> (/usr/src/project/node_modules/elasticsearch/src/lib/connectors/http.js:153:7)
      at ClientRequest.wrapper (/usr/src/project/node_modules/elasticsearch/node_modules/lodash/index.js:3095:19)
      at emitOne (events.js:77:13)
      at ClientRequest.emit (events.js:169:7)
      at Socket.socketErrorListener (_http_client.js:259:9)
      at emitOne (events.js:77:13)
      at Socket.emit (events.js:169:7)
      at emitErrorNT (net.js:1253:8)

Elasticsearch WARNING: 2016-01-07T21:20:52Z
  Unable to revive connection: http://localhost:9200/

Elasticsearch WARNING: 2016-01-07T21:20:52Z
  No living connections

Error: No Living connections
    at sendReqWithConnection (/usr/src/project/node_modules/elasticsearch/src/lib/transport.js:210:15)
    at next (/usr/src/project/node_modules/elasticsearch/src/lib/connection_pool.js:213:7)
    at doNTCallback0 (node.js:419:9)
    at process._tickCallback (node.js:348:13)

The situation is like this. I have a nodejs app running inside a docker container. Inside this app, I’ve create the client like this

var client = new elasticsearch.Client({
        connectionClass: CustomESHTTPConnector,
        host: process.env.ELASTICSEARCH_HOST,
        deadTimeout: 100000,
        maxRetries: 6
    });

Where ELASTICSEARCH_HOST is the address of another VM inside the same network => 10.0.0.5 running ES, of course

If I curl 10.0.0.5:9200 inside the container, and inside the VM hosting that container, I get

{
  "name" : "app-node",
  "cluster_name" : "app-cluster",
  "version" : {
    "number" : "2.1.1",
    "build_hash" : "40e2c53a6b6c2972b3d13846e450e66f4375bd71",
    "build_timestamp" : "2015-12-15T13:05:55Z",
    "build_snapshot" : false,
    "lucene_version" : "5.3.1"
  },
  "tagline" : "You Know, for Search"
}

The app shoud reach the elasticsearch server. Any ideas why im getting this? Thanks in advance

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:6
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
matiasdecarlicommented, Jan 11, 2016

Closing this.

The error was the process.env.ELASTICSEARCH_HOST not being set at the runtime for another reason. Thaks for your help @iquirino & @spalger !

2reactions
iquirinocommented, Jan 8, 2016

Change network.host: 0.0.0.0 to network.host: "localhost"

Are you using NAT or Bridge? If using NAT, dont forget to explicitly specify port redirection.

VMWare, Oracle VirtualBox ??

Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to resolve 'Error: connect ECONNREFUSED 127.0.0.1 ...
Your code is trying to access the local host: uri: 'http://localhost:9200/users/user/' + uid,. This won't work: you can't just access ...
Read more >
connect ECONNREFUSED 127.0.0.1:9200"} and Server is not ...
After lunching docker-compose file I've this problem issue. In case I try to see the dashborad on loclahost:5601 there's a response ("Kibana ...
Read more >
How to Fix ECONNREFUSED – connection refused by server ...
If you're looking for a way to fix the ECONNREFUSED ECONNREFUSED - Connection refused by server error, check out our detailed tutorial now!...
Read more >
connect ECONNREFUSED 127.0.0.1:3306 solved in Node JS ...
How to fix Error : connect ECONNREFUSED 127.0.0.1:3306 in node js and mysql is shown.
Read more >
Node.js Error: connect ECONNREFUSED - DEV Community ‍ ‍
Node.js Error: connect ECONNREFUSED - how to connect Node with phpMyAdmin · Day 1. I run this code, and should work fine. ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found