Multipathing for IP sans (iSCSI) and Device mapper in Linux

Source: Internet
Author: User

Multipath

In regular configuration of ISCSI initiator, it is only have a single path torwards the target, once the path failed, the Init Iator would lost the connection to their target, that would lead to a single point of failure.   For eliminating the backward, we can introduce the concept of multipathing, which have multiple paths for a single target, Only one path failed could not affect the connection between the server and target. The multipath can running in many fasions, such active-backup, Load-balance, round-robin,etc.

We can login to a same target twice through different portal in a ISCSI target node, the IP address of the portal can res IDE either in same network or different networks.

In practice, we just need to login a same target through different networks, for instance, in the picture above, the Swith A and SwitchB is forwarding for 2 different VLANs.

After the established multipath, there would be 2 block devices appears in The/dev/directory, they is just the same de Vice that learnt from different path

Here's an example-to-Configure the Multipath

[Email protected] ~]# iscsiadm-m discovery-t st-p 172.19.0.254 3260
172.19.0.254:3260,1 IQN.2017-12.COM.EXAMPLE:PP01
[Email protected] ~]# iscsiadm-m discovery-t st-p 172.18.0.254 3260
172.18.0.254:3260,1 IQN.2017-12.COM.EXAMPLE:PP01

Here is the block devices:

[Email protected] ~]# ll/dev/sd*
BRW-RW----. 1 root disk 8, 0 Dec 07:39/DEV/SDA
BRW-RW----. 1 root disk 8, Dec 07:39/dev/sdb

Device Mapper

We cannot take no advantages from creating multipath alone, without using Device-mapper, which provides ablity to handle The redundancy of multipath devices,

Here is the steps for configure a basic device mapper, please make sure and have already multipath deivces In your system.

First we need to install the "package of Device-mapper," in many Mordem Linux, "This" has been installed by default, The examples here is based on RHEL6.2

Yum-y Install Device-mapper-multipath

Then, let ' s start the multipath service

Service MULTIPATHD Start

Check the device mapper status, as can see, found below errors that telling you, it cannot find the multi Path.conf, that's normal, because we need to create this file after the software have been installed 

[Email protected] ~]# Multipath-ll
Dec 17 15:44:45 | DM multipath kernel driver not loaded
Dec 17 15:44:45 | /etc/multipath.conf does not exist, blacklisting all devices.
Dec 17 15:44:45 | A Sample multipath.conf file is located at
Dec 17 15:44:45 | /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf
Dec 17 15:44:45 | Can run/sbin/mpathconf to create or modify/etc/multipath.conf
Dec 17 15:44:45 | DM multipath kernel driver not loaded

Create a initial config for multipath

[Email protected] ~]# mpathconf--enable
[Email protected] ~]# ll/etc/multipath.conf
-RW-------. 1 root root 2612 Dec 15:46/etc/multipath.conf

Restart the MULTIPATHD, then you can see the device-mapper have made a fusion of these

[Email protected] ~]# Multipath-ll
Remote_disk (1IET 00010001) dm-3 Iet,virtual-disk
size=10g features= ' 0 ' hwhandler= ' 0 ' WP=RW
|-+-policy= ' round-robin 0 ' prio=1 status=active
| '-4:0:0:1 SDB 8:16 active ready Running
'-+-policy= ' round-robin 0 ' prio=1 status=enabled
'-5:0:0:1 SDA 8:0 active ready running

The "Remote_disk" is an alias that I made for it, "1IET 00010001" is the wwid of both SDA and SDB, we can name the device -mapper with anything this base on devices ' uuid, let's check how the configuration looks like

multipaths {
multipath {
Wwid "1IET 00010001"
Alias Remote_disk
}
}

For determine the wwid of a block device, we can use scsi_id command, as can see, actually the SDA and SDB is Referi ng to a same device.

[Email protected] ~]# SCSI_ID-GU/DEV/SDA
1iet_00010001
[Email protected] ~]# Scsi_id-gu/dev/sdb
1iet_00010001

In the end, we can does many things on the mappered device, such as Fdisk, formatting, or create LVM on it just as a reg Ular disk on the server.

[Email protected] ~]# Ll/dev/mapper/remote_disk
lrwxrwxrwx. 1 root root 7 Dec 07:39/dev/mapper/remote_disk. /dm-3

Multipathing for IP sans (iSCSI) and Device mapper in Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.