kafka安裝設定相關
阿新 • • 發佈:2020-11-20
kafka
#!/bin/bash
basepath=$(cd `dirname $0`; pwd)
#echo $basepath #當前檔案所在路徑
cd $basepath
#修改zookeeper和server配置
# vi ./config/zookeeper.properties 修改日誌路徑為dataDir=/home/logs/zookeeper
# vi ./config/server.properties 修改日誌路徑為log.dirs=/home/logs/kafka-logs
#啟動zookeeoer和kafka-server
nohup ./bin/zookeeper-server-start.sh ./config/zookeeper.properties &
nohup bin/kafka-server-start.sh config/server.properties &
#檢視服務是否啟動成功
#lsof -i:2181 (zookeeper埠)
#lsof -i:9092 (kafka-server埠)
#建立topic(topic名稱: face)
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic face
#刪除topic (topic名稱: face)
#bin /kafka-topics.sh --delete --zookeeper localhost:2181 --topic face
#檢視topic列表:
#bin/kafka-topics.sh -zookeeper localhost:2181 --list
#檢視topic詳情:
#bin/kafka-topics.sh --zookeeper localhost:2181 --describe
#向建立的topic生產訊息
#bin/kafka-console-producer.sh --broker-list localhost:9092 --topic face
#訂閱topic 消費訊息
#bin /kafka-console-consumer.sh --zookeeper localhost:2181 --topic face --from-beginning
#bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic face
#建立9個topic,每個topic分割槽設為16
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 16 --topic Topic_Log_Heartbeat
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 16 --topic Topic_Face_Img
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 16 --topic Topic_Comp_Result
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 16 --topic Topic_Comp_Request_Real
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 16 --topic Topic_Feature_Extraction_Result
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 16 --topic Topic_Setting_Change
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 16 --topic Topic_Device_Manager
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 16 --topic Topic_Comp_Request_Offline
#bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 16 --topic Topic_Face_Register