RHEL5 - iSCSI(十一) MPIO
iSCSI remote boot 可以透過 MPIO(multipath I/O) 來確保他的連線不會因為單一的網路斷線而失去連線,但是這功能是不是用 teaming (teaming 是一個為通過由多個網卡創建的 team,多張網卡視同一張,可以提供負載平衡 load-balancing,容錯 fault-tolerance 的功能) 一樣就可以解決了.為什麼還會用到 MPIO 這東西.

圖片出自於 http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/DM_Multipath/index.html
關於這一點在 Intel 的官方網站文件 Intel® PRO/1000 Server Adapter iSCSI and iSCSI Remote Boot Frequently Asked Questions -
http://www.intel.com/network/connectivity/products/316975.pdf 有提到,這裡面提到的都屬於硬體的 iSCSI remote boot.
Q18: Does Intel iSCSI boot support adapter teaming?
A18: Adapter teaming is not supported on ports configured for iSCSI remote boot due to limitations in the OS stack, which does not support teaming for iSCSI traffic. Storage failover and load balancing support is provided by using MPIO.
Q16: Is Multipath I/O (MPIO) supported by Intel iSCSI boot?
A16: Intel iSCSI boot solutions use the standard OS iSCSI boot initiators to provide remote boot support, so MPIO and other advanced features are supported for iSCSI boot via the OS initiator once the OS boots.

配置 iSCSI 多路境 MPIO(Multipath),需要同網段的網卡兩個埠,目前我的 iSCSI Target 端為 192.8.1.55
| [root@benjr ~]#ifconfig | grep 192.8 inet addr:192.8.1.214 Bcast:192.8.1.255 Mask:255.255.255.0 inet addr:192.8.1.85 Bcast:192.8.1.255 Mask:255.255.255.0 |
先確定這兩個埠和 iSCSI Target 互通.
| [root@benjr ~]# ping -I eth0 192.8.1.55 [root@benjr ~]# ping -I eth1 192.8.1.55 |
iSCSI initiator 預設會依據網路狀態只和 iSCSI Target 建立一個 session,雖然你的網路上同網段的埠有兩個以上.他還是只會建立一個 session.如果我們要使用 iSCSI interfaces (iface) binding 的功能必須要在 /var/lib/iscsi/ifaces 指定多個網路埠.我們可以使用 iscsiadm 的指令來建立.建立 ieth0 和 ieth1
| [root@benjr ~]# iscsiadm -m iface -I ieth0 --op=new [root@benjr ~]# iscsiadm -m iface -I ieth1 --op=new |
ieth0 和 ieth1 真實會指向實體裝置 eth0 和 eth1
| [root@benjr ~]# iscsiadm -m iface -I ieth0 --op=update -n iface.net_ifacename -v eth0 [root@benjr ~]# iscsiadm -m iface -I ieth1 --op=update -n iface.net_ifacename -v eth1 |
除了可以指定網路裝置名稱外 ethx 還可以依據網卡的 MAC address 來指定 "iface.hwaddress",確定一下剛剛建立出來的 ieth0 和 ieth1
| [root@benjr ~]# iscsiadm -m iface ieth0 tcp,default,eth0 ieth1 tcp,default,eth1 |
iscsiadm 主要會在 /var/lib/iscsi/ifaces 目錄下面建立剛剛所設定的 iface 裝置, iscsiadm 會依據這邊的設定同時向 iSCSI Target 建立連線.
| [root@benjr ~]# cat /var/lib/iscsi/ifaces/ieth0 iface.iscsi_ifacename = ieth0 iface.net_ifacename = eth0 iface.hwaddress = default iface.transport_name = tcp [root@benjr ~]# cat /var/lib/iscsi/ifaces/ieth1 iface.iscsi_ifacename = ieth1 iface.net_ifacename = eth1 iface.hwaddress = default iface.transport_name = tcp |
當我們只要透過 iscsiadm 這一支程式去向 iSCSI Target 端建立連線時,要特別去指定剛剛我們建立好的 iSCSI interfaces (iface) binding 裝置,這樣就可以讓 iSCSI Initiator 和 iSCSI Target 端建立多條連線.
| [root@benjr ~]# iscsiadm -m discovery -t sendtargets -p 192.8.1.55 -I ieth0 -I ieth1 192.8.1.55:3260,1 iqn.2009-4.tw.benjr:storage 192.8.1.55:3260,1 iqn.2009-4.tw.benjr:storage |
"iqn.2009-4.tw.benjr:storage" 這就是192.8.1.55:3260 iSCI Target 的 iqn.
| [root@benjr ~]# iscsiadm -m node --loginall=all Logging in to [iface: ieth1, target: iqn.2009-4.tw.benjr:storage, portal: 192.8.1.55,3260] Logging in to [iface: ieth0, target: iqn.2009-4.tw.benjr:storage, portal: 192.8.1.55,3260] Login to [iface: ieth1, target: iqn.2009-4.tw.benjr:storage, portal: 192.8.1.55,3260]: successful Login to [iface: ieth0, target: iqn.2009-4.tw.benjr:storage, portal: 192.8.1.55,3260]: successful |
登入 iSCSI Target 之後我們會發現多出來兩顆硬碟,不管是大小還是狀態都一樣,這就是 iSCSI Initiator 已經和 Target 端透過兩條路徑建立了不同的連線.接下來就需要設定一下所謂的 MPIO , 在 Linux 下是被稱為 device-mapper multipath
| [root@benjr ~]# fdisk -l Disk /dev/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System Disk /dev/sdb: 20.0 GB, 20012106240 bytes Device Boot Start End Blocks Id System Disk /dev/sdc: 20.0 GB, 20012106240 bytes Device Boot Start End Blocks Id System |
DM(Device-Mapper) multipath 的設定檔儲存在 /etc/multipath.conf ,我們只需要將系統預設的 blacklist - devnode,將他用 "#"註解掉.讓系統自己來偵測即可.
| [root@benjr ~]# vi /etc/multipath.conf blacklist { # devnode "*" } |
DM(Device-Mapper) multipath 的服務名稱為 multipathd ,開機啟動時設定 chkconfig ,立即啟用服務使用 service 程式.
| [root@benjr ~]# chkconfig multipathd on Start multipathd: [root@benjr ~]# service multipathd start |
當我將 "multipathd" 的服務啟動之後使用 multipath 指定來觀看可以發現剛剛由 iSCSI Initiator 連線所建立出來的 2 顆硬碟已經其實是指向同一個 SCSI ID 而 DM-Multipath 也確認的出來.
| [root@benjr ~]# multipath -ll mpath1 (16465616462656166313a3100000000000000000000000000) dm-2 IET,VIRTUAL-DISK [size=19G][features=0][hwhandler=0] \_ round-robin 0 [prio=1][active] \_ 7:0:0:1 sdb 8:16 [active][ready] \_ round-robin 0 [prio=1][enabled] \_ 6:0:0:1 sdc 8:32 [active][ready] |
我們也可以透過指令 scsi_id 來檢視硬碟裝置的 ID 是否相同.
| [root@benjr ~]# scsi_id -x -g -u -s /block/sdb ID_VENDOR=IET ID_MODEL=VIRTUAL-DISK ID_REVISION=0001 ID_SERIAL=16465616462656166313a3100000000000000000000000000 ID_TYPE=disk ID_BUS=scsi [root@benjr ~]# scsi_id -x -g -u -s /block/sdc ID_VENDOR=IET ID_MODEL=VIRTUAL-DISK ID_REVISION=0001 ID_SERIAL=16465616462656166313a3100000000000000000000000000 ID_TYPE=disk ID_BUS=scsi |
我們透過系統就可以觀看到 /dev/dm 的裝置了.這個裝置就如同一般的硬碟裝置,如同 /dev/sda 你可以針對他做分割,格式化,讀寫等動作.而且還具備 MPIO 的功能.
| [root@benjr ~]# fdisk -l Disk /dev/dm-2: 20.0 GB, 20012106240 bytes 255 heads, 63 sectors/track, 2433 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System |
如果系統沒有自動產生 /dev/dm 的裝置時可以透過程式 kpartx 來產生.
| [root@benjr ~]# kpartx -a /dev/mapper/16465616462656166313a3100000000000000000000000000 |
參考資料 : http://blog.chinaunix.net/u3/92556/showart_1842981.html
-
- sunchiahome's blog
- 增加新的回應
- 瀏覽次數 3365
回應
好文章
我不知道在台灣有多少人會去研究這種東西,我也不知道會寫出來的人有多少,我更訝異的是有人po在網路上
這篇文章不知道花了你多少時間,我當初大約搞了快一個禮拜,甚至更久才弄出來,我很好奇站長是做什麼的
有點像是做storage又有點不像。
這些都是我工作上會遇到的問題,順道寫下心得.以防自己下次遇到同樣的問題.
esx 不支持802.3 AD , 需要 ISCSI I/O multipath
802.3 AD 綁定後 2張網卡 2Gb 頻寬 只有 "多個" iscsi initiator同时連到 iscsi target上才會有 2G 頻寬
因為 內部esx 限制 , 每個 initiator 到 datastore 最多就 1G 。在VM iscsi I/O 測試 絕不會 超過1G
但是在正常ESX 下 Host OS iscsi initiator (VM Kernel ) 單一 (不同於 硬體Lan card ip initiator ) .並且也只會掛一個 iscsi 儲存裝置 (target) . 除非想切成 2個iscsi target .
所以不同 VM kernel ,VM kernel 不同 IP 就可
Refer
http://communities.vmware.com/servlet/JiveServlet/download/1387588-29608...
http://bbs.vmsky.com/thread-22091-1-1.html
Is Multipath I/O (MPIO) supported by Intel iSCSI boot?
Q16: Is Multipath I/O (MPIO) supported by Intel iSCSI boot?
A16: Intel iSCSI boot solutions use the standard OS iSCSI boot initiators to provide remote boot support, so MPIO and other advanced features are supported for iSCSI boot via the OS initiator once the OS boots.
上面問題提到了一點目前 Intel 的網卡是否支援 iSCSI MPIO Boot 的功能.答案是不支援.雖然我們在設定 Intel iSCSI Boot 可以選擇 Primary 以及 Secondary 但這不代表這就是支援 MPIO.以 Intel iSCSI NIC 的規則是如果 Primary 的設定連接失敗時才會使用 Secondary 的設定值,也因此這兩路徑不會同時存在.
如果有支援 MPIO 的 iSCSI NIC 在安裝 RHEL 時還需加入參數 mpath
http://publib.boulder.ibm.com/infocenter/lnxinfo/v3r0m0/index.jsp?topic=/liaai/multipath/liaaiiscsimultirhel.htm