2017-08-01 6 views
1

からブローカを削除する方法を私は、次のレプリカでパーティションを持っている:レプリカ4は、存在しないブローカーのあるカフカは:レプリカセット

Topic: topicname Partition: 10 Leader: 1 Replicas: 1,2,4,3 Isr: 1,2,3 

。私は誤ってこのブローカーをタイプセットとしてレプリカセットに追加しました。

レプリカセットから4を削除します。 kafka-reassign-partitions.shの実行後、レプリカ#4を削除するための再割り当ては決して終了しません。 remove4.txtは再割り当てが貼り付けられている

{ "partitions": [ 
    { "topic": "topicname", "partition": 2, "replicas": [1,2,3] } 
], "version": 1 } 

のように見えます

kafka-reassign-partitions.sh --zookeeper myzookeeperhost:2181 --reassignment-json-file remove4.txt --execute 

kafka-reassign-partitions.sh --zookeeper myzookeeperhost:2181 --reassignment-json-file remove4.txt --verify 
Status of partition reassignment: 
Reassignment of partition [topicname,10] is still in progress 

私は、コントローラのログをチェックし、それが再割り当てコマンドが取り上げられたように見えますが、何もその後起こる:

[2017-08-01 06:46:07,653] DEBUG [PartitionsReassignedListener on 101 (the controller broker)]: Partitions reassigned listener fired for path /admin/reassign_partitions. Record partitions to be reassigned {"version":1,"partitions":[{"topic":"topicname","partition":10,"replicas":[1,2,3]}]} (kafka.controller.PartitionsReassignedListener) 

私が間違っていることに関するアイデアはありますか?レプリカセットからブローカ#4を削除する方法は? update:私はkafkaを実行しています。

答えて

1

この問題は、(あなたのケース4で)追加されたブローカーIDを持つ新しいブローカーをスピンアップすることで解決できました。

Kafka Quickstartガイドには、特定のIDを持つブローカーをスピンアップする方法が示されています。あなたは、ID 4を使用してノードを起動したら、実行:あなたはとても似ISR列にすべてのレプリカであることを確認する必要があり

./bin/kafka-topics.sh --zookeeper localhost:2181 --topic badbrokertest --describe 

Topic:badbrokertest PartitionCount:3 ReplicationFactor:3 Configs: 
Topic: badbrokertest Partition: 0 Leader: 1 Replicas: 1,2,3 Isr: 1,2,3 
Topic: badbrokertest Partition: 1 Leader: 1 Replicas: 1,2,3 Isr: 1,2,3 
Topic: badbrokertest Partition: 2 Leader: 1 Replicas: 1,2,3,4 Isr: 1,2,3,4 

は、今すぐあなたのパーティションを再割り当てすることができます! badbroker2.jsonは、次のようになります

./bin/kafka-reassign-partitions.sh --reassignment-json-file badbroker2.json --zookeeper localhost:2181 

:あなたが不足しているブローカーを追加することで、すべてのレプリカをsync'dしたら

{ 
    "version":1, 
    "partitions":[ 
     {"topic":"badbrokertest","partition":0,"replicas":[1,2,3]}, 
     {"topic":"badbrokertest","partition":1,"replicas":[1,2,3]}, 
     {"topic":"badbrokertest","partition":2,"replicas":[1,2,3]} 
    ] 
} 

だから要するに、あなたが不要なブローカーを削除することができます。

複数のサーバーで作業している場合は、他のブローカーが一時ブローカーを利用できるように、設定内にリスナーフィールドを設定してください。クイックスタートガイドでは、このケースは考慮していません。

listeners=PLAINTEXT://10.9.1.42:9093 
+1

ありがとうございましたニック! また、存在しないレプリカフォロワーを使用してインスタンスをスピンアップすることで、私の問題を解決しました。 Kafkaが明確にクラスターにないホスト(飼い主に登録されていないホスト)を削除できる代わりに、これを行う必要があることは残念です。 – pl0u

関連する問題