kafka-常用命令整理

一、启动

  • 后台启动
nohup  sh bin/kafka-server-start.sh config/server.properties &
  • 守护进程启动【推荐】
sh sh bin/kafka-server-start.sh -daemon config/server.properties

二、topic 创建

  • topic创建
sh bing/kafka-topics.sh

--zookeeper  # zk的ip地址列表

--create  #创建命令

--topic #后跟topic名

--partitions #分区数

--replication-factor # 副本数

sh bin/kafka-topics.sh --create --topic test1 --zookeeper localhost:2181 --partitions 5 --replication-factor 1
  • topic列表查看
sh bin/kafka-topics.sh --list --zookeeper localhost:2181
  • 查看topic的描述信息
sh bin/kafka-topics.sh --describe --zookeeper localhost:2181  --topic test1
  • 查看topic的过期时间配置
sh bin/kafka-configs.sh --zookeeper localhost:2181 --describe --entity-name test1 --entity-type topics

三、topic 生产数据

Todo

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。