挺麻烦的,还是建议在建立topic时提前规划好
{
"partitions":
[
{
"topic": "TEST",
"partition": 0,
"replicas": [0,1]
},
{
"topic": "TEST",
"partition": 1,
"replicas": [1,2]
},
{
"topic": "TEST",
"partition": 2,
"replicas": [2,0]
},
{
"topic": "TEST",
"partition": 3,
"replicas": [0,1]
},
{
"topic": "TEST",
"partition": 4,
"replicas": [1,2]
},
{
"topic": "TEST",
"partition": 5,
"replicas": [2,0]
},
{
"topic": "TEST",
"partition": 6,
"replicas": [0,1]
},
{
"topic": "TEST",
"partition": 7,
"replicas": [1,2]
},
{
"topic": "TEST",
"partition": 8,
"replicas": [2,0]
},
{
"topic": "TEST",
"partition": 9,
"replicas": [0,1]
},
{
"topic": "TEST",
"partition": 10,
"replicas": [1,2]
},
{
"topic": "TEST",
"partition": 11,
"replicas": [2,0]
},
{
"topic": "TEST",
"partition": 12,
"replicas": [0,1]
},
{
"topic": "TEST",
"partition": 13,
"replicas": [1,2]
},
{
"topic": "TEST",
"partition": 14,
"replicas": [2,0]
},
{
"topic": "TEST",
"partition": 15,
"replicas": [0,1]
},
{
"topic": "TEST",
"partition": 16,
"replicas": [1,2]
},
{
"topic": "TEST",
"partition": 17,
"replicas": [2,0]
},
{
"topic": "TEST",
"partition": 18,
"replicas": [0,1]
},
{
"topic": "TEST",
"partition": 19,
"replicas": [1,2]
},
{
"topic": "TEST",
"partition": 20,
"replicas": [2,0]
},
{
"topic": "TEST",
"partition": 21,
"replicas": [0,1]
},
{
"topic": "TEST",
"partition": 22,
"replicas": [1,2]
},
{
"topic": "TEST",
"partition": 23,
"replicas": [2,0]
},
{
"topic": "TEST",
"partition": 24,
"replicas": [0,1]
},
{
"topic": "TEST",
"partition": 25,
"replicas": [1,2]
},
{
"topic": "TEST",
"partition": 26,
"replicas": [2,0]
},
{
"topic": "TEST",
"partition": 27,
"replicas": [0,1]
},
{
"topic": "TEST",
"partition": 28,
"replicas": [1,2]
},
{
"topic": "TEST",
"partition": 29,
"replicas": [2,0]
},
{
"topic": "TEST",
"partition": 30,
"replicas": [0,1]
},
{
"topic": "TEST",
"partition": 31,
"replicas": [1,2]
},
{
"topic": "TEST",
"partition": 32,
"replicas": [2,0]
},
{
"topic": "TEST",
"partition": 33,
"replicas": [0,1]
},
{
"topic": "TEST",
"partition": 34,
"replicas": [1,2]
},
{
"topic": "TEST",
"partition": 35,
"replicas": [2,0]
},
{
"topic": "TEST",
"partition": 36,
"replicas": [0,1]
},
{
"topic": "TEST",
"partition": 37,
"replicas": [1,2]
},
{
"topic": "TEST",
"partition": 38,
"replicas": [2,0]
},
{
"topic": "TEST",
"partition": 39,
"replicas": [0,1]
},
{
"topic": "TEST",
"partition": 40,
"replicas": [1,2]
},
{
"topic": "TEST",
"partition": 41,
"replicas": [2,0]
},
{
"topic": "TEST",
"partition": 42,
"replicas": [0,1]
},
{
"topic": "TEST",
"partition": 43,
"replicas": [1,2]
},
{
"topic": "TEST",
"partition": 44,
"replicas": [2,0]
},
{
"topic": "TEST",
"partition": 45,
"replicas": [0,1]
},
{
"topic": "TEST",
"partition": 46,
"replicas": [1,2]
},
{
"topic": "TEST",
"partition": 47,
"replicas": [2,0]
},
{
"topic": "TEST",
"partition": 48,
"replicas": [1,2]
},
{
"topic": "TEST",
"partition": 49,
"replicas": [2,0]
}
],
"version":1
}
sh ./bin/kafka-reassign-partitions.sh --zookeeper 10.237.64.46:2181 --reassignment-json-file addreplica.json --execute
如果执行
sh ./bin/kafka-reassign-partitions.sh --zookeeper 10.237.64.46:2181 --reassignment-json-file addreplica.json --verify
可能会报错,不要理他。