Apache kafka 卡夫卡大消息配置
我读了很多关于配置的话题,但我还是不明白 当我这样做时:Apache kafka 卡夫卡大消息配置,apache-kafka,kafka-producer-api,Apache Kafka,Kafka Producer Api,我读了很多关于配置的话题,但我还是不明白 当我这样做时: ../kafka_2.11-1.1.0/bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic my_topic --config max.message.bytes=10000000 这很有帮助 但在我的应用程序中,a尝试了一切 def producerSettings(system: ActorSystem): ProducerSettings[String, K
../kafka_2.11-1.1.0/bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic my_topic --config max.message.bytes=10000000
这很有帮助
但在我的应用程序中,a尝试了一切
def producerSettings(system: ActorSystem): ProducerSettings[String, KafkaMessage] =
ProducerSettings(system, new StringSerializer, new GenericSerde[KafkaMessage].serializer())
.withBootstrapServers("localhost:9092")
.withProperty("auto.create.topics.enable", "true")
.withProperty("replica.fetch.max.bytes", maxSize)
.withProperty("message.max.bytes", maxSize)
val producer: KafkaProducer[String, KafkaMessage] = configuration.producerSettings(context.system)
.withBootstrapServers("localhost:" + config.getInt("kafka.port"))
.withProperty("message.max.bytes", maxSize)
.withProperty("max.request.size", maxSize)
.createKafkaProducer()
当我开始清理卡夫卡-我在日志中看到
INFO Created log for partition my_topic-0 in /tmp/kafka-logs with properties {compression.type -> producer, message.format.version ->
1.1-IV0, file.delete.delay.ms -> 60000, max.message.bytes -> 1000012, min.compaction.lag.ms -> 0, message.timestamp.type -> CreateTime, min.insync.replicas -> 1, segment.jitter.ms -> 0, preallocate -> false, min.cleanable.dirty.ratio -> 0.5, index.interval.bytes -> 4096, unclean.leader.election.enable -> false, retention.bytes -> -1, delete.retention.ms -> 86400000, cleanup.policy -> [delete], flush.ms
-> 9223372036854775807, segment.ms -> 604800000, segment.bytes -> 1073741824, retention.ms -> 604800000, message.timestamp.difference.max.ms -> 9223372036854775807, segment.index.bytes -> 10485760, flush.messages -> 9223372036854775807}. (kafka.log.LogManager)
a您可以看到max.message.bytes
->1000012仍处于默认值
我必须再次记录大消息异常
我做错了什么?我希望通过应用程序而不是控制台命令进行配置。可能吗?这可能是因为您的主题是由代理自动创建的。当使用代理的自动创建创建主题时,它使用代理的默认配置 您可以更改代理中的默认配置,即
message.max.bytes
,但我不建议这样做,因为代理配置将应用于自动创建的所有其他主题
或者,您可以使用所需的配置在应用程序中显式创建主题,这样代理就不会使用默认配置自动创建主题 这可能是因为您的主题是由代理自动创建的。当使用代理的自动创建创建主题时,它使用代理的默认配置 您可以更改代理中的默认配置,即
message.max.bytes
,但我不建议这样做,因为代理配置将应用于自动创建的所有其他主题
或者,您可以使用所需的配置在应用程序中显式创建主题,这样代理就不会使用默认配置自动创建主题 您需要在代理上设置属性,而不仅仅是生产者。。。代理配置为仅接受最大大小您需要在代理上设置属性,而不仅仅是生产者。。。代理被配置为仅接受最大大小