【发布时间】:2020-07-23 14:27:48
【问题描述】:
我们为主题设置 retention bytes 值 - 104857600 - topic_test
[root@confluent01 ~]# kafka-topics --zookeeper localhost:2181 --alter --topic topic_test --config retention.bytes=104857600
WARNING: Altering topic configuration from this script has been deprecated and may be removed in future releases.
Going forward, please use kafka-configs.sh for this functionality
Updated config for topic "topic_test".
现在我们验证来自动物园管理员的retention bytes:
[root@confluent01 ~]# zookeeper-shell confluent01:2181 get /config/topics/topic_test
Connecting to confluent1:2181
{"version":1,"config":{"retention.bytes":"104857600"}}
cZxid = 0xb30a00000038
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
ctime = Mon Jun 29 11:42:30 GMT 2020
mZxid = 0xb31100008978
mtime = Wed Jul 22 19:22:20 GMT 2020
pZxid = 0xb30a00000038
cversion = 0
dataVersion = 7
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 54
numChildren = 0
现在我们对kafka confluent01机器执行reboot
机器启动并成功启动kafka服务后,我们再次检查了来自zookeeper的retention-bytes:
但是现在(机器重启后)我们可以看到 retention bytes 没有在 zookeeper 中配置
[root@confluent01 ~]#zookeeper-shell confluent01:2181 get /config/topics/topic_test
Connecting to confluent1:2181
WATCHER::
WatchedEvent state:SyncConnected type:None path:null no retention bytes value
{"version":1,"config":{}}
cZxid = 0xb30a00000038
ctime = Mon Jun 29 11:42:30 GMT 2020
mZxid = 0xb3110000779b
mtime = Wed Jul 22 14:09:19 GMT 2020
pZxid = 0xb30a00000038
cversion = 0
dataVersion = 2
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 25
numChildren = 0
问题是 - 即使在 kafka 机器重启后如何保留retention bytes?
注意 - 我们不想使用来自 server.properties 的保留字节
因为我们为每个主题设置了不同的保留字节
【问题讨论】:
标签: apache-kafka apache-zookeeper