MariaDB / MySQL突然崩溃并且不会重启

时间:2015-06-10 00:05:15

标签: mysql drupal nginx mariadb

在过去的两周里,我的MariaDB一直在崩溃。重启会将其修复几天,然后再次发生。我计划在本周末查看原因,因为我有更多时间,但今天它崩溃了,它不会再次启动。它运行在具有单个Drupal 7安装的nginx服务器上。

这是systemctl status mariadb.service的输出:

mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled)
   Active: failed (Result: exit-code) since Tue 2015-06-09 19:54:28 EDT; 3min 58s ago
  Process: 4319 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
  Process: 4317 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
  Process: 4289 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
 Main PID: 4317 (code=exited, status=0/SUCCESS)

Jun 09 19:54:26 kp mysqld_safe[4317]: 150609 19:54:26 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Jun 09 19:54:26 kp mysqld_safe[4317]: 150609 19:54:26 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Jun 09 19:54:27 kp mysqld_safe[4317]: 150609 19:54:27 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
Jun 09 19:54:28 kp systemd[1]: mariadb.service: control process exited, code=exited status=1
Jun 09 19:54:28 kp systemd[1]: Failed to start MariaDB database server.
Jun 09 19:54:28 kp systemd[1]: Unit mariadb.service entered failed state.

这是mariadb.log的输出:

150609 20:27:56 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150609 20:27:56 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead.
150609 20:27:56 InnoDB: The InnoDB memory heap is disabled
150609 20:27:56 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150609 20:27:56 InnoDB: Compressed tables use zlib 1.2.7
150609 20:27:56 InnoDB: Using Linux native AIO
150609 20:27:56 InnoDB: Initializing buffer pool, size = 128.0M
150609 20:27:56 InnoDB: Completed initialization of buffer pool
150609 20:27:56 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 30047078369
150609 20:27:56  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...
InnoDB: Doing recovery: scanned up to log sequence number 30047078662
150609 20:27:56  InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
150609 20:27:56  InnoDB: Waiting for the background threads to start
150609 20:27:56 [ERROR] mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.

To report this bug, see http://kb.askmonty.org/en/reporting-bugs

We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

Server version: 5.5.41-MariaDB-log
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=0
max_threads=153
thread_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 466712 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x0 thread_stack 0x48000
/usr/libexec/mysqld(my_print_stacktrace+0x3d)[0x7fdab189479d]
/usr/libexec/mysqld(handle_fatal_signal+0x515)[0x7fdab14aa475]
/lib64/libpthread.so.0(+0xf130)[0x7fdab0bda130]
/usr/libexec/mysqld(+0x64e387)[0x7fdab1659387]
/usr/libexec/mysqld(+0x74ac94)[0x7fdab1755c94]
/usr/libexec/mysqld(+0x73f7d5)[0x7fdab174a7d5]
/usr/libexec/mysqld(+0x64bc99)[0x7fdab1656c99]
/usr/libexec/mysqld(+0x63fc26)[0x7fdab164ac26]
/lib64/libpthread.so.0(+0x7df5)[0x7fdab0bd2df5]
/lib64/libc.so.6(clone+0x6d)[0x7fdaaf4501ad]
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
150609 20:27:57 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended

我几周没有改变网站上的任何内容,所以我不确定它为什么会崩溃,以及为什么它现在突然重启甚至重启。我已经搜遍了所有想法,上述日志都没有任何帮助。我唯一能想到的是该网站定期抓取RSS源并将记录添加到数据库中 - 这是一个非常大的数据库(几个月前我上次检查时超过500,000条记录,现在可能接近1,000,000条记录)也许它太大而且崩溃了?任何能帮助我指明正确方向的人都将不胜感激。

1 个答案:

答案 0 :(得分:1)

你没有正确地从崩溃中恢复过来。编辑你的my.cnf并强制使用innodb恢复。

添加innodb_force_recovery = 1;

您可以进一步将此数字从1增加到6,检查提供的link以查看差异。

如果您在错误日志文件中继续看到InnoDB: Waiting for the background threads to start

另外添加innodb_purge_threads = 0。

这是一个有用的link

如果这不起作用,您可以尝试TwinDB/percona_recovery_toolkit