1.获取所需安装包并安装
安装时先安装jdk包,不然可能会出错。
[root@server1 ~]# ls
elasticsearch-6.6.1.rpm jdk-8u121-linux-x64.rpm
[root@server1 ~]# yum -y install jdk-8u121-linux-x64.rpm
[root@server1 ~]# yum -y install elasticsearch-6.6.1.rpm
2.在/etc/elasticsearch/编辑elk的配置文件
[root@server1 ~]# cd /etc/elasticsearch/
[root@server1 elasticsearch]# vim elasticsearch.yml
17 cluster.name: my-es
23 node.name: server1
43 bootstrap.memory_lock: true
55 network.host: 172.25.32.1
59 http.port: 9200
3.更改系统默认文件数
[root@server1 elasticsearch]# vim /etc/security/limits.conf
elasticsearch - nofile 65536
4.添加服务脚本中的内存锁定
[root@server1 elasticsearch]# vim /usr/lib/systemd/system/elasticsearch.service
33 LimitMEMLOCK=infinity
[root@server1 elasticsearch]# systemctl daemon-reload
5.关闭swap分区
[root@server1 elasticsearch]# swapoff -a
[root@server1 elasticsearch]# vim /etc/fstab
6.设置进程限制
[root@server1 elasticsearch]# sysctl -a | grep vm.max_map_count
vm.max_map_count = 262144
[root@server1 elasticsearch]# vim /etc/security/limits.conf
elasticsearch - nproc 4096
7.设定内存锁定
[root@server1 elasticsearch]# vim /etc/security/limits.conf
elasticsearch - memlock unlimited
8.在上面的设置都完成之后开启服务才会出现端口9200,否则开启服务即使不报错但是也不会出现端口,可以在相应的elk的日志文件的目录下查看开启日志来排错(给机器分配2g内存,不然服务正常启动后可能不会出现端口)
- 网页查看
错误
[root@server1 elasticsearch]# pwd
/var/log/elasticsearch
[root@server1 elasticsearch]# vim hs_err_pid1404.log
解决方法:
将内存阔为2g