我有一个Kafka Streams应用程序,消息最高可达10MiB。我想在状态存储中保留这些消息,但是Kafka Streams无法生成内部更改日志主题:
2017-11-17 08:36:19,792 ERROR RecordCollectorImpl - task [4_5] Error sending record to topic appid-statestorename-state-store-changelog. No more offsets will be recorded for this task and the exception will eventually be thrown
org.apache.kafka.common.errors.RecordTooLargeException: The request included a message larger than the max message size the server will accept.
2017-11-17 08:36:20,583 ERROR StreamThread - stream-thread [StreamThread-1] Failed while executing StreamTask 4_5 due to flush state:
通过添加一些日志记录,内部主题的默认max.message.bytes
设置似乎是1MiB。
群集的默认max.message.bytes
设置为50MiB。
是否可以调整Kafka Streams应用程序内部主题的配置?
解决方法是启动流应用程序,让它创建主题,然后更改主题配置。但这感觉就像一个肮脏的黑客。
./kafka-topics.sh --zookeeper ... \
--alter --topic appid-statestorename-state-store-changelog \
--config max.message.bytes=10485760
答案 0 :(得分:2)
Kafka 1.0
允许通过StreamsConfig
为内部主题指定自定义主题属性。
您可以使用"topic."
为这些配置添加前缀,并可以使用TopicConfig
中定义的任何配置。
有关详细信息,请参阅原始KIP: