问题:
被通知mysql 无法使用,查看LOG:
2024-06-16T22:51:52.944731+08:00 0 [Note] InnoDB: Database was not shutdown normally!
2024-06-16T22:51:52.944736+08:00 0 [Note] InnoDB: Starting crash recovery.
2024-06-16T22:51:53.229415+08:00 0 [Note] InnoDB: Starting an apply batch of log records to the database...
分析:
1. 查看log:
2.减少降低innodb_buffer_pool_size 128GB 到64GB.数据库启动成功,但一直报如下错误 :
[ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html for information about forcing recovery.
更改参数试着recover,但一直报上面的错误 。
innodb_force_recovery = 1
innodb_purge_threads = 1
2.因数据库刚建,数据库备份后, 就初始化:
mysqld --initialize --user=mysql
此时数据库正常了, 不再报上述错误,因为有做了master-slave. 检查了slave ,发现也是正常。
3. 此时才正视log 一直出现的[Warning] InnoDB: Failed to allocate 138412032 bytes. errno 12,此问题是需要用到huge
[root@wlce-db01 ~]# cat /proc/meminfo|grep -i huge
AnonHugePages: 5517312 kB
ShmemHugePages: 0 kB
FileHugePages: 0 kB
HugePages_Total: 86800
HugePages_Free: 85711
HugePages_Rsvd: 33541
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 177766400 kB
至此问题解决