mysql 의 데이터를 NFS 로 연결해서 쓰는 분들이 있을 것이다.
구성은 이렇게
mysql 서버 --> NFS 서버(mysql 데이터)
이렇게 쓰는 경우는 별로 없으려나? 아무튼 나의 개발환경은 저렇게 구성되어 있다.
테이블 형식은 InnoDB 를 쓰고 있다.(MyISAM 형식도 같은 문제가 발생하는지는 확인하지 않았다.)
개발서버가 실수로 인해 꺼져버렸다.(Ctrl-Alt-BS ㅜㅜ , DontZap 옵션을 잊었다)
혹시나 해서 DontZap 옵션은 이렇게
Section "ServerFlags"
Option "DontZap"
EndSection
을 /etc/X11/xorg.conf 에 적어준다.
그냥 대수롭지 않게 다시 켰다.
그런데, mysql 서버가 정상실행이 되지 않았다.
로그메시지를 보니(/var/log/syslog) 잔뜩 에러메시지가 기록되어 있었다.
NFS 서버가 연결된 방식이 아니라도 마찬가지인지 확인을 해보지는 않았다.
syslog 에 기록된 메세지는 이렇다.
mysqld[6607]: InnoDB: Check that you do not already have another mysqld process
mysqld[6607]: InnoDB: using the same InnoDB data or log files.
mysqld[6607]: InnoDB: Unable to lock ./ibdata1, error: 11
mysqld[6607]: InnoDB: Check that you do not already have another mysqld process
mysqld[6607]: InnoDB: using the same InnoDB data or log files.
mysqld[6607]: InnoDB: Unable to lock ./ibdata1, error: 11
mysqld[6607]: InnoDB: Check that you do not already have another mysqld process
mysqld[6607]: InnoDB: using the same InnoDB data or log files.
mysqld[6607]: 071121 17:12:51 InnoDB: Unable to open the first data file
mysqld[6607]: InnoDB: Error in opening ./ibdata1
mysqld[6607]: 071121 17:12:51 InnoDB: Operating system error number 11 in a file operation.
mysqld[6607]: InnoDB: Error number 11 means 'Resource temporarily unavailable'.
mysqld[6607]: InnoDB: Some operating system error numbers are described at
mysqld[6607]: InnoDB: http://dev.mysql.com/doc/mysql/en/Operating_System_error_codes.html
mysqld[6607]: InnoDB: Could not open or create data files.
mysqld[6607]: InnoDB: If you tried to add new data files, and it failed here,
mysqld[6607]: InnoDB: you should now edit innodb_data_file_path in my.cnf back
mysqld[6607]: InnoDB: to what it was, and remove the new ibdata files InnoDB created
mysqld[6607]: InnoDB: in this failed attempt. InnoDB only wrote those files full of
mysqld[6607]: InnoDB: zeros, but did not yet use them in any way. But be careful: do not
mysqld[6607]: InnoDB: remove old data files which contain your precious data!
mysqld[6607]: 071121 17:12:51 [ERROR] Can't init databases
mysqld[6607]: 071121 17:12:51 [ERROR] Aborting
핵심은 바로 이 메시지
mysqld[6607]: InnoDB: Unable to lock ./ibdata1, error: 11
mysqld[6607]: InnoDB: Check that you do not already have another mysqld process
mysqld[6607]: InnoDB: using the same InnoDB data or log files.
이상하다. mysqld 가 떠 있지는 않는데.
NFS 의 버그인지, 그냥 정상적인 것인지는 모르겠다.
그렇게 mysql 서버가 crash 된 후에 다시 켜면, NFS 서버쪽의 파일이 lock 된 상태로 있는 것이었다.
NFS 서버를 다시 재 실행 해주니 정상적으로 mysqld 가 실행되었다.syslog 를 보면 다음처럼 복구한다는 메시지도 볼 수 있다.
mysqld[7030]: 071121 17:42:10 InnoDB: Database was not shut down normally!
mysqld[7030]: InnoDB: Starting crash recovery.
mysqld[7030]: InnoDB: Reading tablespace information from the .ibd files...
mysqld[7030]: InnoDB: Restoring possible half-written data pages from the doublewrite
mysqld[7030]: InnoDB: buffer...
mysqld[7030]: 071121 17:42:15 InnoDB: Starting log scan based on checkpoint at
mysqld[7030]: InnoDB: log sequence number 0 123193550.
mysqld[7030]: InnoDB: Doing recovery: scanned up to log sequence number 0 123193550
mysqld[7030]: InnoDB: Last MySQL binlog file position 0 79, file name /var/log/mysql/mysql-bin.001118
mysqld[7030]: 071121 17:42:15 InnoDB: Flushing modified pages from the buffer pool...
mysqld[7030]: 071121 17:42:16 InnoDB: Started; log sequence number 0 123193550
mysqld[7030]: /usr/sbin/mysqld: ........ Source distribution
/etc/mysql/debian-start[7063]: Checking for crashed MySQL tables.
실제 데이터도 이상이 없는지도 확인해봐야 겠다.(mysql 쪽에서 복구를 잘 해주려나?)
ps. 처음에는 안되서, 처음부터 초기세팅하고 받아놓은 dump 로 복구할까도 생각했다.
비교적 간단하게 해결했다(데이터에 이상이 있는지는 확인이 필요하다)
DB 에서 신뢰하는 것은 오직 dump 뿐.

(
0)

(
0)
댓글을 달아 주세요