标签:simple set rap sim keep ica prope replicat OLE
创建主题:
创建主题(4个分区,2个副本)
kafka-topics.sh --create --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181 --replication-factor 2 --partitions 4 --topic test
查看集群详情:
kafka-topics.sh --describe --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181
查看集群中的topic列表:
kafka-topics.sh --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181 --list
查看topic详情:
kafka-topics.sh --describe --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181 --topic test
查看集群中的消费组列表:
kafka-consumer-groups.sh --bootstrap-server 192.168.130.37:9092,192.168.130.38:9092,192.168.130.39:9092 --list
查看消费组的消费情况:
kafka-consumer-groups.sh --bootstrap-server 192.168.130.37:9092,192.168.130.38:9092,192.168.130.39:9092 --describe --group consumer-group(消费组的名称)
生产者生产数据:
kafka-console-producer.sh --broker-list 192.168.130.37:9092,192.168.130.38:9092,192.168.130.39:9092 --topic test
消费者消费数据:
kafka-console-consumer.sh --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181 --topic test
kafka-console-consumer.sh --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181 --from-beginning --topic myz
新消费者
kafka-console-consumer.sh --bootstrap-server 192.168.130.37:9092,192.168.130.38:9092,192.168.130.39:9092 --topic test --new-consumer --from-beginning --consumer.config config/consumer.properties
kafka-simple-consumer-shell.sh --brist localhost:9092 --topic test --partition 0 --offset 1234 --max-messages 10
分区/扩容
kafka-topics.sh --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181 --alter --topic topic-name --partitions 2
标签:simple set rap sim keep ica prope replicat OLE
原文地址:https://www.cnblogs.com/yunger/p/12336242.html