其他分享
首页 > 其他分享> > EFK+告警

EFK+告警

作者:互联网

今天的目标:
1:EFK平台的搭建
2:利用EFK平台收集nginx日志
3:EFK平台添加告警功能

环境:centos7 mini
配置:2核心2G内存

192.168.1.7
jdk,zk,kafka,filebeat,es
192.168.1.8
jdk,zk,kafka,filebeat,logstash
192.168.1.9
jdk,zk,kafka,filebeat,kibana

1 初始化环境
时间同步:
yum -y install ntpdate
ntpdate pool.ntp.org
2 关闭防火墙
systemctl stop firewalld
setenforce 0

3 修改主机名
hostnamectl set-hostname kafka01
hostnamectl set-hostname kafka02
hostnamectl set-hostname kafka03

4 编辑hosts文件
192.168.1.7 kafka01
192.168.1.8 kafka02
192.168.1.9 kafka03

5 安装jdk
yum -y install jdk-8u131-linux-x64_.rpm
java -version

6 安装zookeeper
tar zxvf zookeeper-3.4.14.tar.gz
mv zookeeper-3.4.14 /usr/local/zookeeper

编辑zoo.conf
cd /usr/local/zookeeper/conf
mv zoo_sample.cfg zoo.cfg

vim zoo.cfg
2888:集群通信端口
3888:集群选举端口

server.1=192.168.1.7:2888:3888
server.2=192.168.1.8:2888:3888
server.3=192.168.1.9:2888:3888

创建data目录
mkdir -p /tmp/zookeeper

创建myid文件
kafka01上执行:echo “1” > /tmp/zookeeper/myid
kafka02上执行:echo “2” > /tmp/zookeeper/myid
kafka03上执行:echo “3” > /tmp/zookeeper/myid

7 启动zookeepr服务
/usr/local/zookeeper/bin/zkServer.sh start
查看服务状态
/usr/local/zookeeper/bin/zkServer.sh status
1个leader,2个follower

8: 安装kafka 消息中间件
tar zxvf kafka_2.11-2.2.0.tgz
mv kafka_2.11-2.2.0 /usr/local/kafka
修改kafka的主配置文件:
cd /usr/local/kafka/config
vim server.properties
[root@kafka01 config]# cat server.properties |grep -v “^#” |sed ‘/^$/d’|egrep “broker|advertised|zookeeper”
broker.id=0
advertised.listeners=PLAINTEXT://kafka01:9092
zookeeper.connect=192.168.1.7:2181,192.168.1.8:2181,192.168.1.9:2181

[root@kafka02 src]# cat /usr/local/kafka/config/server.properties|grep -v “^#” |sed ‘/^$/d’|egrep “broker|advertised|zookeeper”
broker.id=1
advertised.listeners=PLAINTEXT://kafka02:9092
zookeeper.connect=192.168.1.7:2181,192.168.1.8:2181,192.168.1.9:2181

[root@kafka03 src]# cat /usr/local/kafka/config/server.properties|grep -v “^#” |sed ‘/^$/d’|egrep “broker|advertised|zookeeper”
broker.id=2
advertised.listeners=PLAINTEXT://kafka03:9092
zookeeper.connect=192.168.1.7:2181,192.168.1.8:2181,192.168.1.9:2181

9:启动kafka服务
/usr/local/kafka/bin/kafka-server-start.sh -daemon /usr/local/kafka/config/server.properties
端口验证
[root@kafka01 config]# netstat -lptnu|grep 9092
tcp6 0 0 :::9092 ::

标签:filebeat,1.7,zookeeper,9092,kafka,EFK,192.168,告警
来源: https://blog.csdn.net/CuiXiaoY/article/details/110385063