gpt4 book ai didi

amazon-web-services - 如何在 AWS MSK 集群上将 auto.create.topics.enable 设置为默认配置

转载 作者:行者123 更新时间:2023-12-03 13:33:13 24 4
gpt4 key购买 nike

当生产者首次向主题发布消息时,我们的 AWS MSK 集群不会自动创建主题。这是令人惊讶的,因为根据 https://kafka.apache.org/documentation/#brokerconfigs 的默认行为应该有 auto.create.topics.enable = true .

我试图在我的代理上设置此配置,但我无法设置,因为配置是 read-only用于动态更新。

$ kafka-configs --bootstrap-server $KAFKA_BROKER --entity-type brokers --entity-default --alter --add-config auto.create.topics.enable=true

Error while executing config command with args '--bootstrap-server $KAFKA_BROKER --entity-type brokers --entity-default --alter --add-config auto.create.topics.enable=true'
java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.InvalidRequestException: Invalid config value for resource ConfigResource(type=BROKER, name=''): Cannot update these configs dynamically: Set(auto.create.topics.enable)

注意:我用 $KAFKA_BROKER 替换了我们经纪人的 IP在输出中

如何配置我的 AWS MSK Kafka 集群以启用主题的自动创建?

最佳答案

更新
您现在可以自定义 MSK configuration :

auto.create.topics.enable: Enables topic autocreation on the server.


因此, auto.create.topics.enable=true ( defaults to false ) 现在应该像往常一样做这个把戏。

旧答案
虽然 auto.create.topics.enable通常默认为 true ,AWS MSK 并非如此。根据 these slides今年 2 月在柏林的 AWS Kafka 峰会上提出,以下是 Amazon MSK 的默认配置参数:
offsets.topic.replication.factor 3
transaction.state.log.replication.factor 3
transaction.state.log.min.isr 2
auto.create.topics.enable False
default.replication.factor 3
min.insync.replicas 2
unclean.leader.election.enable True
auto.leader.rebalance.enable True
authorizer.class.name kafka.security.auth.SimpleAclAuthorizer
group.initial.rebalance.delay.ms 3000
log.retention.hours 168
请注意,即使 Kafka 文档也提到了 suggested production configuration应设置为 false .此属性似乎也无法在 MSK 上配置,因此我建议您联系 AWS 支持,或者在运行生产者之前直接使用它并创建主题。

关于amazon-web-services - 如何在 AWS MSK 集群上将 auto.create.topics.enable 设置为默认配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55865138/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com