Elasticsearch5.0 安装问题集锦

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Elasticsearch5.0 安装问题集锦相关的知识,希望对你有一定的参考价值。

使用Elasticsearch5.0 必须安装jdk1.8

[[email protected] bin]$ java -version
java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)
[[email protected]-mysteel-dc-search01 bin]$ 

使用root账号启动es后 会遇到以下问题

技术分享

[2016-11-14T10:05:29,358][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread 
[main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:116) ~[elasticsearch- 
5.0.0.jar:5.0.0]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:103) ~[elasticsearch- 
5.0.0.jar:5.0.0]
at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54) ~[elasticsearch- 
5.0.0.jar:5.0.0]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96) ~[elasticsearch- 
5.0.0.jar:5.0.0]
at org.elasticsearch.cli.Command.main(Command.java:62) ~[elasticsearch-5.0.0.jar:5.0.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) ~[elasticsearch- 
5.0.0.jar:5.0.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73) ~[elasticsearch- 
5.0.0.jar:5.0.0] 

解决方案:

因为安全问题elasticsearch 不让用root用户直接运行,所以要创建新用户

  • 建议创建一个单独的用户用来运行ElasticSearch

  • 创建elsearch用户组及elsearch用户

groupadd elsearch
useradd elsearch -g elsearch -p elasticsearch

使用elsearch启动ES后 又会遇到以下问题

技术分享

ERROR: bootstrap checks failed
max file descriptors [10240] for elasticsearch process likely too low, increase to at least [65536]
max number of threads [1024] for user [elsearch] likely too low, increase to at least [2048]
max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
[2016-11-14T10:22:17,569][INFO ][o.e.n.Node               ] [mysteel-node1] stopping ...
[2016-11-14T10:22:17,615][INFO ][o.e.n.Node               ] [mysteel-node1] stopped
[2016-11-14T10:22:17,615][INFO ][o.e.n.Node               ] [mysteel-node1] closing ...
[2016-11-14T10:22:17,638][INFO ][o.e.n.Node               ] [mysteel-node1] closed

解决方法参考 :http://www.cnblogs.com/sloveling/p/elasticsearch.html

切换到root用户

vi /etc/security/limits.conf

添加如下内容:

* soft nofile 65536

* hard nofile 131072

* soft nproc 2048

* hard nproc 4096


vi /etc/security/limits.d/90-nproc.conf

修改如下内容:

* soft nproc 1024

#修改为

* soft nproc 2048

 

vi /etc/sysctl.conf 

添加下面配置:

vm.max_map_count=655360
并执行命令:

sysctl -p
然后,重新启动elasticsearch,即可启动成功。

技术分享


以上是关于Elasticsearch5.0 安装问题集锦的主要内容,如果未能解决你的问题,请参考以下文章

Elasticsearch5.0 安装问题集锦

Elasticsearch5.0 安装问题集锦

Elasticsearch5.0 安装问题集锦

ELK(elasticsearch5.0)head插件安装配置

Linux下安装Elasticsearch5.0

Elasticsearch5.0.1安装