9200端口拒绝连接?

All*_*len 5 node.js elasticsearch

我正在尝试在 Cloud9 工作区上的 NodeJS 中实现一个 elasticsearch 客户端,我只是想让它运行。我的应用程序在端口 5678 上运行,而我的 MongoDB 在 27017 上运行。我尝试搜索其他答案,但我还没有真正找到任何特别有用的东西。这是我在尝试连接到 localhost:9200 时收到的错误消息。

    Elasticsearch ERROR: 2015-06-26T04:24:19Z
  Error: Request error, retrying -- connect ECONNREFUSED
      at Log.error (/home/ubuntu/workspace/node_modules/elasticsearch/src/lib/log.js:213:60)
      at checkRespForFailure (/home/ubuntu/workspace/node_modules/elasticsearch/src/lib/transport.js:192:18)
      at HttpConnector.<anonymous> (/home/ubuntu/workspace/node_modules/elasticsearch/src/lib/connectors/http.js:153:7)
      at ClientRequest.wrapper (/home/ubuntu/workspace/node_modules/elasticsearch/node_modules/lodash/index.js:3128:19)
      at ClientRequest.emit (events.js:95:17)
      at Socket.socketErrorListener (http.js:1552:9)
      at Socket.emit (events.js:95:17)
      at net.js:441:14
      at process._tickCallback (node.js:442:13)

Elasticsearch TRACE: 2015-06-26T04:24:19Z
  -> HEAD http://localhost:9200/

  <- 0


Elasticsearch WARNING: 2015-06-26T04:24:19Z
  Unable to revive connection: http://localhost:9200/

Elasticsearch WARNING: 2015-06-26T04:24:19Z
  No living connections

Trace: elasticsearch cluster is down!
    at Server (/home/ubuntu/workspace/app.js:32:13)
    at respond (/home/ubuntu/workspace/node_modules/elasticsearch/src/lib/transport.js:251:9)
    at sendReqWithConnection (/home/ubuntu/workspace/node_modules/elasticsearch/src/lib/transport.js:171:7)
    at next (/home/ubuntu/workspace/node_modules/elasticsearch/src/lib/connection_pool.js:213:7)
    at process._tickCallback (node.js:442:13)
Run Code Online (Sandbox Code Playgroud)

.

我的弹性搜索客户端代码非常简单

    var client = new elasticsearch.Client({
  hosts: 'localhost:9200',
  log: 'trace'
});

client.ping({
  // ping usually has a 3000ms timeout
  requestTimeout: 30000,

  // undocumented params are appended to the query string
  hello: "elasticsearch!"
}, function (error) {
  if (error) {
    console.trace('elasticsearch cluster is down!');
  } else {
    console.log('All is well');
  }
});
Run Code Online (Sandbox Code Playgroud)

如果我尝试连接到 localhost:5678,我没有收到拒绝的错误,但弹性集群仍然关闭?任何建议都会有所帮助,谢谢:)

All*_*len 0

嘿,对于任何想知道我做了什么的人来说。我基本上只是将elasticsearch下载到cloud9上并运行它。然后我相应地 ping 端口并且成功了。看起来我犯了一个菜鸟错误:P