系統、軟件環境:java
Centos 6.5linux
elasticsearch 6.1.1shell
elasticsearch 安裝的話是很簡單的,可是安裝完成啓動的時候報錯,下面我就一一的來描述錯誤,並提供相應的解決方法.bootstrap
一、安裝服務器
官網下載安裝包app
https://www.elastic.co/downloads/elasticsearchelasticsearch
而後解壓測試
tar -zxvf elasticsearch-6.1.1.tar.gz -C /opt/modules/ui
安裝就至此完成了spa
二、而後啓動
cd /opt/modules/elasticsearch-6.1.1
bin/elasticsearch &
可是沒有啓動成功,大體遇到的問題以下:
三、遇到的問題
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
五、而後再次啓動(後臺啓動),就能夠了
bin/elasticsearch &
能夠看到已經啓動成功。
六、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 的安裝說明就到這裏了。