【发布时间】:2020-09-16 05:59:23
【问题描述】:
我想将特定 Kafka 主题的 TTL 更新为 10 天。
我该怎么做?
【问题讨论】:
标签: apache-kafka
我想将特定 Kafka 主题的 TTL 更新为 10 天。
我该怎么做?
【问题讨论】:
标签: apache-kafka
你之前问过这个问题,我已经在这里回复了:Update TTL for a particular topic in kafka using Java
除非您要求使用 Kafka 工具来做到这一点? (而不是在 Java 中) 在这种情况下,有 kafka-topics.sh 命令行工具,允许您使用 --alter 选项执行此操作。
bin/kafka-topics.sh --alter --zookeeper localhost:2181 --topic test --config retention.ms=10000
因为使用 kafka-topics 脚本进行更改可能会在下一版本中删除,所以您应该使用 kafka-configs 脚本:
bin/kafka-configs.sh --zookeeper localhost:2181 --alter --entity-type topics --entity-name test --add-config retention.ms=5000
【讨论】:
kafka-topics),我得到以下异常Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 9999; nested exception is: java.net.BindException: Address already in use (Bind failed)