images\cherry_red.png1 ELK日志分析系统
      images\cherry_blue.png1.1 ELK系统部署
         images\cherry_orange.png1.1.1 ELK端配置
            images\cherry_cyan.png1.1.1.1 Elasticsearch
            images\cherry_cyan.png1.1.1.2 Kibana
            images\cherry_cyan.png1.1.1.3 Filebeat
      images\cherry_blue.png1.2 ELK优化
         images\cherry_orange.png1.2.1 es-head插件安装
         images\cherry_orange.png1.2.2 安装filebeat nginx 日志模板
Elasticsearch Kibana filebeat 是在JAVA环境,因此需要JDK运行环境

1,
此时安装的是 JDK1.8
images\4-1.png


JAVA_HOME=【JDK路径】
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH



2,
配置完成之后安装Elasticsearch
tar -zxvf ...tar.gz
images\4-2.png

images\4-3.png


3,
配置elasticsearch配置文件 elasticsearch.yml
vim config/elasticsearch.yml
修改一下几处地方
images\4-4.png


4,
elasticsearch默认不能用root用户启动,因此创建一个普通用户elk用于启动elasticsearch
# useradd elk
# echo "123456" | passwd --stdin elk
# chown -R elk:elk /usr/local/elasticsearch-6.2.3/
# su - elk


启动elasticsearch
在elasticsearch 目录下启动
[elk@elk elasticsearch-6.2.3]$ ./bin/elasticsearch -d

启动过程 或 报错可以查看日志
[elk@elk elasticsearch-6.2.3]$ cat logs/elasticsearch.log

[2021-07-04T20:48:07,491][ERROR][o.e.b.Bootstrap ] [elk] node validation exception
[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@elk ~]# tail -10 /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
root soft nproc unlimited
root hard nproc unlimited


修改系统控制文件,修改允许elasticsearch开辟655300字节以上的内存空间
[root@elk ~]# vi /etc/sysctl.conf
vm.max_map_count=655300

[root@elk ~]# sysctl -p ----执行立即生效
vm.max_map_count = 655300


再次重启elasticsearch
[elk@elk elasticsearch-6.2.3]$ ./bin/elasticsearch -d
[elk@elk elasticsearch-6.2.3]$ cat logs/elasticsearch.log
[elk@elk elasticsearch-6.2.3]$ tail logs/elasticsearch.log

ELK端 访问测试 9200 端口
images\4-5.png


OK Elasticsearch 安装成功 !