Fix a corrupted database
This page describes how to fix a corrupted database. Database corruption can occur when the database is stopped brutally (if the server shut down from example). This procedure is intended for users who are comfortable with MariaDB databases. If in doubt, contact Cyberwatch support.
Validate that the database is corrupted:
Inspect the logs of the database. If the database is deployed internally (the default), use the following command:
sudo cyberwatch logs db -f
If the database is corrupted, the logs could contain a line similar to:
[ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 44002250712 and the end 44002250240.
Use
root
user:sudo su
Stop cyberwatch:
cyberwatch stop
(Recommended) Backup the files of the database
With Docker Swarm:
cd /var/lib/docker/volumes/cbwonpremise_data_db/_data tar cvzf ../cyberwatch_db_$(date +%Y%m%d).tar.gz .
With MicroK8s:
cd /var/lib/volumes/cyberwatch/db tar cvzf ../cyberwatch_db_$(date +%Y%m%d).tar.gz .
Erase the content of file
ib_logfile0
::> ib_logfile0
Restart the application:
cyberwatch restart --skip-backup
If the application do not start properly, please contact Cyberwatch’s support.