Kafka命令详解(一)---topic相关

1、create 
创建一个topic
bin/kafka-topics.sh --zookeeper ip:port --create --topic backtest --partitions 3  --replication-factor 2
2、list
List all available topics.
bin/kafka-topics.sh --zookeeper ip:port --list
3、delete
Delete a topic
4、delete-config
5 topic configuration override to be removed for an existing topic (see the list of configurations under the --config option).
4、describe
List details for the given topics.
bin/kafka-topics.sh --zookeeper ip:port --describe --topic backtest
6、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
partitions指定topic分区数:
分区数,控制topic将分片成多少个log。可以显示指定,如果不指定则会使用broker(server.properties)中的num.partitions配置的数量
分区数也限制了consumer的并行度,即限制了并行consumer消息的线程数不能大于分区数
分区数或者或是单台服务器上的分区数过多,会增加不可用及延迟的风险。因为多的分区数,意味着需要打开更多的文件句柄、增加点到点的延时、增加客户端的内存消耗。
7、replication-factor <Integer:replication factor>            
The replication factor for each partition in the topic being created.
replication-factor指定topic每个分区的副本数
replication factor 控制消息保存在几个broker(服务器)上,一般情况下等于broker的个数。
如果没有在创建时显示指定或通过API向一个不存在的topic生产消息时会使用broker(server.properties)中的default.replication.factor配置的数量
8、topic <String: topic>                  
The topic to be create, alter or describe. Can also accept a regular expression except for --create option
9、zookeeper <String: urls>               
REQUIRED: The connection string for the zookeeper connection in the form host:port. Multiple URLS can be given to allow fail-over.       
10、alter
Alter the number of partitions,replica assignment, and/or configuration for the topic.
11、config
A topic configuration override for the topic being created or altered.The following is a list of valid         
configurations:                      
cleanup.policy                        
compression.type                      
delete.retention.ms                   
file.delete.delay.ms                  
flush.messages                        
flush.ms                              
follower.replication.throttled.       
replicas                             
index.interval.bytes                  
leader.replication.throttled.replicas 
max.message.bytes                     
message.format.version                
message.timestamp.difference.max.ms   
message.timestamp.type                
min.cleanable.dirty.ratio             
min.compaction.lag.ms                 
min.insync.replicas                   
preallocate                           
retention.bytes                       
retention.ms                          
segment.bytes                         
segment.index.bytes                   
segment.jitter.ms                     
segment.ms                            
unclean.leader.election.enable        
See the Kafka documentation for full details on the topic configs.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值