elasticsearch6.2和logstash啟動出現的錯誤
elasticsearch6.2啟動失敗,出現如下提示:
1、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/elasticsearch/hs_err_pid1675.log
由於elasticsearch6.2預設分配jvm空間大小為1g,我的阿里雲伺服器記憶體不夠大,修改jvm空間分配
[python] view plain copy- # vim config/jvm.options
- -Xms1g
- -Xmx1g
- 修改為
- -Xms512m
- -Xmx512m
經過檢視網友的經驗,elasticesearch已經正常啟動。
但隨後logstash啟動又提示Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c5330000, 986513408, 0) failed; error='Cannot allocate memory' (errno=12)
有反覆搜尋,按照往上的幾種說法已經都改過了,伺服器也重啟了幾遍,差點就放棄了,然後就去加記憶體,後來又想elasticsearch都啟動正常了,為什麼logstash報elasticsearch的提示了,就想到了,logstash應該也有個這樣的控制檔案,來控制啟動記憶體和資料互動時的最大記憶體。
結果找到了,是logstash/conf/jvm.options
同樣是修改裡面的-Xmx 和-Xms的數值
下面是幾個常見錯誤,也是網友總結的,與大家分享。
2、max number of threads [1024] for user [elasticsearch] is too low, increase to at least [2048]修改 /etc/security/limits.d/90-nproc.conf
* soft nproc 1024
* soft nproc 2048
3、max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
修改/etc/sysctl.conf配置檔案,
cat /etc/sysctl.conf | grep vm.max_map_count
vm.max_map_count=262144
如果不存在則新增
echo "vm.max_map_count=262144" >>/etc/sysctl.conf
4、max file descriptors [65535] for elasticsearch process likely too low, increase to at least [65536]
ulimit -n 65536
以下是在5.5.1是踩過的坑
5、啟動異常:ERROR: bootstrap checks failed
system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
問題原因:因為Centos6不支援SecComp,而ES預設bootstrap.system_call_filter為true進行檢測,所以導致檢測失敗,失敗後直接導致ES不能啟動。詳見 :https://github.com/elastic/elasticsearch/issues/22899
解決方法:在elasticsearch.yml中配置bootstrap.system_call_filter為false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
6、logstash使用rpm包安裝的時候沒有配置init的啟動指令碼
預設情況使用rpm包安裝完logstash之後沒有啟動指令碼。官網給了一個指令碼,需要根據不同的系統版本生成對應的啟動指令碼,而且官網沒有給明使用方法,對於新使用者來說算是個坑,不過在終端可以檢視到指令碼的使用幫助# /usr/share/logstash/bin/system-install --help
生成啟動指令碼,centos6使用sysv引數,centos7使用systemd
# /usr/share/logstash/bin/system-install /etc/logstash/startup.options sysv
Successfully created systemstartup script for Logstash