Kafka的基本操作
Kafka的基本操作
1、添加和删除 topics
bin/kafka-topics.sh --zookeeper zk_host:port/chroot --create --topic my_topic_name
--partitions 20 --replication-factor 3 --config x=y
bin/kafka-topics.sh --zookeeper zk_host:port/chroot --delete --topic my_topic_name
2、修改topics
bin/kafka-topics.sh --zookeeper zk_host:port/chroot --alter --topic my_topic_name
--partitions 40
####To add configs:
bin/kafka-topics.sh --zookeeper zk_host:port/chroot --alter --topic my_topic_name --config x=y
####To remove a config:
bin/kafka-topics.sh --zookeeper zk_host:port/chroot --alter --topic my_topic_name --deleteConfig x
3、查看topics
bin/kafka-topics.sh --describe --zookeeper localhost:2181
4、检查consumer位置
bin/kafka-run-class.sh kafka.tools.ConsumerOffsetChecker --zkconnect localhost:2181 --group test
页:
[1]