天天看点

kafka 备忘

创建topic

kafka-topics.sh --create --zookeeper 127.0.0.1:2181 --partitions 3 --replication-factor 1 --topic test

删除topic

kafka-topics.sh --delete --zookeeper 127.0.0.1:2181 --topic test

修改分区个数

kafka-topics.sh --alter --zookeeper 127.0.0.1:2181 --topic dsideal_db --partitions 3

发送

kafka-console-producer.sh --broker-list 127.0.0.1:9092 --topic test

测试接收

kafka-console-consumer.sh --bootstrap-server 127.0.0.1:9092 --topic test1 --from-beginning

查看

kafka-topics.sh --describe --zookeeper 127.0.0.1:2181 --topic dsideal_db