返回到文章

采纳

编辑于

kafka 节点宕机后 客户端生产或者消费报错,重启客户端线程又可以继续消费

kafka

上次按照大神要求,修正了__consumer_offsets副本数,集群部分节点宕机可正常进行生产或者消费,但是又遇到新问题 java 客户端生产或者消费数据遇到各别节点宕机遇到以下问题

 java.net.ConnectException: Connection refused: no further information
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.kafka.common.network.PlaintextTransportLayer.finishConnect(PlaintextTransportLayer.java:50)
    at org.apache.kafka.common.network.KafkaChannel.finishConnect(KafkaChannel.java:152)
    at org.apache.kafka.common.network.Selector.pollSelectionKeys(Selector.java:471)
    at org.apache.kafka.common.network.Selector.poll(Selector.java:425)
    at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:510)
    at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:271)
    at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:242)
    at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:233)
    at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.awaitMetadataUpdate(ConsumerNetworkClient.java:161)
    at org.apache.kafka.clients.consumer.internals.AbstractCoordinator.ensureCoordinatorReady(AbstractCoordinator.java:243)
    at org.apache.kafka.clients.consumer.internals.ConsumerCoordinator.poll(ConsumerCoordinator.java:314)
    at org.apache.kafka.clients.consumer.KafkaConsumer.updateAssignmentMetadataIfNeeded(KafkaConsumer.java:1218)
    at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1181)
    at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1115)
    at kafka.KafkaSource.run(KafkaSource.java:83)
    at kafka.KafkaSource.main(KafkaSource.java:146)
14:10:31,368 DEBUG NetworkClient:804 - [Consumer clientId=consumer-1, groupId=test_3] Node 0 disconnected.
14:10:31,368  WARN NetworkClient:671 - [Consumer clientId=consumer-1, groupId=test_3] Connection to node 0 could not be established. Broker may not be available.
14:10:31,369 DEBUG NetworkClient:916 - [Consumer clientId=consumer-1, groupId=test_3] Give up sending metadata request since no node is available
14:10:31,419 DEBUG NetworkClient:916 - [Consumer clientId=consumer-1, groupId=test_3] Give up sending metadata request since no node is available
14:10:31,469 DEBUG NetworkClient:916 - [Consumer clientId=consumer-1, groupId=test_3] Give up sending metadata request since no node is available
14:10:31,519 DEBUG NetworkClient:916 - [Consumer clientId=consumer-1, groupId=test_3] Give up sending metadata request since no node is available
14:10:31,569 DEBUG NetworkClient:916 - [Consumer clientId=consumer-1, groupId=test_3] Give up sending metadata request since no node is available
14:10:31,619 DEBUG NetworkClient:916 - [Consumer clientId=consumer-1, groupId=test_3] Give up sending metadata request since no node is available