创建主题
4个分区,2个副本
kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 2 --partition 4 --topic test
查询集群描述
kafka-topics.sh --describe --zookeeper
生产者
kafak-console-producer.sh --broker-list localhost:9092 --topic test
生产者新 0.9+版本
kafka-console-producer.sh --broker-list localhost:9092 --topic test --producer.config config/produer.properties
消费者
kafka-console-consumer.sh --zookeeper localhost:2181 --topic test
新消费者 0.9+版本
kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --new-consumer --from-beginning --consumer.config config/consumer.properties
网友评论