Назад | Перейти на главную страницу

Попытка восстановить файлы InnoDB после сбоя сервера без файла дампа

У меня серьезная проблема с запуском mysql (с использованием mariadb).

У меня произошел сбой сервера (и не было дампа баз данных на сервере.

После восстановления сервера я попытался вручную скопировать базы данных из старого каталога данных в новый.

Но при попытке получить доступ к базам данных или создать дамп или что-то еще, я получил сообщения о том, что таблица не существует.

Просматривая, я понял, что это связано с файлами InnoDB ib * (которые я не копировал.

Я сделал копию моего «нового» каталога данных в другом разделе, а затем переместил на его место весь старый каталог данных.

Я перезапустил mariadb с помощью служебной команды, и она сказала, что все началось нормально.

Но когда я пытался подключиться, я получал ошибку Got error: 2002: "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2 "No such file or directory")" when trying to connect

Я решил, что хочу посмотреть, в чем заключаются ошибки, и дал команду mysqld чтобы просмотреть процесс запуска и увидеть все ошибки.

Ниже представлен результат. Не знаю, в чем проблема.

$ mysqld
2017-05-09 22:45:15 140736651862976 [Note] mysqld (mysqld 10.1.23-MariaDB) starting as process 53227 ...
2017-05-09 22:45:15 140736651862976 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: The InnoDB memory heap is disabled
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: Using SSE crc32 instructions
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: Completed initialization of buffer pool
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: Highest supported file format is Barracuda.
2017-05-09 22:45:15 140736651862976 [Note] InnoDB: The log sequence numbers 40443083550 and 40443083550 in ibdata files do not match the log sequence number 40443083788 in the ib_logfiles!
2017-05-09 22:45:31 140736651862976 [Note] InnoDB: Processed 3542 .ibd/.isl files
2017-05-09 22:45:34 140736651862976 [Note] InnoDB: Restoring possible half-written data pages from the doublewrite buffer...
2017-05-09 22:45:34 140736651862976 [Note] InnoDB: Read redo log up to LSN=40443084288
InnoDB: wrong number of columns in SYS_INDEXES record
InnoDB: wrong number of columns in SYS_INDEXES record
InnoDB: wrong number of columns in SYS_INDEXES record
InnoDB: wrong number of columns in SYS_INDEXES record
InnoDB: wrong number of columns in SYS_INDEXES record
InnoDB: wrong number of columns in SYS_INDEXES record
2017-05-09 22:45:34 140736651862976 [Note] InnoDB: Creating tablespace and datafile system tables.
2017-05-09 22:45:34 140736651862976 [ERROR] InnoDB: Creation of SYS_TABLESPACES and SYS_DATAFILES has failed with error 18.  Tablespace is full. Dropping incompletely created tables.
2017-05-09 22:45:34 7fffce2423c0  InnoDB: Assertion failure in thread 140736651862976 in file dict0crea.cc line 1903
InnoDB: Failing assertion: err == DB_OUT_OF_FILE_SPACE || err == DB_TOO_MANY_CONCURRENT_TRXS
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.
170509 22:45:34 [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 https://mariadb.com/kb/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.1.23-MariaDB
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 = 467121 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 = 0x0 thread_stack 0x48400
0   mysqld                              0x0000000105ed1304 my_print_stacktrace + 60
0   mysqld                              0x00000001059cd5d8 handle_fatal_signal + 684
0   libsystem_platform.dylib            0x00007fffc54edb3a _sigtramp + 26
0   libsystem_notify.dylib              0x00007fffc54e7285 registration_node_release + 40
0   libsystem_c.dylib                   0x00007fffc5372420 abort + 129
0   mysqld                              0x0000000105d74d3a _Z40dict_create_add_tablespace_to_dictionarymPKcmS0_P5trx_tb + 0
0   mysqld                              0x0000000105e8a956 _Z34innobase_start_or_create_for_mysqlv + 7160
0   mysqld                              0x0000000105de07ed _ZL13innobase_initPv + 2996
0   mysqld                              0x00000001059ce0df _Z24ha_initialize_handlertonP13st_plugin_int + 94
0   mysqld                              0x0000000105b2d074 _ZL17plugin_initializeP11st_mem_rootP13st_plugin_intPiPPcb + 351
0   mysqld                              0x0000000105b2cdba _Z11plugin_initPiPPci + 2881
0   mysqld                              0x0000000105a74766 _ZL22init_server_componentsv + 1790
0   mysqld                              0x0000000105a72c03 _Z11mysqld_mainiPPc + 9583
0   libdyld.dylib                       0x00007fffc52de235 start + 1
0   ???                                 0x0000000000000001 0x0 + 1
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.
[1]    53227 abort      mysqld
$

В ответ на Александр Т Я сделал.

Я добавил это в my.cnf:

[mysqld]
innodb_force_recovery = 1

Вот результат:

$ mysql.server start
Starting MySQL
170509 23:26:31 mysqld_safe Logging to '/usr/local/var/mysql/Alis-iMac.local.err'.
.170509 23:26:31 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
................................. ERROR!
$

Команда mysqld ошибки тоже.

Вот хвост:

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 0x48400
0   mysqld                              0x000000010e787304 my_print_stacktrace + 60
0   mysqld                              0x000000010e2835d8 handle_fatal_signal + 684
0   libsystem_platform.dylib            0x00007fffc54edb3a _sigtramp + 26
0   libsystem_notify.dylib              0x00007fffc54e7285 registration_node_release + 40
0   libsystem_c.dylib                   0x00007fffc5372420 abort + 129
0   mysqld                              0x000000010e62ad3a _Z40dict_create_add_tablespace_to_dictionarymPKcmS0_P5trx_tb + 0
0   mysqld                              0x000000010e740956 _Z34innobase_start_or_create_for_mysqlv + 7160
0   mysqld                              0x000000010e6967ed _ZL13innobase_initPv + 2996
0   mysqld                              0x000000010e2840df _Z24ha_initialize_handlertonP13st_plugin_int + 94
0   mysqld                              0x000000010e3e3074 _ZL17plugin_initializeP11st_mem_rootP13st_plugin_intPiPPcb + 351
0   mysqld                              0x000000010e3e2dba _Z11plugin_initPiPPci + 2881
0   mysqld                              0x000000010e32a766 _ZL22init_server_componentsv + 1790
0   mysqld                              0x000000010e328c03 _Z11mysqld_mainiPPc + 9583
0   libdyld.dylib                       0x00007fffc52de235 start + 1
0   ???                                 0x0000000000000001 0x0 + 1
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.
[1]    53630 abort      mysqld