Kafka topic Schema version mismatch error - org.apache.kafka.common.protocol.types.SchemaException

Problem description:

There is error messge when run spark app using spark streaming Kafka version 0.10.0.1(https://spark.apache.org/docs/latest/streaming-kafka-0-10-integration.html) to send message to version 0.9 or 0.8 of Kafka broker.

2019-04-08 01:08:04,211 [ERROR] [kafka-producer-network-thread | producer-1]  Uncaught error in kafka producer I/O thread: 
org.apache.kafka.common.protocol.types.SchemaException: Error reading field 'brokers': Error reading field 'host': Error reading string of length 25394, only 543 bytes available
                   at org.apache.kafka.common.protocol.types.Schema.read(Schema.java:73)
                   at org.apache.kafka.clients.NetworkClient.parseResponse(NetworkClient.java:380)
                   at org.apache.kafka.clients.NetworkClient.handleCompletedReceives(NetworkClient.java:449)
                   at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:269)
                   at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:229)
                   at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:134)
                   at java.lang.Thread.run(Thread.java:745)

Root cause:

The Kafka broker version is still using version less than 0.10. Since there is big change after 0.10 that timestamp added in Schema. https://kafka.apache.org/documentation/

"

Soution:

Kafka broker should be upgrade and compatible to low version Schema format.

"1.5 Upgrading From Previous Versions

Upgrading from 0.8.x or 0.9.x to 0.10.0.0

0.10.0.0 has potential breaking changes (please review before upgrading) and possible performance impact following the upgrade. By following the recommended rolling upgrade plan below, you guarantee no downtime and no performance impact during and following the upgrade. 
Note: Because new protocols are introduced, it is important to upgrade your Kafka clusters before upgrading your clients.

Notes to clients with version 0.9.0.0: Due to a bug introduced in 0.9.0.0, clients that depend on ZooKeeper (old Scala high-level Consumer and MirrorMaker if used with the old consumer) will not work with 0.10.0.x brokers. Therefore, 0.9.0.0 clients should be upgraded to 0.9.0.1 beforebrokers are upgraded to 0.10.0.x. This step is not necessary for 0.8.X or 0.9.0.1 clients.

For a rolling upgrade:

  1. Update server.properties file on all brokers and add the following properties:Upgrade the brokers. This can be done a broker at a time by simply bringing it down, updating the code, and restarting it.
  2. Once the entire cluster is upgraded, bump the protocol version by editing inter.broker.protocol.version and setting it to 0.10.0.0. NOTE: You shouldn't touch log.message.format.version yet - this parameter should only change once all consumers have been upgraded to 0.10.0.0
  3. Restart the brokers one by one for the new protocol version to take effect.
  4. Once all consumers have been upgraded to 0.10.0, change log.message.format.version to 0.10.0 on each broker and restart them one by one.

Note: If you are willing to accept downtime, you can simply take all the brokers down, update the code and start all of them. They will start with the new protocol by default.

Note: Bumping the protocol version and restarting can be done any time after the brokers were upgraded. It does not have to be immediately after."

 

转载于:https://www.cnblogs.com/yjyyjy/p/10675495.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值