kafka常用命令
常用命令
1.新建主题
./bin/kafka-topics.sh --create --zookeeper 192.168.28.131:2181,192.168.28.131:2182,192.168.28.131:2183 --replication-factor 3 --partitions 3 --topic test1
2. 查看主题
./bin/kafka-topics.sh --list --zookeeper 192.168.28.131:2181,192.168.28.131:2182,192.168.28.131:2183
3. 查看topic详情
./bin/kafka-topics.sh --describe --zookeeper 192.168.28.131:2181,192.168.28.131:2182,192.168.28.131:2183 --topic test
4. 删除Topic
./bin/kafka-topics.sh --delete --zookeeper 192.168.28.131:2181,192.168.28.131:2182,192.168.28.131:2183 --topic test
5. 修改topic的partition数量(只能增加不能减少)
./bin/kafka-topics.sh --alter --zookeeper 192.168.28.131:2181,192.168.28.131:2182,192.168.28.131:2183 --partitions 5 --topic test1