天天看點

Linux多路徑的使用及介紹(二)

 2. 預設情況下,将使用 /var/lib/multipath/bindings 内的配置設定具體每個多路徑裝置名,如果在/etc/multipath.conf中有設定各wwid 别名,别名會覆寫此設定。

----負載均衡測試

使用dd指令來對裝置進行寫操作,并同時通過iostat來檢視I/0狀态,指令及輸出如下:

#dd if=/dev/zero of=/dev/vgtest/lvtest1

avg-cpu: %user %nice %sys %iowait %idle

0.50 0.00 3.47 48.51 47.52

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn

sda 0.00 0.00 0.00 0 0

sdf 756.57 6044.44 0.00 5984 0

sdh 0.00 0.00 0.00 0 0

sdj 0.00 0.00 0.00 0 0

sdl 334.34 2682.83 0.00 2656 0

通過上述輸出,我們看到,在對/dev/vgtest/lvtest1讀寫時,實際上是通過對/dev/md-0包含的目前active的所有裝置,即/dev/sdf,/dev/sdl這2條路徑來完成對實際的LUN的寫過程。

---路徑切換測試

首先,我們拔掉伺服器上A口的光纖線,經過不到10秒,我們看到:MPIO成功地從上述“失敗”的路徑/dev/sdl切換到了另外一條路徑/dev/sdf上。其輸出樣本如下:

#iostat 1

0.50 0.00 6.47 46.77 46.27

sda 0.98 0.00 7.84 0 8

sdf 1709.80 13678.43 0.00 13952 0

sdl 0.00 0.00 0.00 0 0

When devices are brought under the control of device-mapper-multipath the new multipathed devices can be seen in three different places under the /dev directory: /dev/dm-N, /dev/mapper/mpathN and /dev/mpath/mpathN.

   ---<b>The /dev/dm-N</b> devices are internal to device mapper and should never be used. These devices are not persistent. Starting with Red Hat Enterprise Linux 5, these devices are no longer created by udev.

   ---<b>The /dev/mpath/mpathN</b> devices are provided so that all the multipathed devices can be seen in one place. However, these device nodes may not be created on boot before the system needs to access them. Therefore they should not be used for creating logical volumes or filesystems.

   ---<b>The /dev/mapper/mpathN</b> devices are persistent and they are created early in the boot process. Therefore these are the device names that should be used to access the multipathed devices.

繼續閱讀