2017-07-25 16 views
1

私は3人のブローカーバージョン0.10.2.1を持つマラソン/メソスによって管理されるカフカクラスターを持っています。ドッカー画像はwurstmeister/kafka-dockerに基づいています。起動時に自動的に順番に割り当てられるbroker.id=-1とリーダーは、自動再平衡auto.leader.rebalance.enable=trueです。クライアントはバージョン0.8.2.1です。ブローカーが削除された後にKafkaパーティションリーダーが更新されない

飼育係の設定:

➜ zkCli -server zookeeper.example.com:2181 ls /brokers/ids 
[1106, 1105, 1104] 

➜ zkCli -server zookeeper.example.com:2181 get /brokers/ids/1104 
{"listener_security_protocol_map":{"PLAINTEXT":"PLAINTEXT"}, 
"endpoints":["PLAINTEXT://host1.mesos-slave.example.com:9092"], 
"jmx_port":9999,"host":"host1.mesos-slave.example.com", 
"timestamp":"1500987386409", 
"port":9092,"version":4} 

➜ zkCli -server zookeeper.example.com:2181 get /brokers/ids/1105 
{"listener_security_protocol_map":{"PLAINTEXT":"PLAINTEXT"}, 
"endpoints":["PLAINTEXT://host2.mesos-slave.example.com:9092"], 
"jmx_port":9999,"host":"host2.mesos-slave.example.com", 
"timestamp":"1500987390304", 
"port":9092,"version":4} 

➜ zkCli -server zookeeper.example.com:2181 get /brokers/ids/1106 
{"listener_security_protocol_map":{"PLAINTEXT":"PLAINTEXT"}, 
"endpoints":["PLAINTEXT://host3.mesos-slave.example.com:9092"], 
"jmx_port":9999,"host":"host3.mesos-slave.example.com", 
"timestamp":"1500987390447","port":9092,"version":4} 

➜ bin/kafka-topics.sh --zookeeper zookeeper.example.com:2181 --create --topic test-topic --partitions 2 --replication-factor 2 
Created topic "test-topic". 

➜ bin/kafka-topics.sh --zookeeper zookeeper.example.com:2181 --describe --topic test-topic 
Topic:test-topic PartitionCount:2  ReplicationFactor:2  Configs: 
     Topic: test-topic Partition: 0 Leader: 1106 Replicas: 1106,1104  Isr: 1106 
     Topic: test-topic Partition: 1 Leader: 1105 Replicas: 1104,1105  Isr: 1105 

消費者は生産者が出力しているものを消費することができます。

➜ /opt/kafka_2.10-0.8.2.1 bin/kafka-console-producer.sh --broker-list 10.0.1.3:9092,10.0.1.1:9092 --topic test-topic 
[2017-07-25 12:57:17,760] WARN Property topic is not valid (kafka.utils.VerifiableProperties) 
hello 1 
hello 2 
hello 3 
... 

➜ /opt/kafka_2.10-0.8.2.1 bin/kafka-console-consumer.sh --zookeeper zookeeper.example.com:2181 --topic test-topic --from-beginning 
hello 1 
hello 2 
hello 3 
... 

その後1104年と1105年(host1とhost2の)が出て行くと、別の1がオンラインに来ている、1107(ホスト1)ブローカー、手動マラソンインタフェースを使用して

➜ zkCli -server zookeeper.example.com:2181 ls /brokers/ids 
[1107, 1106] 

➜ zkCli -server zookeeper.example.com:2181 get /brokers/ids/1107 
{"listener_security_protocol_map":{"PLAINTEXT":"PLAINTEXT"}, 
"endpoints":["PLAINTEXT://host1.mesos-slave.example.com:9092"], 
"jmx_port":9999,"host":"host1.mesos-slave.example.com", 
"timestamp":"1500991298225","port":9092,"version":4} 

消費者は依然として生産者からのメッセージを取得しますしかしトピックの説明は、古くなって見えます:

Topic:test-topic PartitionCount:2  ReplicationFactor:2  Configs: 
     Topic: test-topic Partition: 0 Leader: 1106 Replicas: 1106,1104  Isr: 1106 
     Topic: test-topic Partition: 1 Leader: 1105 Replicas: 1104,1105  Isr: 1105 

は私がkafka-preferred-replica-election.shkafka-reassign-partitions.shリバランスみました。

➜ $cat all_partitions.json 
{ 
    "version":1, 
    "partitions":[ 
    {"topic":"test-topic","partition":0,"replicas":[1106,1107]}, 
    {"topic":"test-topic","partition":1,"replicas":[1107,1106]} 
    ] 
} 

➜ bin/kafka-reassign-partitions.sh --zookeeper zookeeper.example.com:2181 --reassignment-json-file all_partitions.json --execute 

➜ bin/kafka-reassign-partitions.sh --zookeeper zookeeper.example.com:2181 --reassignment-json-file all_partitions.json --verify 

Status of partition reassignment: 
Reassignment of partition [test-topic,0] completed successfully 
Reassignment of partition [test-topic,1] is still in progress 

➜ $cat all_leaders.json 
{ 
    "partitions":[ 
    {"topic": "test-topic", "partition": 0}, 
    {"topic": "test-topic", "partition": 1} 
    ] 
} 

➜ bin/kafka-preferred-replica-election.sh --zookeeper zookeeper.example.com:2181 --path-to-json-file all_leaders.json 
Created preferred replica election path with {"version":1,"partitions":[{"topic":"test-topic","partition":0},{"topic":"test-topic","partition":1}]} 
Successfully started preferred replica election for partitions Set([test-topic,0], [test-topic,1]) 

パーティション1のパーティションリーダーはどんな意味がありません。これはまだ1105です:

➜ bin/kafka-topics.sh --zookeeper zookeeper.example.com:2181 --describe --topic test-topic 

Topic:test-topic PartitionCount:2  ReplicationFactor:2  Configs: 
     Topic: test-topic Partition: 0 Leader: 1106 Replicas: 1106,1107  Isr: 1106,1107 
     Topic: test-topic Partition: 1 Leader: 1105 Replicas: 1107,1106,1104,1105 Isr: 1105 

パーティション1は、ホスト2が生きていないですが、リーダーがまだ1105年であると考えているのはなぜ?

答えて

0

私はApache kafka 2.11と同様の問題に直面しています。パーティション数= 2、複製数= 1という3つのブローカーのクラスターがあるので、トピックのパーティションは、3つのブローカーのうち2つのブローカーに分散されました。メッセージを生成する中で、私は手動でブローカーの1つかなりの時間が経過した後、前述のパーティションのリーダーは引き続き-1と表示されました。つまり、パーティションが3番目のアクティブなブローカーに移行しなかったことです。すべてのブローカーでauto.leader.rebalance.enableをtrueに設定しました。また、Producerクライアントは、シャットダウンブローカーにあったパーティションにプロデュースしようとし続け、引き続きプロダクションに失敗しました。

関連する問題