ERROR: [1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解決:
在宿主機執行:
sysctl -w vm.max_map_count=262144
原因:
vm.max_map_count
參數,是允許一個進程在VMAs擁有最大數量(VMA:虛擬內存地址, 一個連續的虛擬地址空間),當進程占用內存超過時, 直接OOM。
elasticsearch占用內存較高。官方要求max_map_count需要配置到最小262144。
問題
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c5330000, 986513408, 0) failed; error='Cannot allocate memory' (errno=12) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 986513408 bytes for committing reserved memory. # An error report file with more information is saved as: # /usr/local/software/temp/elasticsearch-6.2.2/hs_err_pid1912.log
解決:
內存不夠,購買阿里雲的機器可以動態增加內存,或者啟動時候現在內存為256M
問題:
[root@iZwz95j86y235aroi85ht0Z bin]# ./elasticsearch [2018-02-22T20:14:04,870][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main] org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~[elasticsearch-6.2.2.jar:6.2.2] at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) ~[elasticsearch-6.2.2.jar:6.2.2] at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.2.2.jar:6.2.2] at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.2.2.jar:6.2.2]
解決:
用非root用戶
添加用戶:useradd -m 用戶名 然后設置密碼 passwd 用戶名
問題:
./elasticsearch
Exception in thread "main" java.nio.file.AccessDeniedException: /usr/local/software/temp/elasticsearch-6.2.2/config/jvm.options
解決:
權限不夠 chmod 777 -R 當前es目錄
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
解決方案
[root@centos7 sonarqube-7.2.1]# vi /etc/security/limits.conf pangkunkun1 hard nofile 65536 pangkunkun1 soft nofile 65536
這里的pangkunkun1為上面創建的用來啟動sonar的用戶,修改好之后要切換到pangkunkun1這個用戶之后才能生效。
使用ulimit -Hn指令查看配置是否生效:
[pangkunkun1@centos7 sonarqube-7.2.1]$ ulimit -Hn
65536