问题:

1. kafka的topic 是程序自己建立,默认只建立8个partitions,1个replication-factor

目的: 扩展partitions 到9个, replicatoion-factor  3个

原因:因为kafka是三台,如果replicatoion-factor设置1的话,kafka坏掉一个会有影响

(1). 扩展partitions 到9个

/kafka-topics.sh --zookeeper kafka-zookeeper01:2181,kafka-zookeeper02:2181,kafka-zookeeper03:2181/kafka --alter --topic Message --partitions 9
 
查看结果:
/kafka-topics.sh --describe  --zookeeper kafka-zookeeper01:2181,kafka-zookeeper02:2181,kafka-zookeeper03:2181/kafka  --topic Message 

Topic:Message  PartitionCount:9 ReplicationFactor:1 Configs:
Topic: Message  Partition: 0 Leader: 1 Replicas: 1 Isr: 1
Topic:Message  Partition: 1 Leader: 2 Replicas: 2 Isr: 2
Topic: Message  Partition: 2 Leader: 3 Replicas: 3 Isr: 3
Topic: Message  Partition: 3 Leader: 1 Replicas: 1 Isr: 1
Topic: Message Partition: 4 Leader: 2 Replicas: 2 Isr: 2
Topic: Message  Partition: 5 Leader: 3 Replicas: 3 Isr: 3
Topic: Message Partition: 6 Leader: 1 Replicas: 1 Isr: 1
Topic: Message  Partition: 7 Leader: 2 Replicas: 2 Isr: 2

Topic: Message  Partition: 8 Leader: 3 Replicas: 3 Isr: 3

(2)扩展ReplicationFactor 为3

vim increace-factor.json

{"version":1,
"partitions":[
{"topic":"Message","partition":0,"replicas":[1,2,3]},
{"topic":"Message","partition":1,"replicas":[1,2,3]},
{"topic":"Message","partition":2,"replicas":[1,2,3]},
{"topic":"Message","partition":3,"replicas":[1,2,3]},
{"topic":"Message","partition":4,"replicas":[1,2,3]},
{"topic":"Message","partition":5,"replicas":[1,2,3]},
{"topic":"Message","partition":6,"replicas":[1,2,3]},
{"topic":"Message","partition":7,"replicas":[1,2,3]}

{"topic":"Message","partition":8,"replicas":[1,2,3]}
]}

执行如下命令:

/kafka-reassign-partitions.sh --zookeeper kafka-zookeeper01:2181,kafka-zookeeper02:2181,kafka-zookeeper03:2181/kafka --reassignment-json-file increace-factor.json --execute

[root@java]#/kafka-topics.sh --describe --zookeeper kafka-zookeeper01:2181,kafka-zookeeper02:2181,kafka-zookeeper03:2181/kafka  --topic Message
Topic:Message PartitionCount:9 ReplicationFactor:3 Configs:
Topic: Message Partition: 0 Leader: 1 Replicas: 1,2,3 Isr: 1,2,3
Topic: Message Partition: 1 Leader: 1 Replicas: 1,2,3 Isr: 2,1,3
Topic: Message Partition: 2 Leader: 1 Replicas: 1,2,3 Isr: 3,1,2
Topic: Message Partition: 3 Leader: 1 Replicas: 1,2,3 Isr: 1,2,3
Topic: Message Partition: 4 Leader: 1 Replicas: 1,2,3 Isr: 2,1,3
Topic: Message  Partition: 5 Leader: 1 Replicas: 1,2,3 Isr: 3,1,2
Topic: Message Partition: 6 Leader: 1 Replicas: 1,2,3 Isr: 1,2,3
Topic: cMessage Partition: 7 Leader: 1 Replicas: 1,2,3 Isr: 2,1,3

Topic: Message  Partition: 8 Leader: 1 Replicas: 1,2,3 Isr: 2,1,3

kafka 扩展partition和replication-factor的更多相关文章

  1. Error while executing topic command : Replication factor: 2 larger than available brokers: 0.

    [root@hdp1 /mnt/software/maxwell-1.19.4]#kafka-topics.sh --zookeeper hdp1,hdp2,hdp3:2181 --create -- ...

  2. Apache Kafka(十)Partitions与Replication Factor 调整准则

    Partitions与Replication Factor调整准则 Partition 数目与Replication Factor是在创建一个topic时非常重要的两个参数,这两个参数的取值会直接影响 ...

  3. kafka创建会话,报Error while executing topic command : Replication factor: 1 larger than available brokers: 0.

     bin/kafka-topics.sh --create --zookeeper es1:2181 --replication-factor 1 --partitions 1 --topic top ...

  4. 【kafka】kafka.admin.AdminOperationException: replication factor: 1 larger than available brokers: 0

    https://blog.csdn.net/bigtree_3721/article/details/78442912 I am trying to create topics in Kafka by ...

  5. kafka之partition分区及副本replica升级

    修改kafka的partition分区 bin/kafka-topics.sh --zookeeper datacollect-2:2181 --alter --partitions 3 --topi ...

  6. Kafka Topic Partition Replica Assignment实现原理及资源隔离方案

    本文共分为三个部分:   Kafka Topic创建方式 Kafka Topic Partitions Assignment实现原理 Kafka资源隔离方案   1. Kafka Topic创建方式 ...

  7. replication factor

    http://www.tuicool.com/articles/RJbIBj 关于Hadoop中replication factor解惑 时间 2014-06-09 08:00:50   ITeye ...

  8. Kafka Cached zkVersion [62] not equal to that in zookeeper, skip updating ISR (kafka.cluster.Partition) 问题分析

    我司业务Kafka集群是3节点(broker分别为10,20,30),每个Topic 3 Partition,3 Repilication的配置,早上起床突然发现所有Topic的Broker节点都变为 ...

  9. linux 下安装 php kafka 扩展

    我们使用官方推荐 php kafka 扩展 phpkafka,由于该扩展是基于 librdkafka 开发,所以我们首先需要安装 librdkafka 下载地址:http://kafka.apache ...

随机推荐

  1. 前端(十八)—— jQuery高级操作:选择器、文本属性与类、事件、文档操作、动画、结构关系

    JQ选择器.文本属性与类.事件.文档操作.动画.结构关系 可参考jQuery的API文档 一.选择器 1.css语法匹配 标签 | 类 | id | 交集 群组 | 后代 | 兄弟 伪类 | 属性 $ ...

  2. docker 详细安装及问题排查

    一.安装docker 1.Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker . 通过 uname -r 命令查看 ...

  3. 连接分析算法-HITS-算法

    转自http://blog.csdn.net/Androidlushangderen/article/details/43311943 参考资料:http://blog.csdn.net/hguisu ...

  4. ubuntu16.04安装python虚拟环境

    自己也是搜的教程,亲测有效 ubuntu16.04创建虚拟环境 一.linux环境 Ubuntu16.04 二.安装和配置虚拟环境 安装虚拟环境 sudo pip install virtualenv ...

  5. 22-4-isarry

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  6. NCM格式转换MP3格式

    首先下载软件: 百度网盘下载地址:https://pan.baidu.com/s/1I_HUQGBnOq23Zdm-NgbnqA 提取码:u4m5 下载完毕直接打开就好 添加NCM文件 点击开始转换 ...

  7. table 表头不动,tbody滚动对齐

    http://www.imaputz.com/cssStuff/bigFourVersion.html# https://blog.csdn.net/yiifaa/article/details/52 ...

  8. 47. List中特有的方法

    集合的体系:--------------| Collection  单列集合的根接口----------| List 如果实现了List接口的集合类,该类具备的特点是:有序,可重复---------- ...

  9. Spring Boot 2.X 实现文件上传(三)

    使用 SpringBoot 项目完成单个.多个文件的上传处理,并将上传的文件保存到指定目录下. 代码演示案例 所有的 HTML 页面文件 index.html <!DOCTYPE html> ...

  10. DataTable转对象Model

    我们经常需要从数据库表中取数,取数是以取DataTable的方式,但是我么希望以对象为单位进行这种操作.即存在把取到的DataTable(数据表)转换为ModelList(对象集合)的需求. 原理稍微 ...