线上环境出现的问题
版本: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)
10年积累的成都网站设计、成都做网站经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先网站制作后付款的网站建设流程,更有鼓楼免费网站建设让你可以放心的选择与我们合作。
解决方法:
修改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