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 &
本作品採用《CC 協議》,轉載必須註明作者和本文連結
:kissing_closed_eyes:
我愛小硯 乀(ˉεˉ乀)