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

來源:互聯網
上載者:User

標籤:already   mina   example   config   rhel6.2   cat   font   blog   int   

Multipath  

 In regular configuration of iSCSI initiator, it only has a single path torwards the target, once the path failed, the initiator will lost the connection to its target, that will lead to a single point of failure. For eliminating the backward, we can introduce the concept of multipathing , which has 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 reside 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 SwithA and SwitchB are forwarding for 2 different VLANs. 

After the established multipath, there will be 2 block devices appears in the /dev/  directory, they are just  the same device that learnt from different path

Here is an example for how 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 are the block devices:

[[email protected] ~]# ll /dev/sd*
brw-rw----. 1 root disk 8, 0 Dec 12 07:39 /dev/sda
brw-rw----. 1 root disk 8, 16 Dec 12 07:39 /dev/sdb

 

Device Mapper 

we cannot take any advantages from creating multipath alone,  without using Device-mapper, which provides ablity to handle the redundancy of multipath devices,

Here are the steps for configure a basic device mapper , please make sure you have already have multipath deivces appears in your system.

First we need to install the package of device-mapper , in many mordem Linux, this package has been installed by default, the examples here are 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 you can see , you may found below errors that telling you , it cannot find the multipath.conf , that is normal , because we need to create this file after the software has 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 | You 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 17 15:46 /etc/multipath.conf

restart the multipathd ,then you can see the device-mapper has made a fusion of these two devices

[[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 a alias that I made for it,  "1IET 00010001" is the wwid of both sda and sdb , we can name the device-mapper with anything that base on devices‘ uuid, let‘s check how 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 you can see,  actually the sda and sdb are refering 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 do many things on the mappered device ,  such as fdisk, formatting, or create LVM on it  just as a regular disk on the server.

[[email protected] ~]# ll /dev/mapper/remote_disk
lrwxrwxrwx. 1 root root 7 Dec 12 07:39 /dev/mapper/remote_disk -> ../dm-3

 

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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.