损坏的 InnoDB:仅启动 mysqld innodb_force_recovery=6

Boa*_*ius 7 mysql innodb mariadb

我正在使用 10.0.19-MariaDB-1~trusty-log 版本,我只能使用 innodb_force_recovery=6 重新启动 mysqld,我不知道为什么。

/usr/sbin/mysqld 的输出如下:

root@birdwatch:~> /usr/sbin/mysqld                                                             
151112 12:49:53 [Note] /usr/sbin/mysqld (mysqld 10.0.19-MariaDB-1~trusty) starting as process 4603 ...
151112 12:49:53 [Note] InnoDB: Using mutexes to ref count buffer pool pagesfile=hey_prova --log-output=FILE
151112 12:49:53 [Note] InnoDB: The InnoDB memory heap is disabled
151112 12:49:53 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
151112 12:49:53 [Note] InnoDB: Memory barrier is not used
151112 12:49:53 [Note] InnoDB: Compressed tables use zlib 1.2.8
151112 12:49:53 [Note] InnoDB: Using Linux native AIO
151112 12:49:53 [Note] InnoDB: Using CPU crc32 instructions
151112 12:49:53 [Note] InnoDB: Initializing buffer pool, size = 256.0M
151112 12:49:53 [Note] InnoDB: Completed initialization of buffer pool
151112 12:49:53 [Note] InnoDB: Highest supported file format is Barracuda.
151112 12:49:53 [Note] InnoDB: Log scan progressed past the checkpoint lsn 3384148
151112 12:49:53 [Note] InnoDB: Database was not shutdown normally!
151112 12:49:53 [Note] InnoDB: Starting crash recovery.
151112 12:49:53 [Note] InnoDB: Reading tablespace information from the .ibd files...
151112 12:49:53 [Note] InnoDB: Restoring possible half-written data pages 
151112 12:49:53 [Note] InnoDB: from the doublewrite buffer...
InnoDB: Doing recovery: scanned up to log sequence number 3391696
151112 12:49:53 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 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 2015-11-12 12:49:53 7f3df3bfd700  InnoDB: Assertion failure in thread 139904059168512 in file page0cur.cc line 931
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.6/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
151112 12:49:53 [ERROR] 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.

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: 10.0.19-MariaDB-1~trusty
key_buffer_size=134217728
read_buffer_size=2097152
max_used_connections=0
max_threads=102
thread_count=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 759757 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/sbin/mysqld(my_print_stacktrace+0x2e)[0x7f3e2004562e]
/usr/sbin/mysqld(handle_fatal_signal+0x457)[0x7f3e1fb845e7]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340)[0x7f3e1eb8c340]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x39)[0x7f3e1d9a5cc9]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x148)[0x7f3e1d9a90d8]
/usr/sbin/mysqld(+0x84287f)[0x7f3e1fe5587f]
/usr/sbin/mysqld(+0x827b1c)[0x7f3e1fe3ab1c]
/usr/sbin/mysqld(+0x82994f)[0x7f3e1fe3c94f]
/usr/sbin/mysqld(+0x914b0c)[0x7f3e1ff27b0c]
/usr/sbin/mysqld(+0x9614b0)[0x7f3e1ff744b0]
/usr/sbin/mysqld(+0x8aa29a)[0x7f3e1febd29a]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x8182)[0x7f3e1eb84182]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f3e1da6947d]
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)

两天前,我读了很多帖子,但没有人告诉我如何在类似情况下重新启动守护进程。

根据这篇文章:如何恢复 MySQL 的 InnoDB 损坏

如果您尝试使用超过 4 等的任何内容,您将面临进一步腐败的极端风险,这意味着您的时间和精力将白费。

这是真的??

我的主要问题是:

如何恢复所有数据并在出现任何问题时重新启动 de daemon?我想自动化这个过程以防止将来发生。

aku*_*sky 7

非零innodb_force_recovery是一个危险区域,你应该小心增加它的值。是的,6 可能会永久破坏您的数据,但是如果 MySQL 不以较低的值开始,您还有什么其他选择?此外,如果您需要启动MySQL,innodb_force_recovery数据库已经永久损坏,需要重建。除了可能罕见的情况,例如二级索引中的损坏。

无论如何,如果MySQL开始innodb_force_recovery=6继续前进,与转储数据库--order-by-primary以及可能--skip-lock-tables。然后停止 MySQL,将 datadir 移动到安全的地方并从头开始重新创建数据库。

如果 mysqldump 崩溃,则损坏对于innodb_force_recovery.

(提示 - 一张一张转储所有表,以便您可以找出导致 MySQL 崩溃的表)。

然后我会邀请你到数据恢复门户,在那里你可以上传数据库并下载回修复的 SQL 转储。如果您更喜欢 DIY,请在 GitHub 上使用相同的工具包。请参阅我们博客上其中一篇文章中的说明

免责声明:我是这两种工具的作者。