1、
测试服务器:
3.189
1、
安装依赖:
yum -y install vim bash-c* net-tools lrzsz wget unzip gcc gcc-c++ epel-release tree
安装jdk环境:
yum -y install java-openjdk java-1.8.0-openjdk-devel
2、
安装ELK:
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.8.1-x86_64.rpm
wget https://artifacts.elastic.co/downloads/kibana/kibana-7.8.1-x86_64.rpm
wget https://artifacts.elastic.co/downloads/logstash/logstash-7.8.1.rpm
安装:
yum install elasticsearch-7.8.1-x86_64.rpm kibana-7.8.1-x86_64.rpm logstash-7.8.1.rpm -y
或者:
rpm -ivh elasticsearch-7.8.1-x86_64.rpm kibana-7.8.1-x86_64.rpm logstash-7.8.1.rpm
加入systemd管理,使其开机自启:
systemctl daemon-reload
systemctl enable elasticsearch.service
systemctl enable kibana.service
systemctl enable logstash.service
3、
修改es的配置文件:
vim /etc/elasticsearch/elasticsearch.yml
cluster.name:elastiflow
node.name:elastiflow
path.data:/var/lib/elasticsearch
path.logs:/var/log/elasticsearch
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: ["192.168.3.189"] #最后这两行不添加,虽然ES能起来,但是会有报错,导致Kibana打不开
cluster.initial_master_nodes: ["192.168.3.189"]
注:注意冒号之后要有空格。
4、
修改es的jvm配置(根据实际环境进行调整):
vim /etc/elasticsearch/jvm.options
-Xms4g
-Xmx4g
5、
修改logstash的jvm配置(根据实际环境进行调整):
vim /etc/logstash/jvm.options
-Xms4g
-Xmx4g
6、
修改kibana的配置文件:
vim /etc/kibana/kibana.yml
server.host: "0.0.0.0"
elasticsearch.hosts: ["http://localhost:9200"]
i18n.locale: "zh-CN" # 前端页面默认是英文,可以不改
注:注意冒号之后要有空格。
7、
启动服务(按顺序启动)
systemctl restart elasticsearch.service
systemctl status elasticsearch.service
systemctl restart kibana.service
systemctl status kibana.service
8、
logstash模块安装:
/usr/share/logstash/bin/logstash-plugin install logstash-codec