kafka常用命令 topic创建 删除 设置保存时间 消费情况
作者:互联网
启动kafka
sh kafka-server-start.sh -daemon ../config/server.properties
停止kafka
sh kafka-server-stop.sh -daemon ../config/server.properties
启动zookeeper
sh zookeeper-server-start.sh ../config/zookeeper.properties
停止zookeeper
sh zookeeper-server-stop.sh ../config/zookeeper.properties
查看所有groupid
sh kafka-consumer-groups.sh --new-consumer --bootstrap-server 172.21.51.109:9092 --list
查看指定groupid的详细信息
sh kafka-consumer-groups.sh --new-consumer --bootstrap-server 172.21.51.109:9092 --group point_expire_group --describe
查看zookeeper上所有的topic
sh kafka-topics.sh --list --zookeeper 172.21.51.109:2181
查看指定topic的信息
sh kafka-topics.sh --describe --zookeeper 172.21.51.109:2181 --topic point_expire_topic
创建topic(partitions为分区数量,replications-factor为副本数量,zookeeper为集群地址,多个可用,隔开)
sh kafka-topics.sh --create --topic point_expire_topic --partitions 2 --replication-factor 3 --zookeeper 172.21.51.108:2181,172.21.51.109:2181,172.21.51.110:2181
删除topic
sh kafka-topics.sh --delete --zookeeper 172.21.51.108:2181,172.21.51.109:2181,172.21.51.110:2181 --topic point_expire_topic
修改topic日志存储时间,无需重启
ms 时间单位为毫秒值
sh kafka-topics.sh --topic point_expire_topic --zookeeper 172.21.51.108:2181,172.21.51.109:2181,172.21.51.110:2181 --alter --config retention.ms=86400000
标签:--,zookeeper,kafka,topic,sh,常用命令,172.21 来源: https://blog.csdn.net/weixin_51613454/article/details/123070048