Ubuntu 15.10 elasticsearch 2.3无法连接到localhost端口9200:连接被拒绝

我刚刚在OSX El Capitan和Ubuntu 15.10上安装了相同版本的elasticsearch,2.3.命令curl -XGET’http:// localhost:9200 /’在OSX中运行完美,但在Ubuntu 15.10上给出了这个错误:

root@levilinode:~# curl -XGET 'http://localhost:9200/'
curl: (7) Failed to connect to localhost port 9200: Connection refused

任何尝试使用与Linux相关的所有帖子修复它关于在文件/etc/elasticsearch/elasticsearch.yml中将参数network.bind_host和/或network.host设置为0.0.0.0或127.0.0.1都是不成功的.

我怎样才能使它工作?

更多细节:

root@levilinode:~# service elasticsearch status
● elasticsearch.service - LSB: Starts elasticsearch
   Loaded: loaded (/etc/init.d/elasticsearch)
   Active: active (exited) since Wed 2016-04-13 13:22:46 EDT; 43min ago
     Docs: man:systemd-sysv-generator(8)

Apr 13 13:22:46 levilinode systemd[1]: Starting LSB: Starts elasticsearch...
Apr 13 13:22:46 levilinode systemd[1]: Started LSB: Starts elasticsearch.
root@levilinode:~# sudo netstat -tulpn | grep 9200
root@levilinode:~# netstat -tulpn | grep 9200
root@levilinode:~#

来自syslog的更多细节:

root@levilinode:~# service elasticsearch start
root@levilinode:~# more /var/log/syslog
Apr 14 07:17:01 levilinode CRON[12883]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Apr 14 08:17:01 levilinode CRON[13000]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Apr 14 09:17:01 levilinode CRON[13116]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Apr 14 10:17:01 levilinode CRON[13216]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Apr 14 10:53:47 levilinode systemd[1]: session-109.scope: Cannot determine UID from slice user-0.slice
Apr 14 10:53:47 levilinode systemd[1]: Started Session 109 of user root.
Apr 14 10:56:12 levilinode systemd[1]: Started LSB: Starts elasticsearch.
Apr 14 10:56:14 levilinode systemd[1]: Started LSB: Starts elasticsearch.
Apr 14 10:56:45 levilinode systemd[1]: Started LSB: Starts elasticsearch.
最佳答案
是否使用此处的指南进行了新安装:

Digital Ocean Tutorials

我唯一改变的是将版本从1.7.2更新到2.3.1.

现在一切顺利.详情如下:

root@levilinode:~# service elasticsearch status
● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
   Active: active (running) since Thu 2016-04-14 11:21:56 EDT; 6min ago
     Docs: http://www.elastic.co
  Process: 13997 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec (code=exited, status=0/SUCCESS)
 Main PID: 14001 (java)
   CGroup: /system.slice/elasticsearch.service
           └─14001 /usr/bin/java -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:C...

Apr 14 11:21:58 levilinode elasticsearch[14001]: [2016-04-14 11:21:58,622][INFO ][env                      ] [Shado...true]
Apr 14 11:21:58 levilinode elasticsearch[14001]: [2016-04-14 11:21:58,623][WARN ][env                      ] [Shado...5536]
Apr 14 11:22:01 levilinode elasticsearch[14001]: [2016-04-14 11:22:01,351][INFO ][node                     ] [Shado...lized
Apr 14 11:22:01 levilinode elasticsearch[14001]: [2016-04-14 11:22:01,352][INFO ][node                     ] [Shado...g ...
Apr 14 11:22:01 levilinode elasticsearch[14001]: [2016-04-14 11:22:01,444][INFO ][transport                ] [Shado...9300}
Apr 14 11:22:01 levilinode elasticsearch[14001]: [2016-04-14 11:22:01,451][INFO ][discovery                ] [Shado...uaF2g
Apr 14 11:22:04 levilinode elasticsearch[14001]: [2016-04-14 11:22:04,521][INFO ][cluster.service          ] [Shado...ived)
Apr 14 11:22:04 levilinode elasticsearch[14001]: [2016-04-14 11:22:04,554][INFO ][http                     ] [Shado...9200}
Apr 14 11:22:04 levilinode elasticsearch[14001]: [2016-04-14 11:22:04,556][INFO ][node                     ] [Shado...arted
Apr 14 11:22:04 levilinode elasticsearch[14001]: [2016-04-14 11:22:04,581][INFO ][gateway                  ] [Shado...state
Hint: Some lines were ellipsized, use -l to show in full.
root@levilinode:~# curl -XGET 'localhost:9200' 
{
  "name" : "Shadow-Hunter",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "2.3.1",
    "build_hash" : "bd980929010aef404e7cb0843e61d0665269fc39",
    "build_timestamp" : "2016-04-04T12:25:05Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.0"
  },
  "tagline" : "You Know, for Search"
}
root@levilinode:~#

转载注明原文:Ubuntu 15.10 elasticsearch 2.3无法连接到localhost端口9200:连接被拒绝 - 代码日志