# Connecting Elasticsearch in Ubuntu 17.04

**URL:** <https://discuss.elastic.co/t/connecting-elasticsearch-in-ubuntu-17-04/113085>\
**Category:** Elasticsearch\
**Created:** [December 23, 2017, 6:18pm UTC](https://discuss.elastic.co/t/connecting-elasticsearch-in-ubuntu-17-04/113085 "2017-12-23T18:18:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kilmer\_Luiz\_Aleluia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kilmer_luiz_aleluia/32/25949_2.png) [@Kilmer\_Luiz\_Aleluia](https://discuss.elastic.co/u/Kilmer_Luiz_Aleluia)\
**Post date:** [December 23, 2017, 6:18pm UTC](https://discuss.elastic.co/t/connecting-elasticsearch-in-ubuntu-17-04/113085/1 "2017-12-23T18:18:22Z")

</div>

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:

```auto
● 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](https://discuss.elastic.co/t/cant-start-elasticsearch-with-ubuntu-16-04/48730/11). 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:

```auto
-- 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

```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 23, 2017, 6:48pm UTC](https://discuss.elastic.co/t/connecting-elasticsearch-in-ubuntu-17-04/113085/2 "2017-12-23T18:48:45Z")

</div>

What do the Elasticsearch logs show?

---

<div class="post-metadata">

**Author:** ![Kilmer\_Luiz\_Aleluia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kilmer_luiz_aleluia/32/25949_2.png) [@Kilmer\_Luiz\_Aleluia](https://discuss.elastic.co/u/Kilmer_Luiz_Aleluia)\
**Post date:** [December 23, 2017, 6:54pm UTC](https://discuss.elastic.co/t/connecting-elasticsearch-in-ubuntu-17-04/113085/3 "2017-12-23T18:54:25Z")

</div>

@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:

```auto
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`.

---

<div class="post-metadata">

**Author:** ![pjanzen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pjanzen/32/13756_2.png) [@pjanzen](https://discuss.elastic.co/u/pjanzen)\
**Post date:** [December 24, 2017, 10:20pm UTC](https://discuss.elastic.co/t/connecting-elasticsearch-in-ubuntu-17-04/113085/4 "2017-12-24T22:20:29Z")

</div>

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

What version of Elasticsearch and Java are you using?

---

<div class="post-metadata">

**Author:** ![Kilmer\_Luiz\_Aleluia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kilmer_luiz_aleluia/32/25949_2.png) [@Kilmer\_Luiz\_Aleluia](https://discuss.elastic.co/u/Kilmer_Luiz_Aleluia)\
**Post date:** [December 25, 2017, 2:45pm UTC](https://discuss.elastic.co/t/connecting-elasticsearch-in-ubuntu-17-04/113085/5 "2017-12-25T14:45:53Z")

</div>

Java version: 1.8

```auto
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

---

<div class="post-metadata">

**Author:** ![pjanzen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pjanzen/32/13756_2.png) [@pjanzen](https://discuss.elastic.co/u/pjanzen)\
**Post date:** [December 25, 2017, 10:56pm UTC](https://discuss.elastic.co/t/connecting-elasticsearch-in-ubuntu-17-04/113085/6 "2017-12-25T22:56:02Z")

</div>

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

Or install java 6 for that version of Elasticsearch.

---

<div class="post-metadata">

**Author:** ![Kilmer\_Luiz\_Aleluia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kilmer_luiz_aleluia/32/25949_2.png) [@Kilmer\_Luiz\_Aleluia](https://discuss.elastic.co/u/Kilmer_Luiz_Aleluia)\
**Post date:** [December 27, 2017, 8:58pm UTC](https://discuss.elastic.co/t/connecting-elasticsearch-in-ubuntu-17-04/113085/7 "2017-12-27T20:58:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 24, 2018, 8:58pm UTC](https://discuss.elastic.co/t/connecting-elasticsearch-in-ubuntu-17-04/113085/8 "2018-01-24T20:58:47Z")

</div>

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