Sunday, November 14, 2010

Multipath Installation & Configuration

Well this was very scary, since I am wokring with production system which has 300GB DB data and backups in the SAN partitions. Problem is I don't have another SAN for my backups. So I use tape disk as alternative (now you know why i am so scared). Tape backup must be taken prior to the maintenance window (its take time). You must have good preparation plan.
I need to configure my SAN switches, so one switch failure it will route from the other switch. 

First I download the HP Device Mapper Multipath Enablement Kit for HP StorageWorks Disk from HP site. And thoroughly go through the DM_Multipath document.Depending on your system architecture you must have good traffic routing plan during configuration and testing.My SAN is HP 1500MSA and OS is RHEL AS release 4 (Nahant Update 7)
Let’s begin,

1. Ensure the following RPMs bundled with the operating system distributions are installed on the system: For RHEL 4 Update 7: device-mapper-1.02.25-2.el4 or later, device-mapper-multipath-0.4.5-31.el4 or laterI had situation where, when I checked for installed rpms device-mapper-1.02.25 was installed twice (I don't know how it happened, I think this due to last OS upgrade).

# rpm -qa dev*
device-mapper-1.02.25
device-mapper-1.02.25
.....

So what I did is I upgrade the rpm to device-mapper-1.02.28-2
#rpm -Uvh device-mapper-1.02.28-2.el4.x86_64.rpm

Then I remove the rpm which didn't upgraded.
#rpm -e device-mapper-1.02.25

Then install the device-mapper-multipath-0.4.5-35.el4.x86_64.rpm also.
Finally installed rpms looks like this
# rpm -qa dev*device-mapper-multipath-0.4.5-35.el4device-mapper-1.02.28-2.el4

2. umount all SAN partitions from the host
# umount /usr/local/mysql/data -- which is our mysql data directory

3. Download HP Device Mapper Multipath Enablement Kit for HP StorageWorks Disk, which comes with template configuration file.

4. Just extract the compressed file
# cd /tmp/HPDMmultipath # tar -xvzf HPDMmultipath-4.4.1.tar.gz
# cd HPDMmultipath-4.4.1

Install the multipath setup using following command as root
# ./INSTALL

Copy template multipath configuration file to /etc/.
# cd conf
# cp multipath.conf.HPTemplate.RHEL4 /etc/multipath.conf

Restart multipath services
# /etc/init.d/multipathd restart

Create multipath devices by executing the following command:
# multipath -v0

5. My multipath.conf looks like this
# The defaults section
--------------
defaults {
udev_dir /dev
polling_interval 10
selector "round-robin 0"
path_grouping_policy failover
getuid_callout "/sbin/scsi_id -g -u -s /block/%n"
prio_callout "/bin/true"
path_checker tur
rr_min_io 100
rr_weight uniform
failback immediate
no_path_retry 12
user_friendly_names yes
bindings_file "/var/lib/multipath/bindings"
}

# For MSA A/A arrays

device {
vendor "HP"
product "MSA VOLUME*"
path_grouping_policy group_by_prio
getuid_callout "/sbin/scsi_id -g -u -s /block/%n"
path_checker tur
path_selector "round-robin 0"
prio_callout "/sbin/mpath_prio_alua /dev/%n"
rr_weight uniform
failback immediate
hardware_handler "0"
no_path_retry 18
rr_min_io 100
}
--------------


6. Configuring QLogic HBA ParametersEdit the /etc/modprobe.conf file with the following values (most of the configurations already there) as root
# options qla2xxx ql2xmaxqdepth=16 qlport_down_retry=10 ql2xloginretrycount=30 ql2xfailover=0 ql2xlbType=1 ql2xautorestore=0xa0 ConfigRequired=0
Rebuild the initrd by executing the following script as root
# /opt/hp/src/hp_qla2x00src/make_initrd
Reboot the host as root
# reboot

After the restart my scsi attached devices looks like this
--------------

Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: HP Model: MSA CONTROLLER Rev: 7.00
Type: RAID ANSI SCSI revision: 04
Host: scsi0 Channel: 00 Id: 00 Lun: 01
Vendor: HP Model: MSA VOLUME Rev: 7.00
Type: Direct-Access ANSI SCSI revision: 04
Host: scsi0 Channel: 00 Id: 00 Lun: 02
Vendor: HP Model: MSA VOLUME Rev: 7.00
Type: Direct-Access ANSI SCSI revision: 04
Host: scsi0 Channel: 00 Id: 00 Lun: 03
Vendor: HP Model: MSA VOLUME Rev: 7.00
Type: Direct-Access ANSI SCSI revision: 04
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: HP Model: MSA CONTROLLER Rev: 7.00
Type: RAID ANSI SCSI revision: 04
Host: scsi1 Channel: 00 Id: 00 Lun: 01
Vendor: HP Model: MSA VOLUME Rev: 7.00
Type: Direct-Access ANSI SCSI revision: 04
Host: scsi1 Channel: 00 Id: 00 Lun: 02
Vendor: HP Model: MSA VOLUME Rev: 7.00
Type: Direct-Access ANSI SCSI revision: 04
Host: scsi1 Channel: 00 Id: 00 Lun: 03
Vendor: HP Model: MSA VOLUME Rev: 7.00
Type: Direct-Access ANSI SCSI revision: 04

--------------
So its done.
Check as much as you can from command line and system logs in order have less impact on SAN partitions.
# /sbin/scsi_id -g -u -s
# less /var/log/messages
I have mount my backup partition (here I didn't mount mysql data directory, which was in different partition) and did some fail-over test with SAN switches.
And its successful.