kafka安装启动以后server.log一直报INFO Reconnect due to socket error: java.nio.channels.ClosedChannelException (kafka.consumer.SimpleConsumer错误信息,如下

[2018-06-19 09:43:29,783] INFO Reconnect due to socket error: java.nio.channels.ClosedChannelException (kafka.consumer.SimpleConsumer)
[2018-06-19 09:43:29,783] WARN [ReplicaFetcherThread-0-1], Error in fetch Name: FetchRequest; Version: 0; CorrelationId: 518500; ClientId: ReplicaFetcherThread-0-1; ReplicaId: 2; MaxWait: 500 ms; MinBytes: 1 bytes; RequestInfo: [a6,5] -> PartitionFetchInfo(0,1048576),[a6,3] -> PartitionFetchInfo(0,1048576),[a6,7] -> PartitionFetchInfo(0,1048576),[a6,1] -> PartitionFetchInfo(0,1048576),[a6,9] -> PartitionFetchInfo(0,1048576). Possible cause: java.nio.channels.ClosedChannelException (kafka.server.ReplicaFetcherThread)
[2018-06-19 09:43:29,783] INFO Reconnect due to socket error: java.nio.channels.ClosedChannelException (kafka.consumer.SimpleConsumer)
[2018-06-19 09:43:29,783] WARN [ReplicaFetcherThread-0-1], Error in fetch Name: FetchRequest; Version: 0; CorrelationId: 518501; ClientId: ReplicaFetcherThread-0-1; ReplicaId: 2; MaxWait: 500 ms; MinBytes: 1 bytes; RequestInfo: [a6,5] -> PartitionFetchInfo(0,1048576),[a6,3] -> PartitionFetchInfo(0,1048576),[a6,7] -> PartitionFetchInfo(0,1048576),[a6,1] -> PartitionFetchInfo(0,1048576),[a6,9] -> PartitionFetchInfo(0,1048576). Possible cause: java.nio.channels.ClosedChannelException (kafka.server.ReplicaFetcherThread)
[2018-06-19 09:43:29,783] INFO Reconnect due to socket error: java.nio.channels.ClosedChannelException (kafka.consumer.SimpleConsumer)
[2018-06-19 09:43:29,783] WARN [ReplicaFetcherThread-0-1], Error in fetch Name: FetchRequest; Version: 0; CorrelationId: 518502; ClientId: ReplicaFetcherThread-0-1; ReplicaId: 2; MaxWait: 500 ms; MinBytes: 1 bytes; RequestInfo: [a6,5] -> PartitionFetchInfo(0,1048576),[a6,3] -> PartitionFetchInfo(0,1048576),[a6,7] -> PartitionFetchInfo(0,1048576),[a6,1] -> PartitionFetchInfo(0,1048576),[a6,9] -> PartitionFetchInfo(0,1048576). Possible cause: java.nio.channels.ClosedChannelException (kafka.server.ReplicaFetcherThread)

原因是/etc/hosts文件里面没有添加kafka集群的机器名,

10.0.28.51 huafadb1
10.0.28.52 huafadb2

10.0.28.51    k1
10.0.28.52    k2
10.0.28.51    k3
                
10.0.28.51    z1
10.0.28.52    z2
10.0.28.51    z3

一般容易忘记前面两个主机名,huafadb1和huafadb2对应的IP,每个集群机器都添加,添加完成以后重启kafka服务即可解决。

Tags标签: kafka,集群,consumer Tags相关文章如下:

上一篇:Redis高可用方案之sentinel(哨兵集群)

下一篇:吃芒果过敏了