1. 程式人生 > >一次人為事故處理過程

一次人為事故處理過程

在一臺安裝了mysql的伺服器上裝mongo,就在為mongo建立了設定了密root賬號之後,準備重啟mongo服務,一不留神敲成了service mysqld stop。。。而且還快速的敲了回車。。。災難性的後果到來了

把mysql服務停掉之後,嚇一跳,連忙執行service mysqld start居然是failed

檢視mysql日誌,報錯如下:

180720 17:48:02  InnoDB: Page checksum 1575996416, prior-to-4.0.14-form checksum 1371122432
InnoDB: stored checksum 0, prior-to-4.0.14-form stored checksum 0
InnoDB: Page lsn 0 0, low 4 bytes of lsn at page end 0
InnoDB: Page number (if stored to page already) 0,
InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) 0
InnoDB: Page may be a freshly allocated page
180720 17:48:02InnoDB: Error: trying to access a stray pointer 0x80007f381d5d3ff8
InnoDB: buf pool start is at 0x7f381d5c8000, end at 0x7f381ddc8000
InnoDB: Probable reason is database corruption or memory
InnoDB: corruption. If this happens in an InnoDB database recovery, see
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-innodb-recovery.html
InnoDB: how to force recovery.
180720 17:48:02  InnoDB: Assertion failure in thread 139879072221152 in file ../../storage/innobase/include/buf0buf.ic line 264
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.1/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
09:48:02 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=8384512
read_buffer_size=131072
max_used_connections=0
max_threads=151
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 = 338336 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
/usr/libexec/mysqld(my_print_stacktrace+0x29) [0x850ca9]
/usr/libexec/mysqld(handle_fatal_signal+0x483) [0x6a4143]
/lib64/libpthread.so.0(+0xf7e0) [0x7f382227b7e0]
/lib64/libc.so.6(gsignal+0x35) [0x7f38208af495]
/lib64/libc.so.6(abort+0x175) [0x7f38208b0c75]
/usr/libexec/mysqld(page_cur_search_with_match+0x77b) [0x79855b]
/usr/libexec/mysqld(btr_cur_search_to_nth_level+0x6ea) [0x73bd9a]
/usr/libexec/mysqld(btr_pcur_open_on_user_rec+0x64) [0x7eab34]

似乎沒有什麼有用的價值,並非如其他網友遇到的磁碟滿了的狀況。

心驚膽戰的找了一個小時,最後看到一個

InnoDB: Error: trying to access a stray pointer 0x80007f381d5d3ff8
InnoDB: buf pool start is at 0x7f381d5c8000, end at 0x7f381ddc8000
InnoDB: Probable reason is database corruption or memory
InnoDB: corruption

mysql是異常退出,啟動過程中需要恢復,而恢復是根據日誌進行的,在這個過程中報錯,那就應該是日誌異常。

找到mysql資料和日誌檔案ibdata1、ib_logfile0、ib_logfile1,將其移走(mv),再次啟動mysql

well done,順利啟動

資料應該會有丟失(在stop過程中資料未儲存)