How to manage and balance “Huge Data Load” for Big Kafka Clusters---reference
1. Add Partition Tool
Partitions act as unit of parallelism. Messages of a single topic are distributed to multiple partitions that can be stored and served on different servers. Upon creation of a topic, the number of partitions for this topic has to be specified. Later on more partitions may be needed for this topic when the volume of this topic increases. This tool helps to add more partitions for a specific topic and also allow manual replica assignment of the added partitions. You can refer to the previous blog Quick steps : Have a Kafka Cluster Up & Running in 3 minutes to setup kafka cluster and create topics.
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
bin/kafka-add-partitions.shOption Description------ -------------partition <Integer: # of partitions> REQUIRED: Number of partitions to addto the topic--replica-assignment-list For manually assigning replicas to<broker_id_for_part1_replica1 : brokers for the new partitionsbroker_id_for_part1_replica2, (default: )broker_id_for_part2_replica1 :broker_id_for_part2_replica2, ...>--topic <topic> REQUIRED: The topic for whichpartitions need to be added.--zookeeper <urls> REQUIRED: The connection string forthe zookeeper connection in the formhost:port. Multiple URLS can begiven to allow fail-over. |
2. Reassign Partitions Tool
What does the tool do?
The goal of this tool is similar to the Referred Replica Leader Election Tool as to achieve load balance across brokers. But instead of only electing a new leader from the assigned replicas of a partition, this tool allows to change the assigned replicas of partitions – remember that followers also need to fetch from leaders in order to keep in sync, hence sometime only balance the leadership load is not enough.
A summary of the steps that the tool does is shown below -
1. The tool updates the zookeeper path "/admin/reassign_partitions" with the list of topic partitions and (if specified in the Json file) the list of their new assigned replicas.
2. The controller listens to the path above. When a data change update is triggered, the controller reads the list of topic partitions and their assigned replicas from zookeeper.
3. For each topic partition, the controller does the following:
3.1. Start new replicas in RAR - AR (RAR = Reassigned Replicas, AR = original list of Assigned Replicas)
3.2. Wait until new replicas are in sync with the leader
3.3. If the leader is not in RAR, elect a new leader from RAR
3.4 4. Stop old replicas AR - RAR
3.5. Write new AR
3.6. Remove partition from the /admin/reassign_partitions path
How to use the tool?
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
bin/kafka-reassign-partitions.shbin/kafka-reassign-partitions.shOption Description------ -------------broker-list <brokerlist> The list of brokers to which thepartitions need to be reassigned inthe form "0,1,2". This is requiredfor automatic topic reassignment.--execute [execute] This option does the actualreassignment. By default, the tooldoes a dry run--manual-assignment-json-file <manual The JSON file with the list of manualassignment json file path> reassignmentsThis option or topics-to-move-json-file needs to bespecified. The format to use is -{"partitions":[{"topic": "foo","partition": 1,"replicas": [1,2,3] }],"version":1}--topics-to-move-json-file <topics to The JSON file with the list of topicsreassign json file path> to reassign.This option or manual-assignment-json-file needs to bespecified. The format to use is -{"topics":[{"topic": "foo"},{"topic": "foo1"}],"version":1}--zookeeper <urls> REQUIRED: The connection string forthe zookeeper connection in the formhost:port. Multiple URLS can begiven to allow fail-over. |
3. Add Brokers(Cluster Expansion)
Cluster expansion involves including brokers with new broker ids in a Kafka 08 cluster. Typically, when you add new brokers to a cluster, they will not receive any data from existing topics until this tool is run to assign existing topics/partitions to the new brokers. The tool allows 2 options to make it easier to move some topics in bulk to the new brokers. These 2 options are a) topics to move b) list of newly added brokers. Using these 2 options, the tool automatically figures out the placements of partitions for the topics on the new brokers.
The following example moves 2 topics (foo1, foo2) to newly added brokers in a cluster (5,6,7).
|
1
2
3
4
5
6
7
|
> ./bin/kafka-reassign-partitions.sh --topics-to-move-json-file topics-to-move.json --broker-list "5,6,7" --execute> cat topics-to-move.json{"topics":[{"topic": "foo1"},{"topic": "foo2"}],"version":1} |
Selectively moving some partitions to a broker
The partition movement tool can also be moved to selectively move some replicas for certain partitions over to a particular broker. Typically, if you end up with an unbalanced cluster, you can use the tool in this mode to selectively move partitions around. In this mode, the tool takes a single file which has a list of partitions to move and the replicas that each of those partitions should be assigned to.
The following example moves 1 partition (foo-1) from replicas 1,2,3 to 1,2,4
|
1
2
3
4
5
6
7
8
9
10
|
> ./bin/kafka-reassign-partitions.sh --manual-assignment-json-file partitions-to-move.json --execute> cat partitions-to-move.json{"partitions":[{"topic": "foo","partition": 1,"replicas": [1,2,4] }],}],"version":1} |
Note : These tools are available in version 0.8 , not prior versions.
How to manage and balance “Huge Data Load” for Big Kafka Clusters---reference的更多相关文章
- The package 'MySql.Data' tried to add a framework reference to 'System.Runtime' which was not found in the GAC
最近在学习Visual Studio连接mysql EF模型.在nuget中安装mysql.data时总是提示The package 'MySql.Data' tried to add a frame ...
- Automatically migrating data to new machines kafka集群扩充迁移topic
The partition reassignment tool can be used to move some topics off of the current set of brokers to ...
- kafaka quickstart
http://kafka.apache.org/ http://kafka.apache.org/downloads cd /root/kafuka/kafka_2.12-0.11.0.0 nohup ...
- load data(sql)
一般对于数据库表的插入操作,我们都会写程序执行插入sql,插入的数据少还可以,如果数据多了.执行效率上可能就不太理想了.load data语句用于高速地从一个文本文件中读取数据,装载到一个表中,相比于 ...
- How Network Load Balancing Technology Works--reference
http://technet.microsoft.com/en-us/library/cc756878(v=ws.10).aspx In this section Network Load Balan ...
- Transferring Data Between ASP.NET Web Pages
14 July 2012 20:24 http://www.mikesdotnetting.com/article/192/transferring-data-between-asp-net-web- ...
- Managing Spark data handles in R
When working with big data with R (say, using Spark and sparklyr) we have found it very convenient t ...
- Building the Unstructured Data Warehouse: Architecture, Analysis, and Design
Building the Unstructured Data Warehouse: Architecture, Analysis, and Design earn essential techniqu ...
- Android开发训练之第五章第三节——Transferring Data Without Draining the Battery
Transferring Data Without Draining the Battery GET STARTED DEPENDENCIES AND PREREQUISITES Android 2. ...
随机推荐
- capitalize()在Python中含义
Python为string对象提供了转换大小写的方法:upper() 和 lower(). 还不止这些,Python还为我们提供了首字母大写,其余小写的capitalize()方法, 以及所有单词首字 ...
- logger.debug,logger.info,logger.warn,logger.error,logger.fatal的区别
logger.debug,logger.info,logger.warn,logger.error,logger.fatal的区别 logger.debug,logger.info,logger.wa ...
- Word中表格内容被遮挡
RT,输入内容后下面的主任签字会被遮挡,解决办法:选中整个表格右键,表格属性,行高值设置为最小值,然后设置允许跨页断行:有人说右键按内容调整表格也行,没试过............
- [CC150] Find a line passing the most number of points
Problem: Given a two-dimensional graph with points on it, find a line which passes the most number o ...
- Entity FrameWork知识点汇总
这里罗列的并非EF的所有知识点 ,只是我在开发过程中遇到或者使用到的知识,记录于此, 备忘 1:EF的三种创建方式 A:Database First B:Model First C:Code Firs ...
- 找到个好的讲PYTHON FILE IO的文档,收藏
现在我感觉快入门了哈, 这两天,可以用PYTHON写一点自己想要实现的东东了. 但文件,IO,编码,邮件,始终有点续不完全. 这个文档,我看行.. http://www.dabeaz.com/pyth ...
- 畅通工程续 HDOJ--1874
畅通工程续 Time Limit : 3000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submiss ...
- 员工部门表综合查询SQL
--数据库的表设计如下: --部门:部门编号,部门名称,地址: --员工:员工编号,员工名字,职务,管理编号,入职日期,薪资,奖金,部门编号: --创建部门表: CREATE TABLE dept( ...
- [转]js动态创建json类型
废话少说:json是一个特有的键值对数组类型.既然是数组类型那么我们就可以这样定义 1.先定义数组 var Data = []; 2.理解键值对 对象名:值{ "id": i, & ...
- 排序算法_MergeSort
算法思想: 分治自顶而下实现归并排序: 分治法的三个步骤 设归并排序的当前区间是R[low..high],分治法的三个步骤是:①分解:将当前区间一分为二,即求分裂点 ...