我在 Ubuntu 10.04 服务器上运行 MySQL,MySQL $datadir 位于 iSCSI 卷上。文件系统在 中标记为“_netdev” /etc/fstab
。系统关闭时,upstart 向 MySQL 发送 SIGTERM,然后继续关闭网络接口,而无需等待 MySQL 退出或 iSCSI 磁盘卸载或断开连接。当然,这会导致 XFS 无法干净地卸载,并且 MySQL 需要在启动时花几分钟重放 InnoDB 日志。
我不清楚从哪里入手来修复这个问题。从我读到的内容来看,upstart 应该已经足够智能,可以等待 iSCSI 文件系统卸载并断开连接,然后再关闭网络接口,尽管这并没有发生。我不知道如何告诉它还需要等待 MySQL 完全关闭。
这是关机过程中控制台显示的内容:
Broadcast message from root@mysql-a1
(unknown) at 11:19 ...
The system is going down for halt NOW!
Power button pressed
* Stopping Bacula File daemon... [ OK ]
Stopping file integrity checker: samhain.
* Running nssldap-update-ignoreusers... [ OK ]
* Stopping multipath daemon multipathd [ OK ]
* Stopping nagios-nrpe nagios-nrpe [ OK ]
* Stopping Name Service Cache Daemon nscd [ OK ]
* Stopping Postfix Mail Transport Agent postfix [ OK ]
* Stopping SSH throttling throttle-ssh [ OK ]
* Stopping puppet agent [ OK ]
* Stopping system logging syslog-ng [ OK ]
Stopping statistics collection and monitoring daemon: collectdcollectd[1210]: Exiting normally.
collectd[1210]: collectd: Stopping 15 read threads.
collectdmon[1209]: Info: collectd terminated with exit status 0
collectdmon[1209]: Info: shutting down collectdmon
.
* Asking all remaining processes to terminate... [ OK ]
* All processes ended within 1 seconds.... [ OK ]
* Deconfiguring network interfaces... [ 2884.248199] end_request: I/O error, dev dm-0, sector 5216
[ 2884.249807] end_request: I/O error, dev dm-0, sector 4192
[ 2884.817855] end_request: I/O error, dev dm-0, sector 0
[ 2884.819347] XFS (dm-0): Device dm-0: metadata write error block 0x0
[ 2884.821281] XFS (dm-0): I/O Error Detected. Shutting down filesystem
[ 2884.823393] XFS (dm-0): Please umount the filesystem and rectify the problem(s)
[ 2885.367423] end_request: I/O error, dev dm-0, sector 0
init: mysql main process (4168) terminated with status 1
[ OK ]
* Deactivating swap... [ OK ]
* Unmounting weak filesystems... [ OK ]
* Unmounting local filesystems... [ OK ]
* Disconnecting iSCSI targets [ OK ]
* Stopping iSCSI initiator service [ OK ]
* Will now halt
[ 2886.802324] Power down.
Connection to bottom.cw closed.
bottom:~ insyte$
这是 fstab 条目:
/dev/mapper/21db3d79bf30ef4846c9ce90069680087 /srv/mysql xfs _netdev,noatime,nodev,noexec 0 0
答案1
您有以下几种选择:
- 升级到精确版。该问题已修复。
- 将停止条件(在 /etc/init/mysql.conf 中)更改为
stop on starting rc RUNLEVEL=[016]
- 进入关闭网络接口的任何初始化脚本(我确信它是 sysv),并
initctl emit deconfiguring-networking
在关闭接口之前添加命令。然后,将 mysql 的停止条件更改为stop on deconfiguring-networking or runlevel [016]
中间的选项可能是最简单的。