kafka下载解压
wget -c https://archive.apache.org/dist/kafka/2.2.0/kafka_2.12-2.2.0.tgz
tar -zxf kafka_2.12-2.2.0.tgz
zk & kafka关键配置
- config/zookeeper.properties
dataDir=/app/kafka_2.12-2.2.0/zkData
clientPort=2181
listeners=PLAINTEXT://:9092
advertised.listeners=PLAINTEXT://10.10.10.49:9092
log.dirs=/app/kafka_2.12-2.2.0/kafka-logs-data
启动zk & kafka
./bin/zookeeper-server-start.sh -daemon config/zookeeper.properties
./bin/kafka-server-start.sh -daemon config/server.properties
kafka 生产消费测试
./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic ceshi
>nihao
./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic ceshi --from-beginning
nihao
filebeat下载解压
wget -c https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.5.1-linux-x86_64.tar.gz
filebeat关键配置
filebeat.inputs:
- type: log
enabled: true
tail_files: true
paths:
- /usr/local/nginx/logs/access.log
output.kafka:
enabled: true
hosts: ["10.10.10.49:9092"]
topic: "accesslog"
protocol: "http"
filebeat重启脚本
#!/bin/bash
kill -9 $(ps -ef |grep filebeat.yml|grep -v grep |awk '{print $2}')
rm -rf logs/filebeat.log
nohup ./filebeat -e -c filebeat.yml > logs/filebeat.log &