kafka使用总结

列出所有topics:
bin/kafka-topics.sh --list --zookeeper 10.19.167.11:2181,10.19.167.12:2181,10.19.167.14:2181
bin/kafka-topics.sh --list --zookeeper 10.19.167.21:2181,10.19.167.22:2181,10.19.167.23:2181

查看某个topic:
bin/kafka-topics.sh --describe --zookeeper 10.19.167.11:2181,10.19.167.12:2181,10.19.167.14:2181 --topic domob_no_match_landing_event_stream

创建一个topic:
bin/kafka-topics.sh --create --topic test0 --zookeeper 10.19.167.11:2181,10.19.167.12:2181,10.19.167.14:2181 --config max.message.bytes=12800000 --config flush.messages=1 --partitions 5 --replication-factor 1
bin/kafka-topics.sh --create --topic one_degree_data_20181119 --zookeeper 10.19.167.21:2181,10.19.167.22:2181,10.19.167.23:2181 --config max.message.bytes=12800000 --config flush.messages=1 --partitions 10 --replication-factor 1

删除某个topic:
bin/kafka-topics.sh --delete --topic test0 --zookeeper 10.19.167.11:2181,10.19.167.12:2181,10.19.167.14:2181
配置server.properties文件,给定参数delete.topic.enable=true,重启kafka服务,此时执行delete命令表示允许进行Topic的删除

修改某个topic: Kafka分区数量只允许增加,不允许减少
bin/kafka-topics.sh --zookeeper 10.19.167.11:2181,10.19.167.12:2181,10.19.167.14:2181 --alter --topic test0 --partitions 10
bin/kafka-topics.sh --zookeeper 192.168.187.146:2181 --alter --topic test0 --config max.message.bytes=128000
bin/kafka-topics.sh --zookeeper 192.168.187.146:2181 --alter --topic test0 --delete-config max.message.bytes

启动kafka服务:
nohup ./bin/kafka-server-start.sh ./config/server.properties &
停止kafka服务:
bin/kafka-server-stop.sh

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值