记录一次MySQL自动停机的问题处理
source link: https://metmoon.com/2020/05/31/mysqld-broken/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
最近帮别人做的一个项目机器上面跑MySQL老是隔一段时间就自动停了。刚开始以为是以外停止,也没注意,就手动再启动。可是过了没两天又停止了。
后来仔细查了查 mysqld
的日志:
2020-05-27T10:15:12.569342Z 0 [System] [MY-010116] [Server] /usr/libexec/mysqld (mysqld 8.0.17) starting as process 19493 2020-05-27T10:15:14.448256Z 0 [System] [MY-010229] [Server] Starting crash recovery... 2020-05-27T10:15:14.475411Z 0 [System] [MY-010232] [Server] Crash recovery finished. 2020-05-27T10:15:14.691345Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2020-05-27T10:15:15.677386Z 0 [System] [MY-010931] [Server] /usr/libexec/mysqld: ready for connections. Version: '8.0.17' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution. 2020-05-27T10:15:15.951210Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/lib/mysql/mysqlx.sock' bind-address: '::' port: 33060 2020-05-27T11:26:19.955004Z 0 [System] [MY-010116] [Server] /usr/libexec/mysqld (mysqld 8.0.17) starting as process 19757 2020-05-27T11:26:20.181302Z 0 [ERROR] [MY-012681] [InnoDB] mmap(137363456 bytes) failed; errno 12 2020-05-27T11:26:20.181360Z 1 [ERROR] [MY-012956] [InnoDB] Cannot allocate memory for the buffer pool 2020-05-27T11:26:20.181379Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error. 2020-05-27T11:26:20.181401Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine 2020-05-27T11:26:20.181543Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed. 2020-05-27T11:26:20.183642Z 0 [ERROR] [MY-010119] [Server] Aborting 2020-05-27T11:26:20.184163Z 0 [System] [MY-010910] [Server] /usr/libexec/mysqld: Shutdown complete (mysqld 8.0.17) Source distribution.
上面显示是 Cannot allocate memory for the buffer pool
,无法分配内存给缓存池。马上想到是内存不足,这台机器是1GB的内存,还跑着 Nginx
和 PHP-FPM
。
使用 top
看了看 mysqld
占用的内存达到了48% 。内存占用还是蛮高的。
当然了升级机器配置是比较好的办法,但是毕竟经费有限。所以我们先给它加个 swap
交换空间:
dd if=/dev/zero of=/swapfile bs=1M count=2048 mkswap /swapfile swapon /swapfile systemctl restart mysqld
上面我们加了2GB的交换空间给机器。然后重启 mysqld
。再使用 top
看了看,发现交换空间渐渐被使用了。
睡了一觉起来一看, mysqld
服务没有再自动停止,内存占用已经下降到 22%
,看了看错误日志,也是空的。
嗯,看来还不错嘛。再观察个几天看看,没问题的话应该就好了:sunglasses::sunglasses::sunglasses:。
打赏
Recommend
-
9
现场问题处理记录 上周五经历了一场半夜起来处理现场问题的事,从早上1点多搞到4点多。总结一下。 遇到现场问题的时候:尽可能的保存现场很重要。打dump,查活动进程,看当前运行SQL,当前具体环境信息。在保存好现场之后可以从如下三个...
-
6
Written by arstercz - 2021-08-26 MySQL 命令无法输入中文问题处理 近期通过 mysql 命令连接 mysql server 的时候, 出现了不能输入中文的现象, 如下所示:
-
9
您现在的位置:首页 --> 网络系统 --> 一次DNS域名解析问题排查记录 一次DNS域名解析问题排查记录
-
6
记录一次服务器搭建MySQL | 问道IT 技术坑:Linux centos7 mysql navicate docker Centos7 系统安装 docker,并配置阿里云镜像加速器 先在服务器...
-
4
受制于疫情的影响,有些人不能到公司进行测试,只能把测试环境部署在自己电脑上,由于自己的电脑充满了各种意想不到的情况,所以,在这里,我记录一下非常具有参考意义的一次经历。 由于这次的焦灼点主要是 mysql 的安装,所以,这里主讲
-
5
数据中心备用电源系统,解决停机问题的标准 作者:Alan R. Earls 2022-09-01 15:47:55 备用电源对于减少或消除停机时间至关重要。 管理员可以参考行业标准、UPS 和发电机来构建支持关键组件的系统。
-
4
记录一次服务器被攻击时的处理过程 - 运维那点事 | 血衫非弧の一存
-
5
一、问题场景在线上运行的程序,有一天突然前端响应缓慢,但是后台日志依旧还在正常输出。针对这种情况,本篇博客主要是进行问题解决的过程说明。二、问题环境
-
1
zkSync官方:已解决zkSync Era网络停机问题,将发布情况报告 Neken 2023-04-01 16:30 摘要: zkSync官方:已解决zkSync Era网络停机问题,将发布情况报告...
-
6
一次服务预热问题的定位排查记录(1) 02 Nov 2023 后端 ...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK