kafka loses all topics on reboot

Looks like the default location for logs is in the /tmp directory which gets wiped on reboot. Change that location in the config to a more permanent location.


Go to kafka installation folder > config> server.properties

search for log.dirs in that file, change path from /tmp/logs to local directory. Restart kafka server and you will see topics created will be saved in that local folder we have changed in config file.


This happens because the tmp folder get cleared out on reboot.

To fix this issue, do the following.

Go to you kafka installation directory and search for the file server.properties. You should see a section as below

A comma separated list of directories under which to store log files
log.dirs=/tmp/kafka-logs

Change the logs.dir to something more local or a custom dir like this. log.dirs=/Users/xxx/yyy/software/confluent-5.3.1/mydata

Reboot your kafka cluster for the changes to take effect. Reboot your system and you will see the Topics are still present.

Tags:

Apache Kafka