ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
ERROR: Elasticsearch did not exit normally - check the logs at /data/xulianming/elasticsearch-8.2.0/logs/my-application.log
[2024-11-01T17:34:34,979][INFO ][o.e.n.Node ] [node-1] stopping ...
[2024-11-01T17:34:35,012][INFO ][o.e.n.Node ] [node-1] stopped
[2024-11-01T17:34:35,012][INFO ][o.e.n.Node ] [node-1] closing ...
[2024-11-01T17:34:35,017][INFO ][o.e.n.Node ] [node-1] closed
[2024-11-01T17:34:35,018][INFO ][o.e.x.m.p.NativeController] [node-1] Native controller process has stopped - no new native processes can be started
愿我们终有重逢之时,而你还记得我们曾经讨论的话题。
Q group 868373192
Q second group 277356808
从错误信息来看,Elasticsearch 启动失败的原因是 vm.max_map_count
的值太低。vm.max_map_count
是一个系统参数,用于限制进程可以拥有的最大内存映射区域数量。Elasticsearch 需要至少 262144
的值才能正常运行。
解决步骤
-
临时设置
vm.max_map_count
:
你可以临时设置vm.max_map_count
的值,以便立即启动 Elasticsearch。这个设置在系统重启后会失效。sudo sysctl -w vm.max_map_count=262144
-
永久设置
vm.max_map_count
:
为了使设置在系统重启后仍然有效,你需要编辑/etc/sysctl.conf
文件,并添加以下内容:vm.max_map_count=262144
然后运行以下命令使更改生效:
sudo sysctl -p
详细步骤
-
临时设置
vm.max_map_count
:
使用以下命令临时设置vm.max_map_count
的值:sudo sysctl -w vm.max_map_count=262144
-
永久设置
vm.max_map_count
:
编辑/etc/sysctl.conf
文件并添加以下内容:echo "vm.max_map_count=262144" | sudo tee -a /etc/sysctl.conf
然后运行以下命令使更改生效:
sudo sysctl -p
-
启动 Elasticsearch:
确保你已经切换到elasticsearch
用户,然后启动 Elasticsearch:su - elasticsearch cd /path/to/elasticsearch-8.2.0 ./bin/elasticsearch
其他注意事项
-
检查其他系统限制:
确保系统的其他资源限制(如文件描述符、虚拟内存等)足够高。你可以编辑/etc/security/limits.conf
文件来设置这些限制:elasticsearch soft nofile 65536 elasticsearch hard nofile 65536 elasticsearch soft memlock unlimited elasticsearch hard memlock unlimited
-
检查日志文件:
如果问题仍然存在,请查看 Elasticsearch 的日志文件以获取更多详细信息。日志文件通常位于logs
目录下,文件名为my-application.log
或类似名称。
总结
通过临时或永久设置 vm.max_map_count
的值,你应该能够解决 vm.max_map_count
太低的问题。确保系统的其他资源限制也足够高,并查看详细的日志文件以获取更多信息