使用IP無法連接本地虛擬機上的elasticsearch:curl: (7) Failed connect to 192.168.xxx.xxx:9200 Connection refused

1.問題

我在本地,通過VM安裝Centos之後。安裝es正常啓動後,通過在虛擬機控制檯輸入

curl 'http://127.0.0.1:9200/?pretty/'

可以正常訪問es!

但是,我在本地機器上Window系統訪問,通過虛擬機的IP訪問,卻提示:

curl: (7) Failed connect to 192.168.xxx.xxx:9200; Connection refused

 

2.解決

原因是需要修改es的配置文件,es文件目錄/config/elasticsearch.yml,修改如圖地方。將註釋掉的network.host 改爲自己虛擬機的IP地址。如圖:

如此,再啓動便可以訪問了!我在本地window再通過head插件訪問,便可以了!

(head插件下載地址:https://download.csdn.net/download/yy339452689/12492563

3.elasticsearch啓動異常插曲

我在上述設置完成之後,重新啓動es,其實並沒有啓動成功。通過控制檯啓動es,報如下錯誤:

ERROR: [3] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]

[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

[5]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

報錯問題可參考:https://blog.csdn.net/happyzxs/article/details/89156068

我使用上述鏈接完美解決!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章