The*_*Guy 3 mysql innodb recovery crash
我使用mysql 5.5
我的所有表都在innoDB中。
今天我的应用程序宕机了,mysql 无法启动。
这是我的发现。
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.
170806 10:50:09 [Note] Plugin 'FEDERATED' is disabled.
170806 10:50:09 InnoDB: The InnoDB memory heap is disabled
170806 10:50:09 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170806 10:50:09 InnoDB: Compressed tables use zlib 1.2.3
170806 10:50:09 InnoDB: Using Linux native AIO
170806 10:50:09 InnoDB: Initializing buffer pool, size = 4.0G
170806 10:50:09 InnoDB: Completed initialization of buffer pool
170806 10:50:09 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!
170806 10:50:10 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...
170806 10:50:17 InnoDB: Error: page 7 log sequence number 302558359800
InnoDB: is in the future! Current system log sequence number 294192622092.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: for more information.
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: for more information.
170806 10:50:17 InnoDB: Error: page 1 log sequence number 302441785451
InnoDB: is in the future! Current system log sequence number 294192622092.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: for more information.
170806 10:50:17 InnoDB: Error: page 2 log sequence number 303029483310
InnoDB: is in the future! Current system log sequence number 294192622092.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: for more information.
170806 10:50:17 InnoDB: Error: page 4 log sequence number 302739570567
InnoDB: is in the future! Current system log sequence number 294192622092.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: for more information.
170806 10:50:17 InnoDB: Error: page 11 log sequence number 301115446423
InnoDB: is in the future! Current system log sequence number 294192622092.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: for more information.
170806 10:50:17 InnoDB: Error: page 5 log sequence number 303030219699
InnoDB: is in the future! Current system log sequence number 294192622092.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: for more information.
InnoDB: Cleaning up trx with id 15D24474E
InnoDB: Cleaning up trx with id 15D236307
InnoDB: Cleaning up trx with id 15D2360AA
InnoDB: Cleaning up trx with id 15D2359A6
170806 10:50:19 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
170806 10:50:19 [Note] - '0.0.0.0' resolves to '0.0.0.0';
170806 10:50:19 InnoDB: Assertion failure in thread 140545344018176 in file trx0purge.c line 840
InnoDB: Failing assertion: purge_sys->purge_trx_no <= purge_sys->rseg->last_trx_no
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
05:20:19 UTC - mysqld got signal 6 ;
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.
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.
key_buffer_size=7385088
read_buffer_size=131072
max_used_connections=0
read_buffer_size=131072
max_used_connections=0
max_threads=500
thread_count=0
connection_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1101118 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x0
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 = 0 thread_stack 0x40000
170806 10:50:19 [Note] Server socket created on IP: '0.0.0.0'.
/usr/sbin/mysqld(my_print_stacktrace+0x35)[0x7add75]
/usr/sbin/mysqld(handle_fatal_signal+0x4a4)[0x688cd4]
/lib64/libpthread.so.0(+0xf7e0)[0x7fd45a6667e0]
/lib64/libc.so.6(gsignal+0x35)[0x7fd45982d495]
/lib64/libc.so.6(abort+0x175)[0x7fd45982ec75]
/usr/sbin/mysqld[0x85c462]
/usr/sbin/mysqld[0x85c7e1]
/usr/sbin/mysqld[0x929f32]
/usr/sbin/mysqld[0x91e802]
/usr/sbin/mysqld[0x85b15a]
/usr/sbin/mysqld[0x8507f2]
/lib64/libpthread.so.0(+0x7aa1)[0x7fd45a65eaa1]
/lib64/libc.so.6(clone+0x6d)[0x7fd4598e3bcd]
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.
Run Code Online (Sandbox Code Playgroud)
然后我添加了innodb_force_recovery=6
,所以现在已经启动了,但是无法登录。
InnoDB: space id 22147 did not exist in memory. Retrying an open.
170806 18:19:31 InnoDB: error: space object of table 'db/tbl',
InnoDB: space id 56405 did not exist in memory. Retrying an open.
InnoDB: A new raw disk partition was initialized or
InnoDB: innodb_force_recovery is on: we do not allow
InnoDB: database modifications by the user. Shut down
InnoDB: mysqld and edit my.cnf so that newraw is replaced
InnoDB: with raw, and innodb_force_... is removed.
InnoDB: A new raw disk partition was initialized or
InnoDB: innodb_force_recovery is on: we do not allow
InnoDB: database modifications by the user. Shut down
InnoDB: mysqld and edit my.cnf so that newraw is replaced
InnoDB: with raw, and innodb_force_... is removed.
InnoDB: A new raw disk partition was initialized or
InnoDB: innodb_force_recovery is on: we do not allow
InnoDB: database modifications by the user. Shut down
InnoDB: mysqld and edit my.cnf so that newraw is replaced
InnoDB: with raw, and innodb_force_... is removed.
Run Code Online (Sandbox Code Playgroud)
如何确定导致此问题的原因以及解决方法是什么?
根据你的日志显示you have corruption in the InnoDB tablespace
。
InnoDB:InnoDB 表空间损坏。请参考InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB:关于强制恢复。
根据 MySQL文档这里Forcing InnoDB Recovery
在重新启动服务器之前,您可以将以下行添加到选项文件的 [mysqld] 部分:
[mysqld]
innodb_force_recovery = 1
Run Code Online (Sandbox Code Playgroud)
警告
仅设置
innodb_force_recovery
为大于紧急情况下的值0
,以便您可以启动InnoDB
和转储表。执行此操作之前,请确保您拥有数据库的备份副本,以备需要重新创建它时使用。4 或更大的值可能会永久损坏数据文件。innodb_force_recovery
在数据库的单独物理副本上成功测试该设置后,仅在生产服务器实例上使用4 或更大的设置。强制InnoDB
恢复时,您应该始终从该值开始innodb_force_recovery=1
,并且仅根据需要逐步增加该值。