InnoDB:错误:空间头页由数据文件./ibdata1中的零字节组成 [英] InnoDB: Error: space header page consists of zero bytes in data file ./ibdata1

查看:881
本文介绍了InnoDB:错误:空间头页由数据文件./ibdata1中的零字节组成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很好的wordpress设置,但是今天服务器突然停止了加载我的网站.我登录并重新启动了centos 7 VPS.重新启动后,它没有启动MariaDB. 这是我在日志中找到的内容:

I had a perfectly fine wordpress setup, but today the server suddenly stopped loading my site. I logged in and restarted my centos 7 VPS. After the reboot it did not started the MariaDB. Here is what I found in my log:

141026 18:13:50 [Note] /usr/libexec/mysqld: Shutdown complete

141026 18:13:50 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
141026 18:14:58 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
141026 18:14:58 InnoDB: The InnoDB memory heap is disabled
141026 18:14:58 InnoDB: Mutexes and rw_locks use GCC atomic builtins
141026 18:14:58 InnoDB: Compressed tables use zlib 1.2.7
141026 18:14:58 InnoDB: Using Linux native AIO
141026 18:14:58 InnoDB: Initializing buffer pool, size = 128.0M
141026 18:14:58 InnoDB: Completed initialization of buffer pool
InnoDB: Error: space header page consists of zero bytes in data file ./ibdata1
141026 18:14:58 InnoDB: Could not open or create data files.
141026 18:14:58 InnoDB: If you tried to add new data files, and it failed here,
141026 18:14:58 InnoDB: you should now edit innodb_data_file_path in my.cnf back
141026 18:14:58 InnoDB: to what it was, and remove the new ibdata files InnoDB created
141026 18:14:58 InnoDB: in this failed attempt. InnoDB only wrote those files full of
141026 18:14:58 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
141026 18:14:58 InnoDB: remove old data files which contain your precious data!
141026 18:14:58 [ERROR] Plugin 'InnoDB' init function returned error.
141026 18:14:58 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
141026 18:14:58 [Note] Plugin 'FEEDBACK' is disabled.
141026 18:14:58 [ERROR] Unknown/unsupported storage engine: InnoDB
141026 18:14:58 [ERROR] Aborting

有人可以帮助我调查可能是什么问题吗? 现在有可能在无法启动MariaDB的情况下备份我的数据库吗?

Can someone help me investigate what could be the problem? Is there a possibility now to backup my database without being able to start MariaDB?

推荐答案

编辑:将my-innodb-heavy-4G.cnf复制到/etc/my.cnf.d,服务器启动正常.可能是由于更改binlog大小引起的.

Edit: copied my-innodb-heavy-4G.cnf to /etc/my.cnf.d and the server started fine. Probably caused by changing the binlog size.

听起来好像您更改了InnoDB缓冲区的大小,或者它已损坏.这些更改可能是在前一段时间进行的,并且仅在重新启动后才生效.

It sounds like you changed the size of your InnoDB buffer, or it became corrupted. Possible that these changes were made some time ago and just took effect when you rebooted.

绝对要先备份/var/lib/mysql中的数据-最好是整个目录.

Definitely make a backup of your data in /var/lib/mysql first - preferably the entire directory.

cp -R/var/lib/mysql/var/lib/mysql-backup

cp -R /var/lib/mysql /var/lib/mysql-backup

备份数据后,最好的第一步是还原对/etc/my.cnf文件所做的所有更改并重新启动.

With your data backed up, the best first step is to revert any changes that you made to the /etc/my.cnf file and restart.

如果那不行,或者您不知道缓冲区的大小,那么下一个可能的选择是删除InnoDB binlog文件,并让MariaDB/MySQL重新创建它们.这些文件名为/var/lib/mysql/ib_logfile{N},其中{N}是数字.

If that doesn't do it, or you don't know what the size of your buffer used to be, the next possible option is to delete the InnoDB binlog files and let MariaDB/MySQL recreate them. The files are named /var/lib/mysql/ib_logfile{N} where {N} is a number.

rm -rf/var/lib/mysql/ib_logfile *

rm -rf /var/lib/mysql/ib_logfile*

如果这不能解决问题,请尝试将以下内容添加到您的/etc/my.cnf(或您使用的任何配置文件中,当然要先备份).它应该在[innodb]部分.

If that doesn't solve the problem try adding the following to your /etc/my.cnf (or whichever config file you use, backup first of course). It should go in the [innodb] section.

innodb_buffer_pool_size        = 256M
innodb_log_file_size           = 256M
innodb_thread_concurrency      = 16
innodb_flush_log_at_trx_commit = 2
innodb_flush_method            = normal

诀窍是知道MariaDB的期望.如果上述操作没有成功,请尝试仅最后一行并设置[innodb_flush_method].

The trick is knowing what MariaDB is expecting. If you don't have success with the above try just the last line and set [innodb_flush_method].

这篇关于InnoDB:错误:空间头页由数据文件./ibdata1中的零字节组成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆