Mysql突然无法连接,重启时命令直接卡住不动,日志有报错mmap(137363456 bytes) failed; errno 12

日志报错:

180730 17:36:44 mysqld_safe Logging to '/var/log/mysqld.log'.
180730 17:36:44 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2018-07-30 17:36:45 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-07-30 17:36:45 0 [Note] /usr/sbin/mysqld (mysqld 5.6.39-log) starting as process 1652 ...
2018-07-30 17:36:45 1652 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)

2018-07-30 17:36:45 1652 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)

2018-07-30 17:36:45 1652 [Note] Plugin 'FEDERATED' is disabled.
2018-07-30 17:36:45 1652 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-07-30 17:36:45 1652 [Note] InnoDB: The InnoDB memory heap is disabled
2018-07-30 17:36:45 1652 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-07-30 17:36:45 1652 [Note] InnoDB: Memory barrier is not used
2018-07-30 17:36:45 1652 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-07-30 17:36:45 1652 [Note] InnoDB: Using Linux native AIO
2018-07-30 17:36:45 1652 [Note] InnoDB: Using CPU crc32 instructions
2018-07-30 17:36:45 1652 [Note] InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
2018-07-30 17:36:45 1652 [ERROR] InnoDB: Cannot allocate memory for the buffer pool

2018-07-30 17:36:45 1652 [ERROR] Plugin 'InnoDB' init function returned error.
2018-07-30 17:36:45 1652 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-07-30 17:36:45 1652 [ERROR] Unknown/unsupported storage engine: InnoDB
2018-07-30 17:36:45 1652 [ERROR] Aborting

2018-07-30 17:36:45 1652 [Note] Binlog end
2018-07-30 17:36:45 1652 [Note] Shutting down plugin 'partition'

问题排查:

根据上述报错显示得知,应该是内存太小导致,一查,果然是内存不足了:

处理方法:

1、查看本机哪些应用占用内存最多,经查是php-fpm占用的最多,随后将php-fpm临时停掉,内存得到释放

2、重启mysqld服务

处理后日志状态:

180730 17:39:16 mysqld_safe Logging to '/var/log/mysqld.log'.
180730 17:39:16 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2018-07-30 17:39:16 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-07-30 17:39:16 0 [Note] /usr/sbin/mysqld (mysqld 5.6.39-log) starting as process 2349 ...
2018-07-30 17:39:16 2349 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)

2018-07-30 17:39:16 2349 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)

2018-07-30 17:39:16 2349 [Note] Plugin 'FEDERATED' is disabled.
2018-07-30 17:39:16 2349 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-07-30 17:39:16 2349 [Note] InnoDB: The InnoDB memory heap is disabled
2018-07-30 17:39:16 2349 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-07-30 17:39:16 2349 [Note] InnoDB: Memory barrier is not used
2018-07-30 17:39:16 2349 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-07-30 17:39:16 2349 [Note] InnoDB: Using Linux native AIO
2018-07-30 17:39:16 2349 [Note] InnoDB: Using CPU crc32 instructions
2018-07-30 17:39:16 2349 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-07-30 17:39:16 2349 [Note] InnoDB: Completed initialization of buffer pool
2018-07-30 17:39:16 2349 [Note] InnoDB: Highest supported file format is Barracuda.
2018-07-30 17:39:16 2349 [Note] InnoDB: The log sequence numbers 71121285861 and 71121285861 in ibdata files do not match the log sequence number 74043234530 in the ib_logfiles!
2018-07-30 17:39:16 2349 [Note] InnoDB: Database was not shutdown normally!
2018-07-30 17:39:16 2349 [Note] InnoDB: Starting crash recovery.
2018-07-30 17:39:16 2349 [Note] InnoDB: Reading tablespace information from the .ibd files...
2018-07-30 17:39:20 2349 [Note] InnoDB: Restoring possible half-written data pages 
2018-07-30 17:39:20 2349 [Note] InnoDB: from the doublewrite buffer...
InnoDB: Last MySQL binlog file position 0 592055021, file name mysqlbin-log.000114
2018-07-30 17:39:21 2349 [Note] InnoDB: 128 rollback segment(s) are active.
2018-07-30 17:39:21 2349 [Note] InnoDB: Waiting for purge to start
2018-07-30 17:39:21 2349 [Note] InnoDB: 5.6.39 started; log sequence number 74043234530
2018-07-30 17:39:21 2349 [Note] Recovering after a crash using mysqlbin-log
2018-07-30 17:39:21 2349 [Note] Starting crash recovery...
2018-07-30 17:39:21 2349 [Note] Crash recovery finished.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值