How to set Innodb_force_recovery?
NaruZosa opened this issue · 4 comments
Hi there,
It seems my container didn't stop gracefully, which has resulted in the following error and restart loop:
[ERROR] InnoDB: Page [page id: space=0, page number=2] log sequence number 5160395 is in the future! Current system log sequence number 3981222.
[ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to https://mariadb.com/kb/en/library/innodb-recovery-modes/ for information about forcing recovery.
The mariadb knowledge base suggests setting innodb_force_recovery to 1, 2, 3 or 4 then starting MariaDB to attempt automatic repairs. How would I go about setting this for the docker container?
Not sure, would be easier restoring from a backup.
Except when the past fortnight of backups face the exact same issue. Restoring from a backup means losing a fortnight of prod data.
Only once the container was restarted did the issue occur, until then it acted like nothing was wrong.
If you create a custom config file called my.cnf and map it to /etc/my.cnf within the container, that has this within it;
innodb_force_recovery=1
Would look something like
mysql:
image: yobasystems/alpine-mariadb
environment:
MYSQL_ROOT_PASSWORD:
MYSQL_DATABASE:
MYSQL_USER:
MYSQL_PASSWORD:
expose:
- "3306"
volumes:
- /data/example/mysql:/var/lib/mysql
- /data/example/my.cnf:/etc/my.cnf
restart: always