这是我第一次遇到这个特殊问题,因此寻求一些帮助来解决它。
我为我的 Laravel 11 项目运行了一个运行 MariaDB 的 Centos 9 Stream 服务器,几个小时前数据库离线了,我无法重新启动 mariadb。检查日志后,/var/log/maraidb/mariadb.log
它提到了与“损坏的页面标识符”有关的事情,我应该设置innodb_force_recovery=1
我继续进行此操作并设置了以下内容/etc/my.cnf
并运行systemctl daemon-reload
innodb_force_recovery=1
然后我就可以启动 mariadb 了。我将其设置为1几分钟,然后尝试将其注释掉并重新启动 mariadb,这样似乎没问题?
我该怎么办?担心这种情况再次发生?
设置innodb_force_recovery
真的能解决问题吗?
这是发生此情况之前的日志输出:
2024-11-03 8:43:58 0 [Note] Starting MariaDB 10.11.6-MariaDB source revision fecd78b83785d5ae96f2c6ff340375be803cd299 as process 10029
2024-11-03 8:43:58 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2024-11-03 8:43:58 0 [Note] InnoDB: Number of transaction pools: 1
2024-11-03 8:43:58 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2024-11-03 8:43:58 0 [Note] InnoDB: Using Linux native AIO
2024-11-03 8:43:58 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
2024-11-03 8:43:58 0 [Note] InnoDB: Completed initialization of buffer pool
2024-11-03 8:43:58 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
2024-11-03 8:43:58 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=3177494355512
2024-11-03 8:43:58 0 [Note] InnoDB: Multi-batch recovery needed at LSN 3177535143735
2024-11-03 8:43:58 0 [ERROR] InnoDB: Corrupted page identifier at 3177544786030; set innodb_force_recovery=1 to ignore the record.
2024-11-03 8:43:58 0 [Note] InnoDB: End of log at LSN=3177544786030
2024-11-03 8:43:58 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2024-11-03 8:43:58 0 [Note] InnoDB: Starting shutdown...
2024-11-03 8:43:59 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2024-11-03 8:43:59 0 [Note] Plugin 'FEEDBACK' is disabled.
2024-11-03 8:43:59 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2024-11-03 8:43:59 0 [ERROR] Aborting
2
innodb_force_recovery
?它实际上并没有解决任何问题。请参阅最后一节,Fixing Things
具体了解运行mariadb-check
就我个人而言,我在数据库中运行了隔夜脚本check <table>
,analyze <table>
并对optimize <table>
任何问题进行了适当的错误检查和记录。(注意:这种事情可能不适用于大型企业数据库等,但就我的目的而言,它工作得很好。)–
mysqlcheck -u root -p --all-databases
,所有表都显示“OK”,此外,当我将其设置innodb_force_recovery
为1 时,几分钟后我将其关闭,mariadb 重新启动时没有问题?我确实阅读了文档,是的–
|