官网下载:https://www.elastic.co/cn/downloads
1、前置条件:
java -version
java version "1.8.0_102"Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
2、tar -xvf elasticsearch-6.1.3.tar.gz
3、修改配置文件
vim /etc/elasticsearch/elasticsearch.yml
cluster.name: my-application
node.name: node-1
path.data: /elk/data
path.logs: /elk/logs
network.host: 0.0.0.0
http.port: 9200
4、启动bin目录下
./elasticsearch -d
5、报错异常处理方法
5.1、异常:java.lang.RuntimeException: can not run elasticsearch as root
处理办法:从5.0开始,ElasticSearch 安全级别提高了,不允许采用root帐号启动,所以我们要添加一个用户。
(1)创建es用户组[root@node1 ~]# groupadd es
(2)创建用户es
useradd es(用户名) -g es(组名) -p es(密码)
[root@node1 ~]# useradd es -g es -p es
(3)修改权限
更改elasticsearch-6.1.0文件夹以及内部文件的所属用户以及组为es,-R表示逐级(N层目录)
[root@node1 ~]# chown -R es:es /opt/elasticsearch-6.1.0
5.2、异常:[4] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max number of threads [1024] for user [es] is too low, increase to at least [4096]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
处理办法:
1)vi /etc/sysctl.conf
vm.max_map_count = 262144
fs.file-max = 655350
----生效:
sysctl -p
2) vi /etc/security/limits.conf
* hard nofile 65536
* soft nofile 65536
* soft nproc 4096
* hard nproc 4096
6、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
7、
启动报错2
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
max number of threads [1024] for user [hadoop] is too low, increase to at least [2048]
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
7.1、编辑limits.conf 文件
vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
7.2、vim /etc/security/limits.d/90-nproc.conf
找到如下内容:
soft nproc 1024
修改为
* soft nproc 4096
es soft nproc 4096
root soft nproc unlimited
7.3、vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并执行命令:
sysctl -p