我只是按照这个指南通过 APT 安装 Elasticsearch: https://www.elastic.co/guide/en/elasticsearch/reference/5.0/deb.html
当我运行curl -X GET 'http://127.0.0.1:9200/'
(或本地主机)时收到一个错误:Failed to connect to 127.0.0.1 port 9200: Connection refused
在我的配置中,我使用:
network.bind_host: localhost
network.publish_host: 0.0.0.0
network.host: 0.0.0.0
http.port: 9200
我的日志/var/log/elasticsearch/
是空白的,但查看后sudo journalctl --unit elasticsearch
我看到:
Starting Elasticsearch...
Started Elasticsearch.
elasticsearch.service: Main process exited, code=killed, status=9/KILL
elasticsearch.service: Unit entered failed state.
elasticsearch.service: Failed with result 'signal'.
Starting Elasticsearch...
Started Elasticsearch.
elasticsearch.service: Main process exited, code=killed, status=9/KILL
elasticsearch.service: Unit entered failed state.
elasticsearch.service: Failed with result 'signal'.
Starting Elasticsearch...
Started Elasticsearch.
elasticsearch.service: Main process exited, code=killed, status=9/KILL
elasticsearch.service: Unit entered failed state.
elasticsearch.service: Failed with result 'signal'.
...
我如何才能查明此服务上线过程中遇到的阻碍?
答案1
撤消您的配置更改并且服务应该启动:
bind_host
默认为network.host
(在您的情况下为0.0.0.0
),但您强制为localhost
?(0.0.0.0!= localhost)network.host
- 出于安全原因,我不会设置为0.0.0.0
(默认值127.0.0.1
:)http.port
- 默认设置为 9200。