【问题标题】:How to set auto.create.topics.enable as default config on AWS MSK cluster如何在 AWS MSK 集群上将 auto.create.topics.enable 设置为默认配置
【发布时间】:2019-09-15 19:43:32
【问题描述】:

当生产者首次向主题发布消息时,我们的 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)

注意:我在输出中将代理的 IP 替换为 $KAFKA_BROKER

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

【问题讨论】:

    标签: amazon-web-services apache-kafka aws-msk


    【解决方案1】:

    更新

    您现在可以自定义MSK configuration

    auto.create.topics.enable:在服务器上启用主题自动创建。

    因此,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

    【讨论】:

    • 请考虑从您的答案中删除旧的错误信息。我认为没有理由保留它。
    【解决方案2】:

    接下来,您现在可以通过customizing the configuration 将此参数设置为true,但默认情况下它将保持false,因为这是推荐的生产配置。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-01-13
      • 2021-11-23
      • 2019-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多