kafkaFailedtosendproducer-创新互联
线上环境出现的问题
版本:kafka-0.10.2.1
现象:
2017-11-29/14:45:02.937/CST wARN [kafka.utils.Logging$class.warn(Logging.scala:89)]:Failed to send producer request with correlation id 5 to broker 5 with data for partitions [mm-recommend-dev,2]
java.io.IOException: 断开的管道
at
sun.nio.ch.FileDispatcherImpl.writev0(Native Method)
at
sun.nio.ch.SocketDispatcher.writev(SocketDispatcher.java:51)
at
sun.nio.ch.IOUtil.write(IOUtil.java:148)
at
sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:524)
at java.nio.channels.SocketChannel.write(SocketChannel.java:493)
at kafka.network.BoundedByteBufferSend.writeTo(BoundedByteBufferSend.scala:56)
at kafka.network.Send$class.writeCompletely(Transmission.scala:75)
at kafka.network.BoundedByteBufferSend.writeCompletely(BoundedByteBufferSend.scala:26)
at kafka.network.BlockingChannel.send(BlockingChannel.scala:92)
at kafka.producer.SyncProducer.liftedTree1$1(SyncProducer.scala:72)
at kafka.producer.SyncProducer.kafka$producer$SyncProducer$$doSend(SyncProducer.scala:71)
at kafka.producer.SyncProducer$$anonfun$send$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(SyncProducer.scala:102)
at kafka.producer.SyncProducer$$anonfun$send$1$$anonfun$apply$mcV$sp$1.apply(SyncProducer.scala:102)
at kafka.producer.SyncProducer$$anonfun$send$1$$anonfun$apply$mcV$sp$1.apply(SyncProducer.scala:102)
at kafka.metrics.KafkaTimer.time(KafkaTimer.scala:33)
at kafka.producer.SyncProducer$$anonfun$send$1.apply$mcV$sp(SyncProducer.scala:101)
解决方法:
修改kafka broker的server.property的配置文件如下:
#加大每一条message的大值
message.max.bytes 默认为1000000 byte
调整后:
message.max.bytes=5252880
replica.fetch.max.bytes=6252880
request.timeout.ms=600000
[@zw ~]# kafka-topics.sh --alter --topic mm-recommend-dev --config max.message.bytes=5252880 --zookeeper ip:2181/kafka-0.10.2.1-test
WARNING: Altering topic configuration from this script has been deprecated and may be removed in future releases.
Going forward, please use kafka-configs.sh for this functionality
Updated config for topic "mm-recommend-dev".
新的方式
bin/kafka-configs.sh --zookeeper localhost:2181 --entity-type --alter --topic mm-recommend-dev --config max.message.bytes=5252880
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
新闻名称:kafkaFailedtosendproducer-创新互联
本文URL:http://scyanting.com/article/deijii.html