一、问题
elasticsearch启动时遇到的错误
原因
elasticsearch用户拥有的内存权限太小,至少需要262144
问题详情
2021.02.05 08:07:01 WARN es[][o.e.d.c.s.Settings] [http.enabled] setting was deprecated in Elasticsearch and will be removed in a future release! See the breaking changes documentation for the next major version.
2021.02.05 08:07:02 INFO es[][o.e.d.DiscoveryModule] using discovery type [zen] and host providers [settings]
2021.02.05 08:07:02 INFO es[][o.e.n.Node] initialized
2021.02.05 08:07:02 INFO es[][o.e.n.Node] starting ...
ERROR: [1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
2021.02.05 08:07:02 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 78
2021.02.05 08:07:02 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped
2021.02.05 08:07:02 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
二、解决办法
临时
下面方法只是起到临时修改作用,重启虚拟机将失效
sudo sysctl -w vm.max_map_count=262144
查看结果
sysctl -a|grep vm.max_map_count
显示
vm.max_map_count = 262144
永久
编辑/etc/sysctl.conf文件,在最后添加一行
#sudo vim /etc/sysctl.conf
vm.max_map_count=262144
即可永久修改