Cleanup Zookeeper logs + easy backup/restore sentry

  1. Hi is safe to delete zookeeper logs from /var/lib/docker/volumes/sentry_onpremise_sentry-zookeeper-log/_data/version-2

    ls -lsahtr

    8.0K -rw-r–r-- 1 root root 65M Feb 16 00:19 log.cf3
    8.0K -rw-r–r-- 1 root root 65M Feb 17 00:19 log.d08
    8.0K -rw-r–r-- 1 root root 65M Feb 18 00:19 log.d1d
    8.0K -rw-r–r-- 1 root root 65M Feb 19 00:19 log.d32
    8.0K -rw-r–r-- 1 root root 65M Feb 20 00:19 log.d47
    4.0K drwxr-xr-x 2 root root 4.0K Feb 20 00:34 .
    8.0K -rw-r–r-- 1 root root 65M Feb 20 00:34 log.d5c

Lots of files there. But not sure if i can delete them or not. Whats the proper way how to cleanup zookeeper logs ?

2.I run everyday backup script

for i in sentry-data sentry-postgres sentry-redis sentry-zookeeper sentry-kafka sentry-clickhouse sentry-symbolicator; do
docker run -v $i:/volume --rm loomchild/volume-backup backup -c gz - > $BACKUP_DIR/volume-$i-$DATE.tar.gz

Is there any other (easier) way how to backup whole sentry for easy restore ?

See:
ZooKeeper Administrator's Guide
ZooKeeper Administrator's Guide

These aren’t logs in the traditional sense. They’re transaction logs and are used by Zookeeper. You should be able to delete all but the latest snapshot, but I’m not entirely sure off hand. Read the documentation. The volume here should be really low though relatively, so it shouldn’t really be a concern.

Thanks for reply, i tried to login into container and run command there. But im unlucky.

  • docker container exec -it sentry_onpremise_zookeeper_1 /bin/bash

tried code
root@24c9acfb7600:/# java -cp zookeeper.jar:log4j.jar:conf org.apache.zookeeper.server.PurgeTxnLog /var/lib/zookeeper/data /var/lib/zookeeper/log -n 10
Error: Could not find or load main class org.apache.zookeeper.server.PurgeTxnLog

but i cant find any zookeeper.jar file in whole system with

  • find / -iname “zookeeper.jar” -type f

Regarding backup/restore of Sentry, this doc should help a bit: https://develop.sentry.dev/self-hosted/backup/

I’d refrain from deleting ZooKeeper logs as @matt explained.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.