kafka之常用命令
#1.1 kafka启动命令
nohup bin/kafka-server-start.sh config/server.properties &
#1.2 kafka停止命令
bin/kafka-server-stop.sh
#1.3. kafka重启
systemctl restart kafka
#2.1 kafka-topic create 创建了一个名为afc_flux 的主题,3个分区,1个副本因子
./kafka-topics.sh --zookeeper tdh09:2181,tdh10:2181,tdh11:2181 --create --topic afc_flux --partitions 3 --replication-factor 1
#2.2 kafka删除 topic 命令
/root/TDH-Client/kafka/bin/kafka-console-topics.sh --delete --zookeeper 10.50.198.11:2181 --topic test1
#2.3查看全部的topic列表:
/root/TDH-Client/kafka/bin/kafka-console-topics.sh --list --zookeeper 10.50.198.11:2181
#2.4查看topic详情:
/root/TDH-Client/kafka/bin/kafka-console-topics.sh --describe --zookeeper 10.50.198.11:2181 --topic a05
#3.kafka生产命令:broker-list(21,22,23....)
/root/TDH-Client/kafka/bin/kafka-console-producer.sh --broker-list 10.50.198.21:9092 --topic a05
然后输入消息:例如:112233
#4.kafka消费命令:
/root/TDH-Client/kafka/bin/kafka-console-consumer.sh --bootstrap-server 10.50.198.21:9092 --topic a05 --from-beginning
#5.查看topic接收的消息:
/root/TDH-Client/kafka/bin/kafka-console-consumer.sh --bootstrap-server 10.50.198.21:9092 --topic a05 --from-beginning