天天看点

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.

继续阅读