在vmware虚机上用iscsi协议建立多路径环境测试multipath (4)

时间:2017-04-09 21:25:08   收藏:0   阅读:1304

安装与配置DM-multipath

安装运行DM软件

# yum install device-mapper-multipath  

# /etc/init.d/multipathdrestart

ok

Stopping multipathddaemon:                               [  OK  ]

Starting multipathddaemon:                               [  OK  ]

Multipathd服务启动后,会通过SCSI ID自动寻找同一设备的多条路径,并安装缺省设置把它们聚合起来使用。

# multipath -ll

mpathb (1IET     00010001) dm-3 lb,lb_iscsi           #‘1IET 00010001‘表示远程设备信息(centos6.5DM multipath 0.4.9用它作为SCSI ID) dm-3  lb 表示厂商  lb_iscsi产品信息  这种情况就可以实现单点故障切换

size=5.0G features=‘0‘hwhandler=‘0‘ wp=rw

|-+- policy=‘round-robin 0‘prio=1 status=active              #status=active  默认使用的链路

| `- 3:0:0:1 sdb 8:16 activeready running

`-+- policy=‘round-robin 0‘prio=1 status=enabled            #status=enabled有效链路,但是不是活动链路,备用链路

  `- 4:0:0:1 sdd 8:48 active ready running

 

配置multipath

2.1修改文件/etc/multipath.conf

默认情况下/etc目录下没有配置文件multipath.conf的。需要从/usr/share/doc/目录下拷贝过来使用。

#cp/usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf /etc/     

可以用man multipath.conf命令或者查看文件/usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf.annotated了解配置选项的解释。

在此,通过在文件中加入下列配置行,我们为SCSI ID为"1IET     00010001"的设备设置了round-robin负载均衡模式(缺省是active-standby模式)

multipaths {

        multipath {

                wwid                    "1IET     00010001"

                alias                   yellow

                path_grouping_policy    multibus

                path_selector           "round-robin 0"    

                failback                manual

                rr_weight               priorities

                no_path_retry           5

        }

2.2重启multipathd服务,让修改生效

# /etc/init.d/multipathdrestart

# /etc/init.d/iscsirestart            #实战发现必须做这一步,否则有问题,原因待查

验证multpath配置

# multipath -ll

yellow (1IET     00010001) dm-2 lb,lb_iscsi

size=10G features=‘1queue_if_no_path‘ hwhandler=‘0‘ wp=rw

`-+- policy=‘round-robin 0‘prio=1 status=active 

  |- 6:0:0:1 sdc 8:32 active ready running  #在此可以看到设备都是active状态

  `- 5:0:0:1 sdb 8:16 active ready running  #在此可以看到设备都是active状态

模拟网卡故障,验证multipathfailover功能

# ifdown eth2    #执行后需要等几秒让DM确认该IP路径down

Device state: 3(disconnected)

# multipath -ll

Mar 23 17:12:21 |/etc/multipath.conf line 67, invalid keyword: path_checker

yellow (1IET     00010001) dm-2 lb,lb_iscsi

size=10G features=‘1queue_if_no_path‘ hwhandler=‘0‘ wp=rw

`-+- policy=‘round-robin 0‘ prio=1status=active

  |- 7:0:0:1 sdd 8:48 active faulty running

  `- 8:0:0:1 sdc 8:32 active ready  running

# ifup eth2

Active connection state:activated

Active connection path:/org/freedesktop/NetworkManager/ActiveConnection/3

# multipath -ll

Mar 23 17:15:43 |/etc/multipath.conf line 67, invalid keyword: path_checker

yellow (1IET     00010001) dm-2 lb,lb_iscsi

size=10G features=‘1queue_if_no_path‘ hwhandler=‘0‘ wp=rw

`-+- policy=‘round-robin 0‘prio=1 status=active

  |- 7:0:0:1 sdd 8:48 failed ready running

  `- 8:0:0:1 sdc 8:32 active ready running

# sleep 60       #等待60

# multipath –ll   #此时路径恢复

Mar 23 17:17:05 |/etc/multipath.conf line 67, invalid keyword: path_checker

yellow (1IET     00010001) dm-2 lb,lb_iscsi

size=10G features=‘1 queue_if_no_path‘hwhandler=‘0‘ wp=rw

`-+- policy=‘round-robin 0‘prio=1 status=active

  |- 7:0:0:1 sdd 8:48 active ready running

  `- 8:0:0:1 sdc 8:32 active readyrunning


评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!