Connecting Elasticsearch in Ubuntu 17.04


(Kilmer Luiz Aleluia) #1

Even if a do a sudo service elasticsearch start, I'm not able to access http://localhost:9200/: This site can’t be reached. localhost refused to connect.

But when I hit elasticsearch status, I get:

● elasticsearch.service - LSB: Starts elasticsearch
Loaded: loaded (/etc/init.d/elasticsearch; generated; vendor preset
Active: active (exited) since Sat 2017-12-23 13:35:46 -03; 18min ag
Docs: man:systemd-sysv-generator(8)
Process: 16475 ExecStop=/etc/init.d/elasticsearch stop (code=exited,
Process: 16511 ExecStart=/etc/init.d/elasticsearch start (code=exite
Tasks: 0 (limit: 4915)
CGroup: /system.slice/elasticsearch.service
dez 23 13:35:46 aleluia-Inspiron-5548 systemd[1]: Starting LSB: Starts
dez 23 13:35:46 aleluia-Inspiron-5548 elasticsearch[16511]:  * Startin
dez 23 13:35:46 aleluia-Inspiron-5548 elasticsearch[16511]:    ...done
dez 23 13:35:46 aleluia-Inspiron-5548 systemd[1]: Started LSB: Starts 
This will be displayed in a monospaced font. The first four spaces
will be stripped off, but all other whitespace will be preserved.

I already tried removing the comment char in START_DAEMON, and it seems it worked to a lot of people, as suggested here: Can't start elasticsearch with Ubuntu 16.04. I've tried too editing elasticsearch.yml file, explicitly setting network.host as 127.0.0.1 (or 0.0.0.0 as well) and http.port as 9200. Also i tried mixing this solutions but none of them worked.

Also, after starting elasticsearch, netstat -a -n | grep tcp | grep 9200 returns nothing.

If I hit journalctl -u elasticsearch, I get:

-- Logs begin at Sat 2017-12-23 12:31:03 -03, end at Sat 2017-12-23 16
dez 23 12:31:11 aleluia-Inspiron-5548 systemd[1]: Starting LSB: Starts
dez 23 12:31:11 aleluia-Inspiron-5548 elasticsearch[1449]:  * Starting
dez 23 12:31:11 aleluia-Inspiron-5548 elasticsearch[1449]:    ...done.
dez 23 12:31:11 aleluia-Inspiron-5548 systemd[1]: Started LSB: Starts 
dez 23 12:58:42 aleluia-Inspiron-5548 systemd[1]: Stopping LSB: Starts
dez 23 12:58:42 aleluia-Inspiron-5548 elasticsearch[7235]:  * Stopping
dez 23 12:58:42 aleluia-Inspiron-5548 elasticsearch[7235]:    ...done.
dez 23 12:58:42 aleluia-Inspiron-5548 systemd[1]: Stopped LSB: Starts 
dez 23 12:58:42 aleluia-Inspiron-5548 systemd[1]: Starting LSB: Starts
dez 23 12:58:42 aleluia-Inspiron-5548 elasticsearch[7271]:  * Starting
dez 23 12:58:42 aleluia-Inspiron-5548 elasticsearch[7271]:    ...done.
dez 23 12:58:42 aleluia-Inspiron-5548 systemd[1]: Started LSB: Starts 
dez 23 12:59:34 aleluia-Inspiron-5548 systemd[1]: Stopping LSB: Starts
dez 23 12:59:34 aleluia-Inspiron-5548 systemd[1]: Stopped LSB: Starts 
dez 23 12:59:34 aleluia-Inspiron-5548 systemd[1]: Starting LSB: Starts
dez 23 12:59:34 aleluia-Inspiron-5548 systemd[1]: Started LSB: Starts 
dez 23 13:24:49 aleluia-Inspiron-5548 systemd[1]: Stopping LSB: Starts
dez 23 13:24:49 aleluia-Inspiron-5548 systemd[1]: Stopped LSB: Starts 
dez 23 13:33:24 aleluia-Inspiron-5548 systemd[1]: Starting LSB: Starts
dez 23 13:33:24 aleluia-Inspiron-5548 systemd[1]: Started LSB: Starts 
dez 23 13:35:46 aleluia-Inspiron-5548 systemd[1]: Stopping LSB: Starts
dez 23 13:35:46 aleluia-Inspiron-5548 elasticsearch[16475]:  * Stoppin
dez 23 13:35:46 aleluia-Inspiron-5548 elasticsearch[16475]:    ...done
dez 23 13:35:46 aleluia-Inspiron-5548 systemd[1]: Stopped LSB: Starts 
dez 23 13:35:46 aleluia-Inspiron-5548 systemd[1]: Starting LSB: Starts
dez 23 13:35:46 aleluia-Inspiron-5548 elasticsearch[16511]:  * Startin
dez 23 13:35:46 aleluia-Inspiron-5548 elasticsearch[16511]:    ...done
dez 23 13:35:46 aleluia-Inspiron-5548 systemd[1]: Started LSB: Starts 
dez 23 14:04:11 aleluia-Inspiron-5548 systemd[1]: Stopping LSB: Starts
dez 23 14:04:11 aleluia-Inspiron-5548 elasticsearch[19271]:  * Stoppin
dez 23 14:04:11 aleluia-Inspiron-5548 elasticsearch[19271]:    ...done
dez 23 14:04:11 aleluia-Inspiron-5548 systemd[1]: Stopped LSB: Starts 
dez 23 14:04:11 aleluia-Inspiron-5548 systemd[1]: Starting LSB: Starts
dez 23 14:04:11 aleluia-Inspiron-5548 elasticsearch[19306]:  * Startin
dez 23 14:04:11 aleluia-Inspiron-5548 elasticsearch[19306]:    ...done
dez 23 14:04:11 aleluia-Inspiron-5548 systemd[1]: Started LSB: Starts 
dez 23 14:06:11 aleluia-Inspiron-5548 systemd[1]: Stopping LSB: Starts
dez 23 14:06:11 aleluia-Inspiron-5548 elasticsearch[19573]:  * Stoppin
dez 23 14:06:11 aleluia-Inspiron-5548 elasticsearch[19573]:    ...done
dez 23 14:06:11 aleluia-Inspiron-5548 systemd[1]: Stopped LSB: Starts 
dez 23 14:06:11 aleluia-Inspiron-5548 systemd[1]: Starting LSB: Starts
dez 23 14:06:11 aleluia-Inspiron-5548 elasticsearch[19609]:  * Startin
dez 23 14:06:11 aleluia-Inspiron-5548 elasticsearch[19609]:    ...done
dez 23 14:06:11 aleluia-Inspiron-5548 systemd[1]: Started LSB: Starts 
dez 23 14:11:39 aleluia-Inspiron-5548 systemd[1]: Stopping LSB: Starts
dez 23 14:11:39 aleluia-Inspiron-5548 elasticsearch[20165]:  * Stoppin
dez 23 14:11:39 aleluia-Inspiron-5548 elasticsearch[20165]:    ...done
dez 23 14:11:39 aleluia-Inspiron-5548 systemd[1]: Stopped LSB: Starts 
dez 23 14:11:39 aleluia-Inspiron-5548 systemd[1]: Starting LSB: Starts
dez 23 14:11:40 aleluia-Inspiron-5548 elasticsearch[20200]:  * Startin
dez 23 14:11:40 aleluia-Inspiron-5548 elasticsearch[20200]:    ...done
dez 23 14:11:40 aleluia-Inspiron-5548 systemd[1]: Started LSB: Starts 
dez 23 14:14:07 aleluia-Inspiron-5548 systemd[1]: Stopping LSB: Starts
dez 23 14:14:07 aleluia-Inspiron-5548 systemd[1]: Stopped LSB: Starts 
dez 23 14:14:07 aleluia-Inspiron-5548 systemd[1]: Starting LSB: Starts
dez 23 14:14:07 aleluia-Inspiron-5548 systemd[1]: Started LSB: Starts 
dez 23 14:25:03 aleluia-Inspiron-5548 systemd[1]: Stopping LSB: Starts
dez 23 14:25:03 aleluia-Inspiron-5548 systemd[1]: Stopped LSB: Starts 
dez 23 14:25:03 aleluia-Inspiron-5548 systemd[1]: Starting LSB: Starts
dez 23 14:25:03 aleluia-Inspiron-5548 systemd[1]: Started LSB: Starts 
dez 23 14:26:29 aleluia-Inspiron-5548 systemd[1]: Stopping LSB: Starts
dez 23 14:26:29 aleluia-Inspiron-5548 systemd[1]: Stopped LSB: Starts 
dez 23 14:26:29 aleluia-Inspiron-5548 systemd[1]: Starting LSB: Starts
dez 23 14:26:29 aleluia-Inspiron-5548 systemd[1]: Started LSB: Starts 
dez 23 14:26:58 aleluia-Inspiron-5548 systemd[1]: Stopping LSB: Starts
dez 23 14:26:58 aleluia-Inspiron-5548 systemd[1]: Stopped LSB: Starts 
dez 23 14:26:58 aleluia-Inspiron-5548 systemd[1]: Starting LSB: Starts
dez 23 14:26:58 aleluia-Inspiron-5548 systemd[1]: Started LSB: Starts 
dez 23 14:27:06 aleluia-Inspiron-5548 systemd[1]: Stopping LSB: Starts
dez 23 14:27:06 aleluia-Inspiron-5548 systemd[1]: Stopped LSB: Starts 
dez 23 14:27:06 aleluia-Inspiron-5548 systemd[1]: Starting LSB: Starts
dez 23 14:27:06 aleluia-Inspiron-5548 systemd[1]: Started LSB: Starts 
dez 23 14:31:59 aleluia-Inspiron-5548 systemd[1]: Stopping LSB: Starts


(Mark Walkom) #2

What do the Elasticsearch logs show?


(Kilmer Luiz Aleluia) #3

@warkolm
The /var/log/elasticsearch/ folder is empty. If I run journalctl -u elasticsearch, I only get a bunch of started and stopping, but any error or exception:

dez 23 12:31:11 aleluia-Inspiron-5548 systemd[1]: Starting LSB: Starts elasticsearch...
dez 23 12:31:11 aleluia-Inspiron-5548 elasticsearch[1449]:  * Starting Elasticsearch Server
dez 23 12:31:11 aleluia-Inspiron-5548 elasticsearch[1449]:    ...done.
dez 23 12:31:11 aleluia-Inspiron-5548 systemd[1]: Started LSB: Starts elasticsearch.
dez 23 12:58:42 aleluia-Inspiron-5548 systemd[1]: Stopping LSB: Starts elasticsearch...
dez 23 12:58:42 aleluia-Inspiron-5548 elasticsearch[7235]:  * Stopping Elasticsearch Server

If you want, I can paste all log from journalctl -u elasticsearch.


(Pjanzen) #4

This happend to me once, I was using the wrong java version.

What version of Elasticsearch and Java are you using?


(Kilmer Luiz Aleluia) #5

Java version: 1.8

openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.17.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

Elasticsearch version: 2.3.1


(Pjanzen) #6

Elasticsearch 2.x does not run with java 8, try installing Elasticsearch 5 or higher.

Or install java 6 for that version of Elasticsearch.


(Kilmer Luiz Aleluia) #7

Thank you so much! That really was the problem. I updated to ES 6.1.1 and it worked.


(system) #8

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.