how to remaine the kafka retentions-bytes and kafka retention-segment even after kafka machine reboot [duplicate]

ぃ、小莉子 提交于 2020-08-05 07:52:45

问题


we set retention bytes value - 104857600 for topic - 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".

Now we verify the retention bytes from the zookeeper:

[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

now we performed reboot to the kafka confluent01 machine

after machines started and kafka service start successfully , we checked again the retention-bytes from zookeeper:

but now ( after machine reboot ) we can see that the retention bytes isn't configured in 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

the question is - how to remain the retention bytes even after restart of kafka machine ?

NOTE - we not want to use the retention bytes from server.properties because we set different retention bytes to each topic


回答1:


Zookeeper and Kafka default to store data in /tmp

If you reboot the machines, /tmp is cleared

Otherwise, if you use confluent start command, this is not permanent data.

If you use Docker/Kubernetes without mounting any volumes, this is also not permanent.


You sould also be using kafka-topics --describe command rather than zookeeper-shell as Zookeeper will be removed completely in upcoming Kafka releases



来源:https://stackoverflow.com/questions/63041978/how-to-remaine-the-kafka-retentions-bytes-and-kafka-retention-segment-even-after

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!