DEV Community

Bryan Sazon
Bryan Sazon

Posted on

3 3

Cleaning up Zookeeper Logs and Snapshots

Problem

Zookeeper’s logs and snapshots are mostly responsible for its high disk usage. If your team makes use of these snapshots for specific purposes, it makes sense to back them up using your tool of preference.

My team uses ClickHouse and it uses Zookeeper for replication. So in our case, we don't need to keep snapshots.

Solution

To clean up manually, all you have to do is run the cleanup script.

# Go to wherever zookeeper bin is installed in your server
cd /opt/zookeeper/bin 

# Run the script
./zkCleanup.sh -n 10

Where 10 is the number of old snaps/logs you want to keep, the value should be greater than or equal to 3.

Repeat the completed steps to all the Zookeeper replica server.

See the script for reference.

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay