MySQL 每 24 小时崩溃一次

MySQL 每 24 小时崩溃一次

我遇到了一个问题,MySQL 每 24 小时就会崩溃一次。

这是错误日志。

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,适用于 debian-linux-gnu (x86_64),使用 readline 6.2
  • Ubuntu 12.04 LTS

答案1

我的猜测是(基于这么多的信息,我只能盲目猜测)一个 cron 作业每天在同一时间运行,并占用大量内存,因此 Linux 会终止一些正在使用大量内存的其他进程。

检查你的日志oom-killer

你有多少 RAM?MySQL 占用多少内存?机器上还运行着什么程序?

相关内容