系統、軟件環境:
Centos 6.5
elasticsearch 6.1.1
elasticsearch 安裝的話是很簡單的,但是安裝完成啟動的時候報錯,下面我就一一的來描述錯誤,並提供相應的解決方法.
1、安裝
官網下載安裝包
https://www.elastic.co/downloads/elasticsearch
然后解壓
tar -zxvf elasticsearch-6.1.1.tar.gz -C /opt/modules/
安裝就至此完成了
2、然后啟動
cd /opt/modules/elasticsearch-6.1.1
bin/elasticsearch &
但是沒有啟動成功,大致遇到的問題如下:
3、遇到的問題
3.1:警告提示
[2016-11-06T16:27:21,712][WARN ][o.e.b.JNANatives ] unable to install syscall filter:
java.lang.UnsupportedOperationException: seccomp unavailable: requires kernel 3.5+ with CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER compiled in
at org.elasticsearch.bootstrap.Seccomp.linuxImpl(Seccomp.java:349) ~[elasticsearch-5.0.0.jar:5.0.0]
at org.elasticsearch.bootstrap.Seccomp.init(Seccomp.java:630) ~[elasticsearch-5.0.0.jar:5.0.0]
報了一大串錯誤,其實只是一個警告。
解決:使用新的linux版本,就不會出現此類問題了。
3.2:ERROR: bootstrap checks failed
max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
max number of threads [1024] for user [lishang] likely too low, increase to at least [2048]
解決:切換到root用戶,編輯limits.conf 添加類似如下內容
vi /etc/security/limits.conf
添加如下內容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 4096
* hard nproc 4096
3.3:max number of threads [1024] for user [lish] likely too low, increase to at least [2048]
解決:切換到root用戶,進入limits.d目錄下修改配置文件。
vi /etc/security/limits.d/90-nproc.conf
修改如下內容:
* soft nproc 1024
#修改為
* soft nproc unlimited(正常情況下,最好不要這么改,因為我是測試環境,自己搭建的虛擬機,所以為了省事,就這樣寫了,按照報錯信息,修改為 4096就可以了)
4.4:max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
解決:切換到root用戶修改配置sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
並執行命令:
sysctl -p
4.5:max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
解決:修改切換到root用戶修改配置limits.conf 添加下面兩行
命令:vi /etc/security/limits.conf
* hard nofile 65536
* soft nofile 65536
4.6 [2]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
修改 es 安裝目錄下 config/elasticsearch.yml 內容
添加如下的配置:
bootstrap.system_call_filter: false
5、然后再次啟動(后台啟動),就可以了
bin/elasticsearch &
可以看到已經啟動成功。
6、2018.02.02 在我們公司服務器安裝的時候又遇到了一個問題,在此也記錄一下吧
[2018-02-02T16:33:50,402][WARN ][o.e.b.JNANatives ] Unable to lock JVM Memory: error=12, reason=無法分配內存 [2018-02-02T16:33:50,404][WARN ][o.e.b.JNANatives ] This can result in part of the JVM being swapped out. [2018-02-02T16:33:50,404][WARN ][o.e.b.JNANatives ] Increase RLIMIT_MEMLOCK, soft limit: 65536, hard limit: 65536 [2018-02-02T16:33:50,404][WARN ][o.e.b.JNANatives ] These can be adjusted by modifying /etc/security/limits.conf, for example: # allow user 'es' mlockall es soft memlock unlimited es hard memlock unlimited
解決方案:
使用當前啟動 es 的用戶,我的啟動用戶就是 es,所以在 es 賬戶下執行如下的命令:
ulimit -H -l
unlimited
好了,今天 es 的安裝說明就到這里了。