美文网首页
Mysql异常解决——[Warning] InnoDB: Dif

Mysql异常解决——[Warning] InnoDB: Dif

作者: 三叉戟渔民 | 来源:发表于2020-09-09 13:35 被阅读0次

    场景

    16G 8C服务器下搭建mysql5.7
    大数据量下聚合查询几个小时未跑通,导致mysql崩溃,无法连接,无法停止

    解决

    查看日志

    [root@test log]# tail -f 100 /var/log/mysqld.log
    2020-09-08T09:00:46.639970Z 244 [Warning] InnoDB: Difficult to find free blocks in the buffer pool (1186065 search iterations)! 1186065 failed attempts to flush a page! Consider increasing the buffer pool size. It is also possible that in your Unix version fsync is very slow, or completely frozen inside the OS kernel. Then upgrading to a newer version of your operating system may help. Look at the number of fsyncs in diagnostic info below. Pending flushes (fsync) log: 0; buffer pool: 0. 99134549 OS file reads, 3547773 OS file writes, 687230 OS fsyncs. Starting InnoDB Monitor to print further diagnostics to the standard output.
    2020-09-08T09:00:46.641107Z 248 [Warning] InnoDB: Difficult to find free blocks in the buffer pool (1166575 search iterations)! 1166575 failed attempts to flush a page! Consider increasing the buffer pool size. It is also possible that in your Unix version fsync is very slow, or completely frozen inside the OS kernel. Then upgrading to a newer version of your operating system may help. Look at the number of fsyncs in diagnostic info below. Pending flushes (fsync) log: 0; buffer pool: 0. 99134549 OS file reads, 3547773 OS file writes, 687230 OS fsyncs. Starting InnoDB Monitor to print further diagnostics to the standard output.
    ......
    

    停止数据库
    1、先执行top找到pid,kill进程
    2、修改my.cnf
    修改/添加以下参数
    innodb_buffer_pool_size = 12G#缓冲池大小,一般为总内存的80%
    innodb_buffer_pool_instances = 6缓冲池实例,范围1~64
    具体参数自行参考http://www.searchdoc.cn/rdbms/mysql/dev.mysql.com/doc/refman/5.7/en/innodb-buffer-pool-optimization.com.coder114.cn.html
    配置完后保存,重启mysql服务器即可
    注:生产环境不要轻易重启!

    此外,我在执行sql时日志中监控到了如下警告
    [Note] InnoDB: page_cleaner: 1000ms intended loop took 4013ms. The settings might not be optimal. (flushed=1438 and evicted=0, during the time.)
    解决方法可以是:
    SET GLOBAL innodb_lru_scan_depth=256;

    相关文章

      网友评论

          本文标题:Mysql异常解决——[Warning] InnoDB: Dif

          本文链接:https://www.haomeiwen.com/subject/nqrjektx.html