首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MySQL一直在崩溃

问MySQL一直在崩溃
EN

Server Fault用户
提问于 2015-05-12 11:09:25
回答 3查看 2.4K关注 0票数 2

所以,几周前,我在墨尔本带来了一台新的CentOS专用服务器,不过,除了我得到的攻击者数量之外,MySQL数据库似乎也有问题,或者是一个正在使用的软件,因为它一直在崩溃和干燥。

我已经翻阅过原木,不知道它会崩溃的任何原因,但我想知道是否有人能帮我解决这个问题。

日志文件的最后一部分:

代码语言:javascript
复制
 150512 06:15:02 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
150512 06:20:02 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150512  6:20:02 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
150512  6:20:02 [Note] Plugin 'FEDERATED' is disabled.
150512  6:20:02 InnoDB: The InnoDB memory heap is disabled
150512  6:20:02 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150512  6:20:02 InnoDB: Compressed tables use zlib 1.2.3
150512  6:20:02 InnoDB: Using Linux native AIO
150512  6:20:02 InnoDB: Initializing buffer pool, size = 128.0M
150512  6:20:02 InnoDB: Completed initialization of buffer pool
150512  6:20:02 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!
150512  6:20:02  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...
150512 06:20:02 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
150512 06:25:02 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150512  6:25:02 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
150512  6:25:02 [Note] Plugin 'FEDERATED' is disabled.
150512  6:25:02 InnoDB: The InnoDB memory heap is disabled
150512  6:25:02 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150512  6:25:02 InnoDB: Compressed tables use zlib 1.2.3
150512  6:25:02 InnoDB: Using Linux native AIO
150512  6:25:02 InnoDB: Initializing buffer pool, size = 128.0M
150512  6:25:02 InnoDB: Completed initialization of buffer pool
150512  6:25:02 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!
150512  6:25:02  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...
150512 06:25:03 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
150512 06:30:01 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150512  6:30:01 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
150512  6:30:01 [Note] Plugin 'FEDERATED' is disabled.
150512  6:30:01 InnoDB: The InnoDB memory heap is disabled
150512  6:30:01 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150512  6:30:01 InnoDB: Compressed tables use zlib 1.2.3
150512  6:30:01 InnoDB: Using Linux native AIO
150512  6:30:01 InnoDB: Initializing buffer pool, size = 128.0M
150512  6:30:01 InnoDB: Completed initialization of buffer pool
150512  6:30:01 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!
150512  6:30:01  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...
150512  6:30:01  InnoDB: Waiting for the background threads to start
150512  6:30:02 InnoDB: 5.5.41 started; log sequence number 68534366
150512  6:30:02 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
150512  6:30:02 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
150512  6:30:02 [Note] Server socket created on IP: '0.0.0.0'.
150512  6:30:02 [Note] Event Scheduler: Loaded 0 events
150512  6:30:02 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.41'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL) by Remi
150512 06:42:37 mysqld_safe Number of processes running now: 0
150512 06:42:37 mysqld_safe mysqld restarted
150512  6:42:37 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
150512  6:42:37 [Note] Plugin 'FEDERATED' is disabled.
150512  6:42:37 InnoDB: The InnoDB memory heap is disabled
150512  6:42:37 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150512  6:42:37 InnoDB: Compressed tables use zlib 1.2.3
150512  6:42:37 InnoDB: Using Linux native AIO
150512  6:42:37 InnoDB: Initializing buffer pool, size = 128.0M
150512  6:42:37 InnoDB: Completed initialization of buffer pool
150512  6:42:37 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!
150512  6:42:37  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...
150512  6:42:37  InnoDB: Waiting for the background threads to start
150512 06:42:37 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
150512 06:45:02 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150512  6:45:02 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
150512  6:45:02 [Note] Plugin 'FEDERATED' is disabled.
150512  6:45:02 InnoDB: The InnoDB memory heap is disabled
150512  6:45:02 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150512  6:45:02 InnoDB: Compressed tables use zlib 1.2.3
150512  6:45:02 InnoDB: Using Linux native AIO
150512  6:45:02 InnoDB: Initializing buffer pool, size = 128.0M
150512  6:45:02 InnoDB: Completed initialization of buffer pool
150512  6:45:02 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!
150512  6:45:02  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...
150512  6:45:02  InnoDB: Waiting for the background threads to start
150512  6:45:03 InnoDB: 5.5.41 started; log sequence number 68578838
150512  6:45:03 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
150512  6:45:03 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
150512  6:45:03 [Note] Server socket created on IP: '0.0.0.0'.
150512  6:45:03 [Note] Event Scheduler: Loaded 0 events
150512  6:45:03 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.41'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL \

服务器正在运行以下操作:

CentOS 6 vestaCP MySQL5.5.4邮件服务器

EN

回答 3

Server Fault用户

发布于 2015-05-25 17:14:16

看起来你的日志被破坏了。尝试重新创建InnoDB日志文件,方法是将现有的ib_logfile(s)移开并重新启动MySQL。如果这样做不起作用,您可能会有一些数据损坏。

票数 0
EN

Server Fault用户

发布于 2019-10-01 13:29:05

这是个老问题,但这个答案对其他人来说是有用的.

“突然”MySQL/MariaDB崩溃的一个常见原因是内核OOM杀手 --基本上,如果机器缺少RAM,内核就会扼杀最消耗内存的进程。

内核OOM杀手是部分可配置的,因此应该能够“保护”一个重要的过程。然而,真正的解决办法是理解机器为什么面临内存不足的情况;最常见的原因是:

  • 没有或没有配置足够的交换空间;
  • 某些应用程序中的内存泄漏;
  • 配置不良的数据库(es:太大的InnoDB缓冲区);
  • 内存对于实际工作负载来说太少了。
票数 0
EN

Server Fault用户

发布于 2015-05-12 14:06:55

代码语言:javascript
复制
InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery
  1. 每当数据库崩溃,我们就会得到这个。Innodb机制试图自发地恢复。使用诺姆b_力_回收强制InnoDB存储引擎启动
  2. 如果同时定期发生这种情况,请检查是否触发了任何cron或logrotation (/etc/logrotate.d/mysql)。
  3. 检查您是否内存不足。如果Apache或其他进程也运行在同一台服务器上,那么您可能需要更多内存。检查交换cat /proc/swaps在这种情况下是否考虑到添加交换的情况
  • 如果使用MySQL重新启动innodb_force_recovery,则转储损坏的数据库。mysqldump -u root -p –all-databases > all_dbs.sql
  • 转储后,关闭MySQL,将ib*文件从/var/lib/mysql/目录中移动。mkdir /var/lib/ib_files/ mv /var/lib/mysql/ib* /var/lib/ib_files/
  • 然后从/etc/my.cnf中删除‘innodb_force_recovery’并启动MySQL。如果有任何错误,请检查mysqld.log。完成干净的MySQL启动后,从转储mysql -u root -p < all_dbs.sql还原数据库。
  • 一旦恢复完成,运行数据库修复,只需确保一切都完好无损:mysqlcheck –all-databases –repair
  • 修复后,再次重新启动mysql service mysql restart
票数 -1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/691390

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档