我的印象是,在開啓同步的兩個經紀商的情況下,即使一家經紀商失敗,我的卡夫卡設置也應該繼續工作。爲什麼卡夫卡不能繼續在一個經紀人的失敗中工作?
爲了測試它,我做了一個名爲topicname的新主題。它的描述如下:
Topic:topicname PartitionCount:1 ReplicationFactor:1 Configs:
Topic: topicname Partition: 0 Leader: 0 Replicas: 0 Isr: 0
然後我跑了以下列方式producer.sh和consumer.sh:
bin/kafka-console-producer.sh --broker-list localhost:9092,localhost:9095 sync --topic topicname
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic topicname --from-beginning
直到雙方經紀正在努力,我看到了正在通過正確接收的消息消費者,但是當我通過kill
命令殺死了經紀人的一個實例時,消費者停止向我展示任何新消息。相反,它向我顯示了以下錯誤消息:
WARN [ConsumerFetcherThread-console-consumer-57116_ip-<internalipvalue>-1438604886831-603de65b-0-0], Error in fetch Name: FetchRequest; Version: 0; CorrelationId: 865; ClientId: console-consumer-57116; ReplicaId: -1; MaxWait: 100 ms; MinBytes: 1 bytes; RequestInfo: [topicname,0] -> PartitionFetchInfo(9,1048576). Possible cause: java.nio.channels.ClosedChannelException (kafka.consumer.ConsumerFetcherThread)
[2015-08-03 12:29:36,341] WARN Fetching topic metadata with correlation id 1 for topics [Set(topicname)] from broker [id:0,host:<hostname>,port:9092] failed (kafka.client.ClientUtils$)
java.nio.channels.ClosedChannelException
at kafka.network.BlockingChannel.send(BlockingChannel.scala:100)
at kafka.producer.SyncProducer.liftedTree1$1(SyncProducer.scala:73)
at kafka.producer.SyncProducer.kafka$producer$SyncProducer$$doSend(SyncProducer.scala:72)
at kafka.producer.SyncProducer.send(SyncProducer.scala:113)
at kafka.client.ClientUtils$.fetchTopicMetadata(ClientUtils.scala:58)
at kafka.client.ClientUtils$.fetchTopicMetadata(ClientUtils.scala:93)
at kafka.consumer.ConsumerFetcherManager$LeaderFinderThread.doWork(ConsumerFetcherManager.scala:66)
at kafka.utils.ShutdownableThread.run(ShutdownableThread.scala:60)
您將複製因子設置爲1,這意味着您的數據將保存在一個節點上。要複製數據集複製因子2(不能將其設置爲高於可用集羣中的代理數)。然後再試一次 – serejja
@serejja我試着將複製設置爲2.當我殺了一個經紀人時,我得到了以下錯誤:kafka.common.FailedToSendMessageException:3次嘗試後未能發送消息。' –