修改kafka的partition分区

bin/kafka-topics.sh --zookeeper datacollect-2:2181 --alter --partitions 3 --topic client-agent-1

修改kafka副本数

官网解释如下:

  1. Increasing replication factor
  2.  
  3. Increasing the replication factor of an existing partition is easy. Just specify the extra replicas in the custom reassignment json file and use it with the --execute option to increase the replication factor of the specified partitions.
  4. For instance, the following example increases the replication factor of partition of topic foo from to . Before increasing the replication factor, the partition's only replica existed on broker 5. As part of increasing the replication factor, we will add more replicas on brokers 6 and 7.
  5.  
  6. The first step is to hand craft the custom reassignment plan in a json file:
  7.  
  8. > cat increase-replication-factor.json
  9. {"version":,
  10. "partitions":[{"topic":"foo","partition":,"replicas":[,,]}]}

准备json文件:

  1. 此文件结构没错,partition不够,需要根据实际情况完善此json文件。
    {
  2. "partitions":
  3. [
  4. {
  5. "topic": "speech-3",
  6. "partition": ,
  7. "replicas": [,,]
  8. },
  9. {
  10. "topic": "client-agent-3",
  11. "partition": ,
  12. "replicas": [,,]
  13. },
  14. {
  15. "topic": "session-manager-3",
  16. "partition": ,
  17. "replicas": [,,]
  18. },
  19. {
  20. "topic": "speech-2",
  21. "partition": ,
  22. "replicas": [,,]
  23. },
  24. {
  25. "topic": "client-agent-2",
  26. "partition": ,
  27. "replicas": [,,]
  28. },
  29. {
  30. "topic": "session-manager-2",
  31. "partition": ,
  32. "replicas": [,,]
  33. },
  34. {
  35. "topic": "speech-1",
  36. "partition": ,
  37. "replicas": [,,]
  38. },
  39. {
  40. "topic": "client-agent-1",
  41. "partition": ,
  42. "replicas": [,,]
  43. },
  44. {
  45. "topic": "session-manager-1",
  46. "partition": ,
  47. "replicas": [,,]
  48. }
  49. ],
  50. "version":
  51. }

开始执行副本升级:

  1. bin/kafka-reassign-partitions.sh --zookeeper datacollect-: --reassignment-json-file json.json --execute

验证是否完成:

  

  1. bin/kafka-reassign-partitions.sh --zookeeper datacollect-: --reassignment-json-file json.json --verify

参考:

  kafka修改分区和副本数 http://blog.csdn.net/haifeng000haifeng/article/details/50914197

   kafka运维--增加topic备份因子 http://blog.csdn.net/yanshu2012/article/details/53761284

  kafka迁移与扩容 http://liyonghui160com.iteye.com/blog/2193430

  Kafka 消息不能接收的问题 http://blog.csdn.net/lg772ef/article/details/65633359

kafka之partition分区及副本replica升级的更多相关文章

  1. Kafka技术内幕 读书笔记之(六) 存储层——服务端处理读写请求、分区与副本

    如下图中分区到 日 志的虚线表示 : 业务逻辑层的一个分区对应物理存储层的一个日志 . 消息集到数据文件的虚线表示 : 客户端发送的消息集最终会写入日志分段对应的数据文件,存储到Kafka的消息代理节 ...

  2. kafka 分区和副本以及kafaka 执行流程,以及消息的高可用

    1.Kafka概览 Apache下的项目Kafka(卡夫卡)是一个分布式流处理平台,它的流行是因为卡夫卡系统的设计和操作简单,能充分利用磁盘的顺序读写特性.kafka每秒钟能有百万条消息的吞吐量,因此 ...

  3. 详细解析kafka之kafka分区和副本

    本篇主要介绍kafka的分区和副本,因为这两者是有些关联的,所以就放在一起来讲了,后面顺便会给出一些对应的配置以及具体的实现代码,以供参考~ 1.kafka分区机制 分区机制是kafka实现高吞吐的秘 ...

  4. 入门大数据---Kafka深入理解分区副本机制

    一.Kafka集群 Kafka 使用 Zookeeper 来维护集群成员 (brokers) 的信息.每个 broker 都有一个唯一标识 broker.id,用于标识自己在集群中的身份,可以在配置文 ...

  5. kafka分区及副本在broker的分配

    kafka分区及副本在broker的分配 部分内容參考自:http://blog.csdn.net/lizhitao/article/details/41778193 以下以一个Kafka集群中4个B ...

  6. 二、kafka 中央控制器、主题、分区、副本

    集群和中央控制器 一个独立的Kafka服务器被称为broker.broker用来接收来自生产者的消息,为消息设置偏移量,并把消息保存到磁盘.换句话说,多个kafka实例组成kafka集群,每个实例(s ...

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

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

  8. (一)kafka修改topic分区的位置

    (一)kafka修改topic分区的位置 环境:kafka_2.10-0.8.2.1 + JDK1.7.0_80 1. 查看分区topic的分区分布 $ le-kafka-topics.sh --de ...

  9. kafka 日常使用和数据副本模型的理解

    kafka 日常使用和数据副本模型的理解 在使用Kafka过程中,有时经常需要查看一些消费者的情况.Kafka健康状况.临时查看.同步一些数据,又由于Kafka只是用来做流式存储,又没有像Mysql或 ...

随机推荐

  1. jQuery中first-child与first选择器区别

    1.first-child first-child为每个父级元素匹配第一个子元素,可以匹配出多个元素: 示例代码: <!DOCTYPE html> <html lang=" ...

  2. Unable to read TLD "META-INF/c.tld" from JAR file

      Unable to read TLD "META-INF/c.tld" from JAR file CreationTime--2018年7月18日17点46分 Author: ...

  3. python简单实现随机验证码

    这是自己在学习pyton时写的一个随机验证码,有不对的地方欢迎指出 代码 import random def verification(): lis = '' for i in range(4): S ...

  4. 从一个Idea到产品需要经历哪些阶段?

    从一个Idea到产品需要经历哪些阶段? Lkey 07月19日 16:520 现实工作中,不免遇到这样的情况.什么嘛?老板(领导)又有新想法了?又有其他Idea了?心里一阵骂娘xxxxxx.或者产品负 ...

  5. 更改npm全局模块和cache默认安装位置

    来源于:http://blog.csdn.net/friendan/article/details/51736231 1.因为我安装的Node.js自带了npm,所以在nodejs文件夹里面新建以下两 ...

  6. (三)Linux Shell编程——Shell常用命令(输出、判断、循环、函数、包含)

    3. 常用命令 3.1 输出 3.1.1 echo命令 echo是Shell的一个内部指令,用于在屏幕上打印出指定的字符串.命令格式: echo arg name="coding" ...

  7. js getAttribute getAttributeNode

    getAttribute():返回属性值,是一个文本字符串 getAttributeNode("属性名"):返回属性节点,是一个对象 <p id="bj" ...

  8. 深入理解SpringBoot配置

    一.application.properties的位置 1.当前目录的 "/config"的子目录下 2.当前目录下 3.classpath根目录的"/config&qu ...

  9. JavaScript(select onchange)的网页跳转的简单实现

    方法一: <select   onchange="goUrl(this.options[this.selectedIndex])"> <option>==& ...

  10. 转 ShowSlow+Yslow页面前端性能测试环境搭建

    ----//工具介绍 Yslow:YSlow是Yahoo发布的一款基于FireFox的插件. YSlow可以对网站的页面进行分析,并告诉你为了提高网站性能,如何基于某些规则而进行优化. ShowSlo ...