一、建立topic:
kafka-topics.sh --create --replication-factor 1 --partitions 3 --zookeeper localhost:2181 --topic wklc-nginx-weixin
二、檢視topic list:
kafka-topics.sh --zookeeper 127.0.0.1 --list
三、檢視單個topic:
kafka-topics.sh --zookeeper 127.0.0.1 --topic api3-nginx --describe
四、從console消費:
kafka-console-consumer.sh --topic wklc-nginx --zookeeper 127.0.0.1:2181 --from-beginning
五、修改topic partitions:
kafka-topics.sh --zookeeper 127.0.0.1 --topic api3-nginx --alter --partitions 3
六、删除topic:
kafka-topics.sh --delete --zookeeper 127.0.0.1 --topic wklc-nginx
七、修改topic config:
kafka-topics.sh --zookeeper localhost:2181 --create --topic my-topic --partitions 1 --replication-factor 1 --config max.message.bytes=64000 --config flush.messages=1
八、修改topic資料存儲時間
./kafka-topics.sh --zookeeper 127.0.0.1:2181 -topic coreservice-tomcat --alter --config retention.ms=21600000