kafka Failed to send producer

线上环境出现的问题
版本: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

原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/196864.html

(0)
上一篇 2021年11月17日
下一篇 2021年11月17日

相关推荐

发表回复

登录后才能评论