修改 /config/elasticsearch.yml(我的安裝目錄是:/var/www/elasticsearch-6.4.2/elasticsearch-6.4.2),
network.host: 0.0.0.0
但修改后,es啟動失敗了(注意:elasticsearch
無法用 root 用戶啟動,請切換到普通用戶),
Native controller process has stopped - no new native processes can be started
解決辦法:
先切換到root賬戶下,
vim /etc/sysctl.conf
在尾部增加一句: vm.max_map_count=655360
保存后執行下命令:sysctl -p 這句一定要再root賬戶下完成
之后切換回到 我們自己的賬戶下,啟動es: ./bin/elasticsearch 或者加上 -d,(或者 nohup ./bin/elasticsearch&) 已守護線程方式啟動
查看進程是否啟動:
ps -ef|grep elasticsearch
關閉es和關閉他的線程方式一樣: kill -9 '進程號'即可。