天天看點

elasticsearch 常見錯誤整理

啟動報錯①

Java HotSpot(TM) -Bit Server VM warning: INFO: os::commit_memory(, , ) failed; error='Cannot allocate memory' (errno=)
           

由于elasticsearch5.0預設配置設定jvm空間大小為2g,修改jvm空間配置設定

vi config/jvm.options  
           

将檔案中

-Xms2g  
-Xmx2g
           

修改為

-Xms512m  
-Xmx512m 
           

啟動報錯②

unable to install syscall filter: 
java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed
           

因為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
           

啟動報錯③

max file descriptors [] for elasticsearch process likely too low, increase to at least []
           

原因:無法建立本地檔案問題,使用者最大可建立檔案數太小

解決方法:切換到root使用者,編輯limits.conf配置檔案, 添加類似如下内容:

su root #切換到root使用者 需要輸入密碼
vi /etc/security/limits.conf
           

添加如下内容:

*  soft nofile 65536

* hard nofile 131072

* soft nproc 2048

* hard nproc 4096
           

啟動報錯④

max number of threads [] for user [lish] likely too low, increase to at least []
           

原因:無法建立本地線程問題,使用者最大可建立線程數太小

解決方法:

切換到root使用者,編輯limits.conf配置檔案, 添加類似如下内容

su root #切換到root使用者 需要輸入密碼
vi /etc/security/limits.d/-nproc.conf 
           

修改如下内容:

* soft nproc 1024
           

修改為

* soft nproc 2048
           

啟動時提示

main ERROR RollingFileManager (/usr/local/software/elasticsearch-/logs/elasticsearch.log) 
  java.io.FileNotFoundException: /usr/local/software/elasticsearch-/logs/elasticsearch.log 
  (Permission denied) java.io.FileNotFoundException: /usr/local/software/elasticsearch-/logs/elasticsearch.log (Permission  denied)
           

原因:這是權限不足的問題。

解決方法:切換到root 使用者 切換到elasticsearch安裝目錄 給elasticsearch使用者授權即可

[root@iZ2zeaj3xjio5q3atn7pgbZ elasticsearch-.]# chgrp -R elasticsearch . #變更elasticsearch 使用者組用操作目前檔案夾的權限(有點)
[root@iZ2zeaj3xjio5q3atn7pgbZ elasticsearch-.]# chown -R elasticsearch . #變更elastisearch 使用者有操作目前檔案夾的權限(有點)
           

繼續閱讀