[2017-06-15 19:33:14,716] ERROR [ReplicaFetcherThread-0-0], Error for partition [3_7_0_20170615,6] to broker 0:class kafka.common.NotLeaderForPartitionException (kafka.server.ReplicaFetcherThread)
[2017-06-15 19:33:14,718] ERROR [ReplicaFetcherThread-0-0], Error for partition [3_7_0_20170615,6] to broker 0:class kafka.common.NotLeaderForPartitionException(kafka.server.ReplicaFetcherThread)
执行
利用
tail -n300 kafkaServer.out | grepNotLeaderForPartitionException | awk -F"partition " '{print $2}' |awk -F"]" '{print $1}' | awk -F"[" '{print $2}'| sort |uniq | sort
制作json文件(node005 /opt/isu/kafka/bin下有)
{
"partitions":
[
{"topic":"2_0_2_20170618","partition":21},
{"topic":"3_0_20170618","partition":19},
{"topic":"2_0_1_hdfs_8089_kafka_2_20170618","partition":44},
{"topic":"3_7_0_hdfs_8089_kafka_20170618","partition":13},
{"topic":"sdk_HDFS_168_20170618","partition":44}
]
}
只均衡个别topic的个别partition
kafka-preferred-replica-election.sh --zookeeper node001:2181,node002:2181,node003:2181/kafka --path-to-json-file ./partition_elec.json
如果有太多topic报错,建议直接对所有topic进行:
kafka-preferred-replica-election.sh --zookeeper node001:2181,node002:2181,node003:2181/kafka