欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Elasticsearch5.6.8 安装问题集锦

程序员文章站 2022-04-04 14:56:56
今天在内部linux环境安装Elasticsearch5.6.8时遇到一些问题,主要如下 使用Elasticsearch5.6.8 必须安装jdk1.8 使用root账号启动es后 会遇到以下问题 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 [2016-11-14T ......

今天在内部linux环境安装elasticsearch5.6.8时遇到一些问题,主要如下

使用elasticsearch5.6.8 必须安装jdk1.8

[elsearch@vm-mysteel-dc-search01 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)
[elsearch@vm-mysteel-dc-search01 bin]$ 

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

Elasticsearch5.6.8 安装问题集锦

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[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后 又会遇到以下问题

Elasticsearch5.6.8 安装问题集锦

Elasticsearch5.6.8 安装问题集锦
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
Elasticsearch5.6.8 安装问题集锦

解决方法参考 :

切换到root用户

vi /etc/security/limits.conf

添加如下内容:

Elasticsearch5.6.8 安装问题集锦
* soft nofile 65536

* hard nofile 131072

* soft nproc 2048

* hard nproc 4096
Elasticsearch5.6.8 安装问题集锦


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

Elasticsearch5.6.8 安装问题集锦
修改如下内容:

* soft nproc 1024

#修改为

* soft nproc 2048
Elasticsearch5.6.8 安装问题集锦

 

vi /etc/sysctl.conf 

添加下面配置:

vm.max_map_count=655360
并执行命令:

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

Elasticsearch5.6.8 安装问题集锦