MySQL Intermittently Fails to Initialize with Data Directory on SAN via iSCSI

When deploying applications that rely on MySQL databases over a Dell EqualLogic SAN, encountering intermittent service startup issues can be perplexing, especially when these services depend on iSCSI connections, as seen with Ubuntu Linux environments on a Dell R610. This technical guide provides a detailed exploration into troubleshooting such scenarios, focusing on server boot order, network initialization, and iSCSI connectivity.

Understanding the MySQL and iSCSI Interdependency

MySQL services that utilize an iSCSI-attached SAN for storage must ensure that the network interfaces and iSCSI connections are fully initialized before attempting to start the database service. Problems often arise when there is a delay or failure in establishing these connections, leading to MySQL failing to start due to an unavailable data directory.

Common Indicators in Logs

  • Network Initialization: Successful log entries often indicate the NIC interfaces becoming ready, highlighted by messages such as “NIC Copper Link is Up, 1000 Mbps full duplex”. These signal that basic network connectivity is established.
  • iSCSI Initiator Status: Look for logs showing the iSCSI initiator over TCP/IP being registered. Connection errors (e.g., “detected conn error (1020)”) are red flags that point to issues with the iSCSI sessions.
  • Device Detection: Upon successful iSCSI setup, there should be entries for detecting EQLOGIC devices, like “Direct-Access EQLOGIC 100E-00”. Absence of such logs suggests that the iSCSI devices were not detected, a likely cause if MySQL fails to start due to missing storage.

Root Cause Analysis

Based on the symptoms and log entries, the primary areas to inspect are the order and timing of service startups as well as network subsystem readiness:

Step 1: Verify Network and iSCSI Initialization Order

Ensure that network interfaces and iSCSI connections are prioritized to initialize before the MySQL service. Examine the /etc/network/interfaces or equivalent configuration to confirm correct setup. Also, review the iSCSI service scripts and their dependencies within /etc/init.

Step 2: Adjust MySQL Service Start Dependencies

In the MySQL upstart configuration file /etc/init/mysql.conf, check the “start on” conditions. It may be beneficial to delay MySQL startup until after network and iSCSI setup completes. For instance, consider using “start on started networking” or equivalent event signaling full network availability.

Step 3: Investigate Boot Timing and Race Conditions

Boot-time race conditions can prevent timely iSCSI connections. A practical step is to enforce a brief delay or retry mechanism in your startup scripts to ensure iSCSI targets have sufficient time to connect. Utilizing commands like sleep or custom scripting can be essential if the system starts up too quickly for the iSCSI link to stabilize.

Validation and Testing

After implementing these changes, it’s critical to test the system extensively under controlled reboots to ensure the adjustments allow consistent MySQL startup without manual intervention. Monitoring /var/log/kern.log and reviewing the timing and sequence of events can validate the success of your modifications.

For further reference and detailed configuration guides, consult the official Dell EqualLogic documentation available on [Dell TechDirect](https://www.dell.com/support/home/en-us), ensuring you align your setup with recommended practices and the latest updates.