ElasticSearch-安装以及常见错误(自己测试过yum install -y log4j* )
ElasticSearch安裝常見錯誤?
[root@node2?~]#?yum?install??-y?*jdk???安裝java環境 [root@node2?~]#?cd?/usr/local/src/ [root@node2?src]#?wget?https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.3.tar.gz?##官網下載5.6以上的版本
[root@node2?~]#?java?-version??###查看java版本 openjdk?version?"1.8.0_151" OpenJDK?Runtime?Environment?(build?1.8.0_151-b12) OpenJDK?64-Bit?Server?VM?(build?25.151-b12,?mixed?mode)??###可以看到已經安裝java的最新版本了。##解壓安裝?ElasticSearch
[root@node2?src]#?tar?-xf?elasticsearch-5.6.3.tar.gz???##解壓 [root@node2?src]#?cd?elasticsearch-5.6.3 [root@node2?elasticsearch-5.6.3]#?ls bin??config??lib??LICENSE.txt??modules??NOTICE.txt??plugins??README.textile [root@node2?elasticsearch-5.6.3]#?vim?config/ elasticsearch.yml??jvm.options????????log4j2.properties?? [root@node2?elasticsearch-5.6.3]#?vim?config/elasticsearch.yml??###修改下面兩項 network.host:?172.25.0.30????###為本地ip,監聽主機 discovery.zen.minimum_master_nodes:?1???###我這里只有一臺,所以修改為1接下來我們啟動看看
錯誤一:
我們會發現啟動錯誤。會彈出下面的報錯,抱錯如下圖:
主要原因是已經有提示了:Caused by: java.lang.RuntimeException: can not run elasticsearch as root,說是不能在root用戶下運行,接下來我們換個用戶來運行。
[root@node2?bin]#?useradd?dashuju [root@node2?bin]#?su?-?dashuju [dashuju@node2?~]$?cd?/usr/local/src/elasticsearch-5.6.3/錯誤二:
啟動后我們發現了錯誤
[dashuju@node2?bin]$?./elasticsearch Exception?in?thread?"main"?2017-11-12?12:17:55,776?main?ERROR?No?log4j2?configuration?file?found.?Using?default?configuration:?logging?only?errors?to?the?console.?Set?system?property?‘log4j2.debug‘?to?show?Log4j2?internal?initialization?logging. 2017-11-12?12:17:56,319?main?ERROR?Could?not?register?mbeans?java.security.AccessControlException:?access?denied?("javax.management.MBeanTrustPermission"?"register")這也是根據問題原因去解決,解決方法如下:
[root@node2?~]#?yum?install?-y?log4j*????###安裝log4j包 [root@node2?~]#?chown?dashuju:dashuju?-R??/usr/local/src/elasticsearch-5.6.3??###給予elasticsearch權限錯誤三:
繼續啟動:
[dashuju@node2?bin]$?./elasticsearch ERROR:?[2]?bootstrap?checks?failed???##還有錯誤,這個是要改文件數,這個因為太多我就不放圖了。 [1]:?max?file?descriptors?[4096]?for?elasticsearch?process?is?too?low,?increase?to?at?least?[65536] [2]:?max?virtual?memory?areas?vm.max_map_count?[65530]?is?too?low,?increase?to?at?least?[262144]我們改一下限制的文件數就可以了
[root@node1?src]#?cat?/etc/sysctl.conf? vm.max_map_count=655360 [root@node2?src]#?cat?/etc/security/limits.conf? *?soft?nofile?65536 *?hard?nofile?131072 *?soft?nproc?2048 *?hard?nproc?4096 [root@node2?~]#?sysctl?-p vm.max_map_count?=?655360注:###最好重啟一下,然后執行一遍
[dashuju@node2?bin]$?./elasticsearch???? [root@node2?~]#?netstat?-ntpl???###查看一下服務,可以看到elasticsearch已經起來了,端口9200和9300 Active?Internet?connections?(only?servers) Proto?Recv-Q?Send-Q?Local?Address???????????Foreign?Address?????????State???????PID/Program?name???? tcp????????0??????0?0.0.0.0:111?????????????0.0.0.0:*???????????????LISTEN??????1/systemd??????????? tcp????????0??????0?0.0.0.0:22??????????????0.0.0.0:*???????????????LISTEN??????1178/sshd??????????? tcp????????0??????0?0.0.0.0:873?????????????0.0.0.0:*???????????????LISTEN??????847/rsync??????????? tcp6???????0??????0?:::111??????????????????:::*????????????????????LISTEN??????1/systemd??????????? tcp6???????0??????0?172.25.0.30:9200????????:::*????????????????????LISTEN??????1650/java??????????? tcp6???????0??????0?:::2224?????????????????:::*????????????????????LISTEN??????866/ruby???????????? tcp6???????0??????0?172.25.0.30:9300????????:::*????????????????????LISTEN??????1650/java??????????? tcp6???????0??????0?:::22???????????????????:::*????????????????????LISTEN??????1178/sshd??????????? tcp6???????0??????0?:::873??????????????????:::*????????????????????LISTEN??????847/rsync??????????? tcp6???????0??????0?:::3306?????????????????:::*????????????????????LISTEN??????1436/mysqld再訪問以下我們9200端口,也已經成功了,可以看到elasticsearch的信息了。?? ? ? ?
[root@node2?~]#?curl?172.25.0.30:9200 {"name"?:?"XjOLC6R","cluster_name"?:?"elasticsearch","cluster_uuid"?:?"45286kMyRMqEsjgH04lQCg","version"?:?{"number"?:?"5.6.3","build_hash"?:?"1a2f265","build_date"?:?"2017-10-06T20:33:39.012Z","build_snapshot"?:?false,"lucene_version"?:?"6.6.1"},"tagline"?:?"You?Know,?for?Search" }?
問題一:警告提示
[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版本,就不會出現此類問題了。
?
?
問題一:警告提示
[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版本,就不會出現此類問題了。
?
問題二: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 2048
* hard nproc 4096
?
問題三: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 2048
?
問題四: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
?
問題五:
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
切換到es的用戶。
?
然后,重新啟動elasticsearch,即可啟動成功。
六、后臺運行
最后還有一個小問題,如果你在服務器上安裝Elasticsearch,而你想在本地機器上進行開發,這時候,你很可能需要在關閉終端的時候,讓Elasticsearch繼續保持運行。最簡單的方法就是使用nohup。先按Ctrl + C,停止當前運行的Elasticsearch,改用下面的命令運行Elasticsearch
nohup./bin/elasticsearch&
這樣,你就可以放心地關閉服務器終端,而不用擔心Elasticsearch也跟著關閉了。
?
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
解決:
在elasticsearch.yml中配置bootstrap.system_call_filter為false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
?
業務驅動技術,技術是手段,業務是目的。
?
個人總結:elasticsearch的安裝使用并不難,我們在使用是只要是注意它啟用時,所提示的錯誤,然后針對性的解決就可以。以上是我在安裝使用elasticsearch所遇到問題,希望能幫到大家。
來源:https://blog.csdn.net/qq_15175765/article/details/78862797
總結
以上是生活随笔為你收集整理的ElasticSearch-安装以及常见错误(自己测试过yum install -y log4j* )的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 张姓女孩缺水起名(起名有讲究!米兰少女的
- 下一篇: 使用VMware安装CentOS7详请(