端口9200拒绝连接?

我试图在Cloud9工作区的NodeJS中实现一个elasticsearch客户端,我只是想让它运行。 我的应用程序在端口5678上运行,而我的MongoDB在27017上运行。我试图寻找其他答案,但是我没有发现任何特别有用的东西。 这是尝试连接到本地主机时收到的错误消息: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) 

我的代码为弹性search客户端是非常简单的

  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'); } }); 

如果我尝试连接到本地主机:5678,我没有得到一个错误拒绝,但弹性集群仍然下降? 任何build议将是有益的,谢谢:)

嘿,任何人想知道我做了什么。 我基本上只是将elasticsearch下载到cloud9并运行它。 然后,我相应的端口,它的工作。 看起来像我的一个noobie错误:P

在我的情况下,股票elasticsearch与默认的一切,并使用JS客户端导致这个错误。

(短期)修复: http.cors.enabledhttps.cors.allow-origin设置