`

kafka topic命令

阅读更多

 

 kafka topic可以定制执行brokerid和partition的topic,还有增加partition

kafka topic

Create, delete, describe, or change a topic.

Option                                  Description                            

------                                  -----------                            

--alter                                 Alter the configuration for the topic. 

--config <name=value>                   A topic configuration override for the 

                                          topic being created or altered.The   

                                          following is a list of valid         

                                          configurations:                      

                                                unclean.leader.election.enable        

                                                delete.retention.ms                   

                                                segment.jitter.ms                     

                                                retention.ms                          

                                                flush.ms                              

                                                segment.bytes                         

                                                flush.messages                        

                                                segment.ms                            

                                                retention.bytes                       

                                                cleanup.policy                        

                                                segment.index.bytes                   

                                                min.cleanable.dirty.ratio             

                                                max.message.bytes                     

                                                file.delete.delay.ms                  

                                                min.insync.replicas                   

                                                index.interval.bytes                  

                                        See the Kafka documentation for full   

                                          details on the topic configs.        

--create                                Create a new topic.                    

--delete                                Delete a topic                         

--delete-config <name>                  A topic configuration override to be   

                                          removed for an existing topic (see   

                                          the list of configurations under the 

                                          --config option).                    

--describe                              List details for the given topics.     

--help                                  Print usage information.               

--list                                  List all available topics.             

--partitions <Integer: # of partitions> The number of partitions for the topic 

                                          being created or altered (WARNING:   

                                          If partitions are increased for a    

                                          topic that has a key, the partition  

                                          logic or ordering of the messages    

                                          will be affected                     

--replica-assignment                    A list of manual partition-to-broker   

  <broker_id_for_part1_replica1 :         assignments for the topic being      

  broker_id_for_part1_replica2 ,          created or altered.                  

  broker_id_for_part2_replica1 :                                               

  broker_id_for_part2_replica2 , ...>                                          

--replication-factor <Integer:          The replication factor for each        

  replication factor>                     partition in the topic being created.

--topic <topic>                         The topic to be create, alter or       

                                          describe. Can also accept a regular  

                                          expression except for --create option

--topics-with-overrides                 if set when describing topics, only    

                                          show topics that have overridden     

                                          configs                              

--unavailable-partitions                if set when describing topics, only    

                                          show partitions whose leader is not  

                                          available                            

--under-replicated-partitions           if set when describing topics, only    

                                          show under replicated partitions     

--zookeeper <urls>                      REQUIRED: The connection string for    

                                          the zookeeper connection in the form 

                                          host:port. Multiple URLS can be      

                                          given to allow fail-over.  

 

 

topic describe命令:

topic所有的partition

 bin/kafka-topics.sh --describe --topic dirkzhang --zookeeper host34/kafka-dirktest

在复制的partition

 bin/kafka-topics.sh --describe --topic dirkzhang --zookeeper host34/kafka-dirktest --under-replicated-partitions    

没有leader的partition

 bin/kafka-topics.sh --describe --topic dirkzhang --zookeeper host34/kafka-dirktest --unavailable-partitions

 打印新配置

  bin/kafka-topics.sh --describe --topic dirkzhang --zookeeper host34/kafka-dirktest --topics-with-overrides

 

 

topic create 命令

bin/kafka-topics.sh --create --topic testcreate2 --zookeeper host34/kafka-dirktest --partitions 3 --replication-factor 2

数据定位具体的brokerid

在用replica-assignment的时候,不允许用partitions和replication-factor

并且replica不能重复

bin/kafka-topics.sh --create --topic testcreate --zookeeper host34/kafka-dirktest  --replica-assignment 0341:0361,0341:0371,0341:0361

 

topic add命令

增加partition,partitions必须是增多的

bin/kafka-topics.sh --alter --topic testcreate --zookeeper host34/kafka-dirktest --partitions 4 

以下命令不管用 bug:

bin/kafka-topics.sh --alter --topic testcreate --zookeeper host34/kafka-dirktest --partitions 4  --replica-assignment 0341:0361

 

修改topic的delete时间为6小时

bin/kafka-topics.sh --alter --zookeeper host211/kafka-real --topic report_rtb_request --config delete.retention.ms=21600000

 

 

分享到:
评论

相关推荐

    kafka使用命令.txt

    本人积累的一些Kafka调试的常用命令,主要包含:启动Kafka、创建Topic、 查看topic列表、创建生产者、创建消费者、修改分区数、删除Topic、自带生产者性能测试

    Kafka常用命令收录

    日记月累,收录kafka各种命令,会持续更新。  在0.9.0.0之后的Kafka,出现了几个新变动,一个是在Server端增加了GroupCoordinator这个角色,另一个较大的变动是将topic的offset 信息由之前存储在zookeeper上改为...

    Kafka常用命令总结.docx

    资源内容: 1,Kafka的安装与服务启停命令; 2,Kafka的Topic的操作指令命令; 3,消息的生产与消费的命令; 4,分组及其它命令; 5,相关问题及解决办法;

    Kafka0.8.2.1删除topic逻辑.docx

    命令: bin/kafka-topics.sh --zookeeper zk_host:port/chroot --delete --topic my_topic_name 这条命令其实就是在zookeeper(假设你的chroot就是/)的/admin/delete_topics下创建一个临时节点,名字就是topic名称...

    KAFKA命令简介

    关于KAFKA消息队列的一些简单命令,读取队列什么的,供初学者参考,实际使用还需要根据topic的关键字来进行。

    kafka汇总.xmind

    使用过程中,整理的kafka,安装,基本命令,topic调整,kafka的实战介绍,特点总结,希望对大家有用,和大家一起分享

    KafkaNeo4JConnector:通过Kafka-Topic执行用Cypher或JCypher编写的Neo4J命令的连接器

    KafkaNeo4JConnector 通过Kafka-Topic执行用Cypher或JCypher编写的Neo4J命令的连接器与其他Neo4J连接器的差异该连接器支持JCypher,并使用Apache-Kafka-Streams模型。 其他连接器仅支持简单的Cypher-Command,并使用...

    Windows使用Kafka资源包

    1、安装包内容包括: 64位的JDK: jdk1.8.0_181_64bit.exe 3.2.1版本的kafka,Scala版本为2.13: kafka_2.13-3.2.1.tgz ...5、用命令创建producer和consumer,发布消息并消费 6、启动kafka和消费消息时的异常处理

    linux中如何操作kafka

    kafka常用操作命令,启动,新增topic,删除topic,查看topic列表

    Kafka源码系列教程之删除topic

    主要给大家介绍了关于Kafka源码系列教程之删除topic的相关资料,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

    kafka tools 1.0.3

    方便查看kafka相关信息。比如brokers、topic、consumers;支持右键删除topic的功能(不过我没有这么玩过,我使用的命令)

    kafka2elasticsearch:卡夫卡 2 弹性搜索

    kafka2es作用 订阅kafka集群的某个topic的数据到es中,并根据订阅的日志内容product,event_time创建索引,索引名为... "kafkaTopic":"xxx", //订阅kafka的topic "kafkaGroup":"xxxx", //订阅kafka的group "t

    Kafka 笔记

    文章目录Kafka架构名次解释Producer(生产者)命令使用脚本常用参数举例分区策略发送返回值幂等性Consumer(消费者)命令使用脚本常用参数举例分配策略Topic(主题)命令使用脚本常用参数举例Kafka高读写 ...

    【Kafka】(九)项目中使用 Kafka 整合 Flume

    文章目录一、启动 Kafka二、创建 Topic 消息队列三、查询 kafka 消息队列四、启动 consumer 监控窗口五、写 Flume 自定义配置文件六、开启 Flume七、结果分析 一、启动 Kafka kafka-server-start.sh /opt/soft/kafka...

    quarkus-kafka-demo

    可以使用以下命令启动该应用程序: mvn quarkus:dev 终点 GET /records :查看自上次对此端点发出请求以来处理的成功和失败消息的数量。 可以每秒调用一次,以大致了解性能。 POST /records -d "{ \"num\": \"1000...

    kafka-tutorial-demo

    在本地Mahcine上运行的Kafka Handy命令参考链接: ://kafka.apache.org/quickstart 创建主题: $ bin/kafka-topics.sh --create --topic quickstart-events --bootstrap-server localhost:9092 将文本写入主题:...

    kafka-rtd:来自Kafka的Excel RTD服务器采购数据

    卡夫卡 来自Kafka的Excel RTD服务器采购数据 安装 克隆存储库并转到其文件夹。 使用Visual Studio,MSBuild或通过以下方便的脚本文件编译代码: ... =RTD("kafka",, "HOST","TOPIC", "FIELD") //用于JSON数据

    Kafka 常用命令行详细介绍及整理

    ./kafka-topics.sh -zookeeper 127.0.0.1:2181 -describe -topic testKJ1 2、为topic增加副本 ./kafka-reassign-partitions.sh -zookeeper 127.0.0.1:2181 -reassignment-json-file json/partitions-to-move.json -...

    kafka-docker-on-mac:Mac上的Kafka

    kafka-docker-on-mac以发展为目的文献资料入门$ make up默认端口港口描述12181动物园管理员端口19093卡夫卡港 Docker堆栈示例发出命令构建泊坞窗映像$ make build部署卡夫卡经纪人$ make up显示堆叠状态$ make ...

    Kafka使用入门教程第1/2页

    •Kafka将消息以topic为单位进行归纳。 •将向Kafka topic发布消息的程序成为producers. •将预订topics并消费消息的程序成为consumer. •Kafka以集群的方式运行,可以由一个或多个服务组成,每个服务叫做一个broker...

Global site tag (gtag.js) - Google Analytics