【问题标题】:What are the rules for naming Kafka topics (0.9)?命名 Kafka 主题(0.9)的规则是什么?
【发布时间】:2016-11-13 17:53:47
【问题描述】:

比如,哪些字符是不允许的?我似乎在任何地方都找不到这个。

需要这个来实现正确的错误检查。谢谢!

【问题讨论】:

标签: apache-kafka


【解决方案1】:

查看source,它看起来像ASCII 字母数字,._- 是主题名称中的有效字符。

【讨论】:

    【解决方案2】:

    这可能很有用。

    当您执行 --create 命令并使用错误的主题名称时,kafka 命令行会抛出错误,主题名称要求有效:

    命令:

    [hduser@node1 ~]$  kafka-topics --zookeeper node1:2181 --create --topic time#test --partitions 1 --replication-factor 1
    

    错误:

    Error while executing topic command : topic name time#test is illegal, 
    contains a character other than ASCII alphanumerics, '.', '_' and '-'
    [2016-07-13 23:31:02,513] ERROR org.apache.kafka.common.errors.InvalidTopicException: 
    topic name time#test is illegal, 
    contains a character other than ASCII alphanumerics, '.', '_' and '-'
    (kafka.admin.TopicCommand$)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-29
      • 1970-01-01
      • 2016-08-31
      • 2012-05-30
      相关资源
      最近更新 更多