我在 Dell R610 Server 上运行 Ubuntu Linux 14.04.2。此设备用于托管我的应用程序的 MySQL 服务。MySQL 数据目录安装在 DELL SAN Equallogic 上,因此此设备也是 iSCSI 启动器。
我面临的问题是,每周当我们应用更新并重新启动服务器时,MySQL 服务都会间歇性地拒绝启动。
在 中/etc/init/mysql.conf
,MySQL upstart 作业已配置为在 启动/在 停止,如下所示:
start on runlevel [2345]
stop on starting rc RUNLEVEL=[016]
以下是 MySQL 成功启动时服务器的 /var/log/kern.log 的摘录。
[这些消息始终会被记录]
IPv6: ADDRCONF(NETDEV_CHANGE): em1: link becomes ready
Apr 27 02:07:03 DB-Box kernel: [ 14.070796] bnx2 0000:01:00.1 em2: NIC Copper Link is Up, 1000 Mbps full duplex
Apr 27 02:07:03 DB-Box kernel: [ 14.070803] , receive & transmit flow control ON
Apr 27 02:07:03 DB-Box kernel: [ 14.070885] IPv6: ADDRCONF(NETDEV_CHANGE): em2: link becomes ready
[MySQL 成功启动时会记录这些内容]
Apr 27 02:07:03 DB-Box kernel: [ 14.388522] scsi3 : iSCSI Initiator over TCP/IP
Apr 27 02:07:03 DB-Box kernel: [ 14.406089] scsi4 : iSCSI Initiator over TCP/IP
Apr 27 02:07:03 DB-Box kernel: [ 14.410710] scsi5 : iSCSI Initiator over TCP/IP
Apr 27 02:07:03 DB-Box kernel: [ 14.415547] scsi6 : iSCSI Initiator over TCP/IP
Apr 27 02:07:04 DB-Box kernel: [ 14.434132] connection1:0: detected conn error (1020)
Apr 27 02:07:04 DB-Box kernel: [ 14.445123] connection2:0: detected conn error (1020)
Apr 27 02:07:04 DB-Box kernel: [ 14.446003] connection3:0: detected conn error (1020)
Apr 27 02:07:04 DB-Box kernel: [ 14.447461] connection4:0: detected conn error (1020)
Apr 27 02:07:04 DB-Box kernel: [ 15.237897] scsi 3:0:0:0: Direct-Access EQLOGIC 100E-00 6.0 PQ: 0 ANSI: 5
Apr 27 02:07:04 DB-Box kernel: [ 15.238173] scsi 4:0:0:0: Direct-Access EQLOGIC 100E-00 6.0 PQ: 0 ANSI: 5
Apr 27 02:07:04 DB-Box kernel: [ 15.238196] sd 3:0:0:0: Attached scsi generic sg3 type 0
Apr 27 02:07:04 DB-Box kernel: [ 15.238432] sd 4:0:0:0: Attached scsi generic sg4 type 0
Apr 27 02:07:04 DB-Box kernel: [ 15.238828] scsi 5:0:0:0: Direct-Access EQLOGIC 100E-00 6.0 PQ: 0 ANSI: 5
Apr 27 02:07:04 DB-Box kernel: [ 15.239056] sd 3:0:0:0: [sdb] 1048596480 512-byte logical blocks: (536 GB/500 GiB)
Apr 27 02:07:04 DB-Box kernel: [ 15.239075] sd 4:0:0:0: [sdc] 419450880 512-byte logical blocks: (214 GB/200 GiB)
Apr 27 02:07:04 DB-Box kernel: [ 15.239101] sd 5:0:0:0: Attached scsi generic sg5 type 0
Apr 27 02:07:04 DB-Box kernel: [ 15.239496] sd 5:0:0:0: [sdd] 1048596480 512-byte logical blocks: (536 GB/500 GiB)
Apr 27 02:07:04 DB-Box kernel: [ 15.239836] scsi 6:0:0:0: Direct-Access EQLOGIC 100E-00
我观察到,以粗体标记的起始行始终会被记录。有时,当 MySQL 无法成功启动时,不会生成 iSCSI 日志。
我不知道从哪里开始我的调查。我完全搞不清楚这是否与启动顺序有关,或者我是否遗漏了什么!
编辑1:
添加更多日志记录,正如@JimNim 指出的那样
Apr 27 01:54:23 DB-Box kernel: [ 14.204031] Loading iSCSI transport class v2.0-870.
Apr 27 01:54:23 DB-Box kernel: [ 14.227691] iscsi: registered transport (tcp)
Apr 27 01:54:23 DB-Box kernel: [ 14.334826] iscsi: registered transport (iser)
Apr 27 01:54:25 DB-Box kernel: [ 15.575642] bnx2 0000:01:00.0 em1: NIC Copper Link is Up, 100 Mbps full duplex
Apr 27 01:54:25 DB-Box kernel: [ 15.575651]
Apr 27 01:54:25 DB-Box kernel: [ 15.575733] IPv6: ADDRCONF(NETDEV_CHANGE): em1: link becomes ready
Apr 27 01:54:26 DB-Box kernel: [ 16.538071] bnx2 0000:01:00.1 em2: NIC Copper Link is Up, 1000 Mbps full duplex
Apr 27 01:54:26 DB-Box kernel: [ 16.538079] , receive & transmit flow control ON
Apr 27 01:54:26 DB-Box kernel: [ 16.538161] IPv6: ADDRCONF(NETDEV_CHANGE): em2: link becomes ready
答案1
有时,iSCSI 连接可能需要更多时间才能建立,而 MySQL 服务会“领先”于 iSCSI 安装。
启动后,尝试重新启动 MySQL:如果在启动过程中它没有正确启动,但是从 shell 启动没有问题,那么确认我们有一个时间问题。
另一种可能性:您是使用主机名还是 IP 地址访问 iSCSI 挂载的?在第一种情况下,也许您遇到了 DNS 问题,导致 iSCSI 启动器无法解析目标的 IP 地址。