Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ubuntu 15.10 elasticsearch 2.3 Failed to connect to localhost port 9200: Connection refused

I just installed the same version of elasticsearch, 2.3, on OSX El Capitan and Ubuntu 15.10. The command curl -XGET 'http://localhost:9200/' works perfectly in OSX, but on Ubuntu 15.10 is giving me this error:

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

Any attempts to fix it using all posts related to Linux about setting in the file /etc/elasticsearch/elasticsearch.yml the parameters network.bind_host and / or network.host to 0.0.0.0 or 127.0.0.1 were unsuccessful.

How can I make it work?

More details:

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:~#

More details from 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.
like image 427
L.D Avatar asked Oct 19 '22 11:10

L.D


1 Answers

Did a new installation using the guidelines from here:

Digital Ocean Tutorials

The only thing I changed was to update the version from 1.7.2 to 2.3.1.

Now everything works well. Details below:

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:~#
like image 142
L.D Avatar answered Oct 21 '22 02:10

L.D