У меня есть кластер из 3 брокеров Kafka с коэффициентом репликации 3 для всех тем.Так как последние несколько дней я сталкиваюсь с этой проблемой, внезапно (несколько раз в день) потребители и производители застревают при получении ответа, даже когда Kafka работает на всех 3 серверах, что решается до тех пор, пока я не проверю журналы брокеров («Соединение с 0 было разорвано»).перед прочтением ответа ") и найдите узел-виновника, который равен 0 (1-й узел в данном случае), и перезапустите zookeeper и брокера на этом узле.
Согласно журналам, это происходит из-за перебалансировки.
Я уменьшаю min.insync.replicas до 2, но это не помогает.
Журналы сервера 0 (1-й узел), вызвавшие проблему в этом случае:
Member consumer-3-8e370c0e-4a21-4dec-8301-18ce6aaf71d9 in group banner has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Preparing to rebalance group banner in state PreparingRebalance with old generation 2570 (__consumer_offsets-5) (reason: removing member consumer-3-8e370c0e-4a21-4dec-8301-18ce6aaf71d9 on heartbeat expiration) (kafka.coordinator.group.GroupCoordinator)
Member consumer-4-da57dad3-6825-4a6d-ac93-82a29f72a3dc in group banner has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Member consumer-2-812b613b-3409-42e7-baf8-8b32df4e2fa4 in group banner has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Member consumer-2-d03f0417-4e0f-4ab0-90c6-12b17a6354d7 in group poster has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Preparing to rebalance group poster in state PreparingRebalance with old generation 191 (__consumer_offsets-9) (reason: removing member consumer-2-d03f0417-4e0f-4ab0-90c6-12b17a6354d7 on heartbeat expiration) (kafka.coordinator.group.GroupCoordinator)
Group poster with generation 192 is now empty (__consumer_offsets-9) (kafka.coordinator.group.GroupCoordinator)
Member rdkafka-fda5cec6-e121-4ab7-9650-83d391abc82d in group notification-test has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Stabilized group notification-test generation 436 (__consumer_offsets-20) (kafka.coordinator.group.GroupCoordinator)
Member consumer-5-eeb1b721-b52b-4b65-af70-e48a345d150f in group banner has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Member consumer-4-889659e2-3c2f-4059-bf0c-45796f824443 in group banner has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Member consumer-5-95a38999-6156-4a53-ac1f-1d51703956fd in group banner has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Group banner with generation 2571 is now empty (__consumer_offsets-5) (kafka.coordinator.group.GroupCoordinator)
Failed to write empty metadata for group poster: The group is rebalancing, so a rejoin is needed. (kafka.coordinator.group.GroupCoordinator)
Failed to write empty metadata for group banner: The group is rebalancing, so a rejoin is needed. (kafka.coordinator.group.GroupCoordinator)
Member consumer-5-e7a6af24-1f50-40cc-a593-cf8614e9d088 in group redemption has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Preparing to rebalance group redemption in state PreparingRebalance with old generation 1373 (__consumer_offsets-27) (reason: removing member consumer-5-e7a6af24-1f50-40cc-a593-cf8614e9d088 on heartbeat expiration) (kafka.coordinator.group.GroupCoordinator)
Member consumer-1-d89defb1-6637-48bc-ba16-b646c32d3849 in group redemption has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Member consumer-4-c942542b-7c54-4656-a485-410278b936ec in group redemption has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
Member consumer-3-adfb6536-2fbc-4b39-9368-56b665db2c75 in group redemption has failed, removing it from the group (kafka.coordinator.group.GroupCoordinator)
[2019-05-19 13:22
Журналы другого брокера:
java.io.IOException: Connection to 0 was disconnected before the response was read
at org.apache.kafka.clients.NetworkClientUtils.sendAndReceive(NetworkClientUtils.java:97)
at kafka.server.ReplicaFetcherBlockingSend.sendRequest(ReplicaFetcherBlockingSend.scala:97)
at kafka.server.ReplicaFetcherThread.fetchFromLeader(ReplicaFetcherThread.scala:190)
at kafka.server.AbstractFetcherThread.kafka$server$AbstractFetcherThread$$processFetchRequest(AbstractFetcherThread.scala:241)
at kafka.server.AbstractFetcherThread$$anonfun$maybeFetch$1.apply(AbstractFetcherThread.scala:130)
at kafka.server.AbstractFetcherThread$$anonfun$maybeFetch$1.apply(AbstractFetcherThread.scala:129)
at scala.Option.foreach(Option.scala:257)
at kafka.server.AbstractFetcherThread.maybeFetch(AbstractFetcherThread.scala:129)
at kafka.server.AbstractFetcherThread.doWork(AbstractFetcherThread.scala:111)
at kafka.utils.ShutdownableThread.run(ShutdownableThread.scala:82)
Журналы обслуживания потребителей:
|FAIL|rdkafka#consumer-2| [thrd:m-data-kaf006.c-14cba.internal:9092/2]: m-data-kaf006.c.internal:9092/2: 3 request(s) timed out: disconnect
Невозможно найти решение для этого.
Kafka версия: 2.1.0