无法连接到位于http://localhost:9200的Elasticsearch

fdx2calv  于 2022-11-22  发布在  ElasticSearch
关注(0)|答案(1)|浏览(233)

我尝试安装ELK(此资源https://www.howtoforge.com/tutorial/elasticsearch-and-kibana-installation-and-basic-usage-on-ubuntu-1604/),但当我打开Web浏览器并使用http://localhost:5601 URL测试它是否已正确安装时,我收到两个错误

我测试所有响应Elasticsearch: Failed to connect to localhost port 9200 - Connection refused,但没有工作,这是我的elasticsearch.yml

# ---------------------------------- Network -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 127.0.0.1:5601
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
#http.port: 9200
#
# For more information, consult the network module documentation.
#

当我运行sudo systemctl status elasticsearch时,我得到了失败的结果

● elasticsearch.service - Elasticsearch
     Loaded: loaded (/lib/systemd/system/elasticsearch.service; enabled; vendor>
     Active: failed (Result: exit-code) since Thu 2022-09-29 14:23:36 +0330; 4m>
       Docs: http://www.elastic.co
    Process: 69262 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-syst>
    Process: 69263 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PI>
   Main PID: 69263 (code=exited, status=1/FAILURE)

سپتامبر 29 14:23:33 samira-System-Product-Name systemd[1]: Starting Elasticsear>
سپتامبر 29 14:23:33 samira-System-Product-Name systemd[1]: Started Elasticsearc>
سپتامبر 29 14:23:33 samira-System-Product-Name elasticsearch[69263]: OpenJDK 64>
سپتامبر 29 14:23:36 samira-System-Product-Name systemd[1]: elasticsearch.servic>
سپتامبر 29 14:23:36 samira-System-Product-Name systemd[1]: elasticsearch.servic>

[1]+  Stopped                 sudo systemctl status elasticsearch

这是我的日志

我如何解决这个问题?

jfgube3f

jfgube3f1#

我可以看到你的elasticsearch.yml,并确定了一些更正,你可以尝试重新启动你的ElasticSearch示例。

  1. network.host:127.0.0.1----〉不需要端口号,最重要的是5601用于Kibana。
    1.ElasticSearch使用默认的http端口号9200如果您在一台机器上运行多个es示例(练习),您可以按升序定义http端口号,范围从9200到9299。

http.port:9200 ------〉你可以对单个示例进行注解/取消注解,无所谓。

相关问题