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.

  1. 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.
  2. Use root user:

    sudo su
  3. Stop cyberwatch:

    cyberwatch stop
  4. (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 .
  5. Erase the content of file ib_logfile0:

     :> ib_logfile0
  6. Restart the application:

     cyberwatch restart --skip-backup

If the application do not start properly, please contact Cyberwatch’s support.

External sources

Back to top