Tuesday, 27 August 2019

How to configure Multipating with iSCSI Target in centos 7



DM-Multipath stands for “Device Mapper Multipathing”. It is a basic multipating for data transferring in Linux systems. Mostly it is used for redundancy and to improve the input/output performance.
Step 1. iSCSI configuration: Follow the article “How to configure iSCSI Target and Initiator on CentOS 7” to configure iSCSI target and initiator.

Step 2. Verify iSCSI Initiator: Run the following command to verify iSCSI initiator:

[root@iscsi-initiator ~]# lsscsi
[0:0:0:0]    disk    VMware,  VMware Virtual S 1.0   /dev/sda
[2:0:0:0]    cd/dvd  NECVMWar VMware IDE CDR10 1.00  /dev/sr0
[3:0:0:0]    disk    LIO-ORG  iscsi-disk1      4.0   /dev/sdb
[root@iscsi-initiator ~]#

In the above output, the /dev/sdb is iSCSI target device mapped. The same device is used for DM-Multipath.

Step 3. Package installation: Run the following command to install DM-Multipath binary if already not installed in iSCSI-Initiator Node:

[root@iscsi-initiator ~]# yum install device-mapper-multipath
Loaded plugins: fastestmirror
………………………….
Installed:
  device-mapper-multipath.x86_64 0:0.4.9-123.el7

Dependency Installed:
  device-mapper-multipath-libs.x86_64 0:0.4.9-123.el7

Complete!
[root@iscsi-initiator ~]#

Step 4. Enabling DM-Multipath: Run the following command to enable DM-Multipath and verify the DM-Multipath module is loaded:

[root@iscsi-initiator ~]# mpathconf --enable
[root@iscsi-initiator ~]#
[root@iscsi-initiator ~]# lsmod |grep dm_multipath
dm_multipath           27792  0
dm_mod                124407  9 dm_multipath,dm_log,dm_mirror
[root@iscsi-initiator ~]#

Step 5. DM-Multipath Configuration: add the following entries in /etc/multipath.conf configuration file. By default the following lines are uncommented in the file:

[root@iscsi-initiator ~]# cat /etc/multipath.conf|grep -v "^#\|^$"
defaults {
        user_friendly_names yes
        find_multipaths yes
}
blacklist {
}
[root@iscsi-initiator ~]#

Add the following entry in blacklist section to black list local drive (Ex. operation system installed sda/hda etc.) which are not to be configured for DM-Multipating.

[root@iscsi-initiator ~]# vi /etc/multipath.conf
defaults {
        user_friendly_names yes
        find_multipaths yes
}
blacklist {
            devnode "^sd[a]$"
}
[root@iscsi-initiator ~]#

Step 6. Start DM-Multipath Service: Run the following commands to start the service and enable on startup:

[root@iscsi-initiator ~]# systemctl start multipathd
[root@iscsi-initiator ~]# systemctl enable multipathd
[root@iscsi-initiator ~]#

Step 7. Verify: Run the following command to verify the device:

[root@iscsi-initiator ~]# multipath -ll
mpatha (36001405b80de5592cd24dadad7098683) dm-2 LIO-ORG ,iscsi-disk1
size=5.0G features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
  `- 3:0:0:0 sdb 8:16 active ready running
[root@iscsi-initiator ~]#

DM-Multipating basic configuration is done and now the iSCSI target device iscsi-disk1 is mapped to sdb and ready to use. Thanks!!!

2 comments: