MySQL每24小时崩溃一次

每个〜24小时我都会遇到一次MySQL崩溃的问题。

这是错误日志。

121205 9:42:49 [Note] Plugin 'FEDERATED' is disabled. 121205 9:42:49 InnoDB: The InnoDB memory heap is disabled 121205 9:42:49 InnoDB: Mutexes and rw_locks use GCC atomic builtins 121205 9:42:49 InnoDB: Compressed tables use zlib 1.2.3.4 121205 9:42:49 InnoDB: Initializing buffer pool, size = 512.0M 121205 9:42:49 InnoDB: Completed initialization of buffer pool 121205 9:42:49 InnoDB: highest supported file format is Barracuda. InnoDB: The log sequence number in ibdata files does not match InnoDB: the log sequence number in the ib_logfiles! 121205 9:42:49 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... 121205 9:42:49 InnoDB: Waiting for the background threads to start 121205 9:42:50 InnoDB: 1.1.8 started; log sequence number 2449055943 121205 9:42:50 [Note] Event Scheduler: Loaded 0 events 121205 9:42:50 [Note] /usr/sbin/mysqld: ready for connections. Version: '5.5.22-0ubuntu1-log' socket: '/var/run/mysqld/mysqld.sock' port: 49827 (Ubuntu) 121205 9:42:51 [ERROR] /usr/sbin/mysqld: Table './application/songs' is marked as crashed and should be repaired 121205 9:42:51 [Warning] Checking table: './application/songs' 121205 9:42:51 [ERROR] /usr/sbin/mysqld: Table './application/artists' is marked as crashed and should be repaired 121205 9:42:51 [Warning] Checking table: './application/artists' 121205 9:42:52 [ERROR] /usr/sbin/mysqld: Table './application/channels' is marked as crashed and should be repaired 121205 9:42:52 [Warning] Checking table: './application/channels' 121205 10:50:57 [Note] Plugin 'FEDERATED' is disabled. 121205 10:50:57 InnoDB: The InnoDB memory heap is disabled 121205 10:50:57 InnoDB: Mutexes and rw_locks use GCC atomic builtins 121205 10:50:57 InnoDB: Compressed tables use zlib 1.2.3.4 121205 10:50:57 InnoDB: Initializing buffer pool, size = 512.0M 121205 10:50:57 InnoDB: Completed initialization of buffer pool 121205 10:50:57 InnoDB: highest supported file format is Barracuda. InnoDB: The log sequence number in ibdata files does not match InnoDB: the log sequence number in the ib_logfiles! 121205 10:50:57 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... 121205 10:50:57 InnoDB: Waiting for the background threads to start 121205 10:50:58 InnoDB: 1.1.8 started; log sequence number 2449882518 121205 10:50:58 [Note] Event Scheduler: Loaded 0 events 121205 10:50:58 [Note] /usr/sbin/mysqld: ready for connections. Version: '5.5.22-0ubuntu1-log' socket: '/var/run/mysqld/mysqld.sock' port: 49827 (Ubuntu) 121205 10:50:59 [ERROR] /usr/sbin/mysqld: Table './application/artists' is marked as crashed and should be repaired 121205 10:50:59 [Warning] Checking table: './application/artists' 121205 10:50:59 [ERROR] /usr/sbin/mysqld: Table './application/songs' is marked as crashed and should be repaired 121205 10:50:59 [Warning] Checking table: './application/songs' 121205 10:51:00 [ERROR] /usr/sbin/mysqld: Table './application/channels' is marked as crashed and should be repaired 121205 10:51:00 [Warning] Checking table: './application/channels' 

它在10:51之后坠毁(就像在日志里)。

为什么发生这种情况?

我目前的系统

  • MySQL Ver 14.14 Distrib 5.5.22,用于使用readline 6.2的debian-linux-gnu(x86_64)
  • Ubuntu 12.04 LTS

我的猜测(这是一个黑暗的信息量),是一个cron作业每天在同一时间运行,并用尽了一堆内存,所以Linux有用地杀死了一些其他使用了很多记忆。

检查你的日志中oom-killer

你有多lessRAM? MySQL使用多less? 还有什么东西在盒子上运行?