Failed to connect to localhost port 9200: Connection refused,----elasticsearch SETUP

oot@ubuntu1804:/usr/local/elasticsearch-7.6.1# /etc/init.d/elasticsearch start
No passwd entry for user 'elsearch'
elasticsearch is started
root@ubuntu1804:/usr/local/elasticsearch-7.6.1# /usr/local/elasticsearch-7.6.1
bash: /usr/local/elasticsearch-7.6.1: Is a directory
root@ubuntu1804:/usr/local/elasticsearch-7.6.1# curl -XGET http://localhost:9200
curl: (7) Failed to connect to localhost port 9200: Connection refused
root@ubuntu1804:/usr/local/elasticsearch-7.6.1# /etc/init.d/elasticsearch start
No passwd entry for user 'elsearch'
elasticsearch is started
root@ubuntu1804:/usr/local/elasticsearch-7.6.1/config# curl -XGET http://localhost:9200
curl: (7) Failed to connect to localhost port 9200: Connection refused

/usr/local/elasticsearch-7.6.1/config/elasticsearch.yml

------------------------------------ Node ------------------------------------

Use a descriptive name for the node:

#node.name: node-1#自己的节点主机名
node.name: elasticsearch

#node.attr.rack: r1

----------------------------------- Paths ------------------------------------

Path to directory where to store the data (separate multiple locations by comma):

path.data: /var/lib/elasticsearch

Path to log files:

path.logs: /var/log/elasticsearch

----------------------------------- Memory -----------------------------------

Lock the memory on startup:

#bootstrap.memory_lock: true

Make sure that the heap size is set to about half the memory available

on the system and that the owner of the process is allowed to use this

limit.

Elasticsearch performs poorly when the system is swapping the memory.

---------------------------------- Network -----------------------------------

Set the bind address to a specific IP (IPv4 or IPv6):

network.host:127.0.0.1

Set a custom port for HTTP:

http.port: 9200

For more information, consult the network module documentation.

When I started elasticsearch,these two folder have not generated. I do not known why.
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch

No passwd entry for user 'elsearch'

The above error message looks suspicious. Have you manually edit the /etc/init.d/elasticsearch file?

You could also check whether there are any error messages from systemd with
journalctl -u elasticsearch -b

1 Like

Welcome!

Please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

This is the icon to use if you are not using markdown format:

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.
Please update your post.

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