LINUX多路径配置.docx
《LINUX多路径配置.docx》由会员分享,可在线阅读,更多相关《LINUX多路径配置.docx(13页珍藏版)》请在冰豆网上搜索。
![LINUX多路径配置.docx](https://file1.bdocx.com/fileroot1/2023-1/31/4584811c-1380-45da-949a-b9900f40a8a9/4584811c-1380-45da-949a-b9900f40a8a91.gif)
LINUX多路径配置
LINUX操作系统多路径配置
在Linux和AIX平台都有一部分存储产品使用操作系统自带的多路径软件,包括最常见的HP和IBM的部分存储产品,在Linux自带的多路径软件叫做multipath,这篇文章以IBMN系列存储在Linux平台的使用为例,讨论Linux平台multipath的使用。
1.确保安装以下的包:
device-mapper
device-mapper-multipath
2.编辑配置文件/etc/multipath.conf
RHEL6.4配置文件在
/usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf
复制一份到/etc目录
3.启动multipathd服务,及设置其自动启动。
执行以下的命令:
#servicemultipathdrestart
#chkconfig--level345multipathdon
#chkconfig--list|grepmultipathd
4、修改配置文件
[root@rac01~]#vi/etc/multipath.conf
#Thisisabasicconfigurationfilewithsomeexamples,fordevicemapper
#multipath.
#Foracompletelistofthedefaultconfigurationvalues,see
#/usr/share/doc/device-mapper-multipath-0.4.7/multipath.conf.defaults
#Foralistofconfigurationoptionswithdescriptions,see
#/usr/share/doc/device-mapper-multipath-0.4.7/multipath.conf.annotated
#Blacklistalldevicesbydefault.Removethistoenablemultipathing
#onthedefaultdevices.
#排除本地磁盘,不做多路径
blacklist{
devnode"^sda"
}
##Bydefault,deviceswithvendor="IBM"andproduct="S/390.*"are
##blacklisted.Toenablemulitpathingonthesedevies,uncommentthe
##followinglines.
#blacklist_exceptions{
#device{
#vendor"IBM"
#product"S/390.*"
#}
#}
##Useuserfriendlynames,insteadofusingWWIDsasnames.
#defaults{
#user_friendly_namesyes
#}
##
##Hereisanexampleofhowtoconfiguresomestandardoptions.
##
#
defaults{
udev_dir/dev
polling_interval10
selector"round-robin0"
path_grouping_policymultibus
getuid_callout"/sbin/scsi_id-g-u-s/block/%n"
prio_callout/bin/true
path_checkerreadsector0
rr_min_io100
max_fds8192
rr_weightpriorities
failbackimmediate
no_path_retryfail
user_friendly_namesyes
}
##
##Thewwidlineinthefollowingblacklistsectionisshownasanexample
##ofhowtoblacklistdevicesbywwid.The2devnodelinesarethe
##compiledindefaultblacklist.Ifyouwanttoblacklistentiretypes
##ofdevices,suchasallscsidevices,youshoulduseadevnodeline.
##However,ifyouwanttoblacklistspecificdevices,youshoulduse
##awwidline.Sincethereisnoguaranteethataspecificdevicewill
##notchangenamesonreboot(from/dev/sdato/dev/sdbforexample)
##devnodelinesarenotrecommendedforblacklistingspecificdevices.
##
#blacklist{
#wwid26353900f02796769
#devnode"^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
#devnode"^hd[a-z]"
#}
#multipaths{
#multipath{
#wwid3600508b4000156d700012000000b0000
#aliasyellow
#path_grouping_policymultibus
#path_checkerreadsector0
#path_selector"round-robin0"
#failbackmanual
#rr_weightpriorities
#no_path_retry5
#}
#multipath{
#wwid1DEC_____321816758474
#aliasred
#}
#}
#devices{
#device{
#vendor"COMPAQ"
#product"HSV110(C)COMPAQ"
#path_grouping_policymultibus
#getuid_callout"/sbin/scsi_id-g-u-s/block/%n"
#path_checkerreadsector0
#path_selector"round-robin0"
#hardware_handler"0"
#failback15
#rr_weightpriorities
#no_path_retryqueue
#}
#device{
#vendor"COMPAQ"
#product"MSA1000"
#path_grouping_policymultibus
#}
#}
#下面的注释配置不是必须的,配置之后可以固定系统设备的名称,这在服务器重启设备文件对应的磁盘设备发生变化的情况下使用。
multipaths{
multipath{
wwid36005076305ffd648000000000000101d
aliasdata1
}
multipath{
wwid36005076305ffd6480000000000001028
aliasdata2
}
multipath{
wwid36005076305ffd648000000000000101e
aliasdata3
}
multipath{
wwid36005076305ffd6480000000000001029
aliasdata4
}
multipath{
wwid36005076305ffd648000000000000101f
aliasdata5
}
multipath{
wwid36005076305ffd648000000000000102a
aliasdata6
}
multipath{
wwid36005076305ffd648000000000000102b
aliasdata7
}
multipath{
wwid36005076305ffd648000000000000102c
aliasdata8
}
multipath{
wwid36005076305ffd648000000000000102d
aliasdata9
}
}
补充
如何获取磁盘WWID
[root@jceqdw1~]#multipath-v3|grepundef
36005076305ffd648000000000000101e6:
0:
0:
1sdc8:
321undefreadyIBM,21079
36005076305ffd648000000000000102b6:
0:
0:
6sdh8:
1121undefreadyIBM,21079
36005076305ffd648000000000000101f6:
0:
0:
2sdd8:
481undefreadyIBM,21079
36005076305ffd64800000000000010286:
0:
0:
3sde8:
641undefreadyIBM,21079
36005076305ffd648000000000000101d6:
0:
0:
0sdb8:
161undefreadyIBM,21079
36005076305ffd648000000000000102d6:
0:
0:
8sdj8:
1441undefreadyIBM,21079
36005076305ffd64800000000000010296:
0:
0:
4sdf8:
801undefreadyIBM,21079
36005076305ffd648000000000000102c6:
0:
0:
7sdi8:
1281undefreadyIBM,21079
36005076305ffd648000000000000102a6:
0:
0:
5sdg8:
961undefreadyIBM,21079
36005076305ffd648000000000000101d7:
0:
0:
0sdk8:
1601undefreadyIBM,21079
36005076305ffd648000000000000101e7:
0:
0:
1sdl8:
1761undefreadyIBM,21079
36005076305ffd64800000000000010287:
0:
0:
3sdn8:
2081undefreadyIBM,21079
36005076305ffd648000000000000101f7:
0:
0:
2sdm8:
1921undefreadyIBM,21079
36005076305ffd64800000000000010297:
0:
0:
4sdo8:
2241undefreadyIBM,21079
36005076305ffd648000000000000102b7:
0:
0:
6sdq65:
01undefreadyIBM,21079
36005076305ffd648000000000000102a7:
0:
0:
5sdp8:
2401undefreadyIBM,21079
36005076305ffd648000000000000102c7:
0:
0:
7sdr65:
161undefreadyIBM,21079
36005076305ffd648000000000000102d7:
0:
0:
8sds65:
321undefreadyIBM,21079
或者使用multipath-ll
[root@jceqdw1~]#multipath-ll
Dec1217:
46:
35|multipath.confline33,duplicatekeyword:
defaults
Dec1217:
46:
35|multipath.confline36,invalidkeyword:
selector
Dec1217:
46:
35|multipath.confline39,invalidkeyword:
prio_callout
data9(36005076305ffd648000000000000102d)dm-5IBM,2107900
size=536Gfeatures='0'hwhandler='0'wp=rw
`-+-policy='round-robin0'prio=1status=active
|-6:
0:
0:
8sdj8:
144activereadyrunning
`-7:
0:
0:
8sds65:
32activereadyrunning
data8(36005076305ffd648000000000000102c)dm-7IBM,2107900
size=536Gfeatures='0'hwhandler='0'wp=rw
`-+-policy='round-robin0'prio=1status=active
|-6:
0:
0:
7sdi8:
128activereadyrunning
`-7:
0:
0:
7sdr65:
16activereadyrunning
data7(36005076305ffd648000000000000102b)dm-1IBM,2107900
size=536Gfeatures='0'hwhandler='0'wp=rw
`-+-policy='round-robin0'prio=1status=active
|-6:
0:
0:
6sdh8:
112activereadyrunning
`-7:
0:
0:
6sdq65:
0activereadyrunning
data6(36005076305ffd648000000000000102a)dm-8IBM,2107900
size=536Gfeatures='0'hwhandler='0'wp=rw
`-+-policy='round-robin0'prio=1status=active
|-6:
0:
0:
5sdg8:
96activereadyrunning
`-7:
0:
0:
5sdp8:
240activereadyrunning
data5(36005076305ffd648000000000000101f)dm-2IBM,2107900
size=536Gfeatures='0'hwhandler='0'wp=rw
`-+-policy='round-robin0'prio=1status=active
|-6:
0:
0:
2sdd8:
48activereadyrunning
`-7:
0:
0:
2sdm8:
192activereadyrunning
data4(36005076305ffd6480000000000001029)dm-6IBM,2107900
size=536Gfeatures='0'hwhandler='0'wp=rw
`-+-policy='round-robin0'prio=1status=active
|-6:
0:
0:
4sdf8:
80activereadyrunning
`-7:
0:
0:
4sdo8:
224activereadyrunning
data3(36005076305ffd648000000000000101e)dm-0IBM,2107900
size=536Gfeatures='0'hwhandler='0'wp=rw
`-+-policy='round-robin0'prio=1status=active
|-6:
0:
0:
1sdc8:
32activereadyrunning
`-7:
0:
0:
1sdl8:
176activereadyrunning
data2(36005076305ffd6480000000000001028)dm-3IBM,2107900
size=536Gfeatures='0'hwhandler='0'wp=rw
`-+-policy='round-robin0'prio=1status=active
|-6:
0:
0:
3sde8:
64activereadyrunning
`-7:
0:
0:
3sdn8:
208activereadyrunning
data1(36005076305ffd648000000000000101d)dm-4IBM,2107900
size=536Gfeatures='0'hwhandler='0'wp=rw
`-+-policy='round-robin0'prio=1status=active
|-6:
0:
0:
0sdb8:
16activereadyrunning
`-7:
0:
0:
0sdk8:
160activereadyrunning
5.检查multipath聚合后的设备名,以及设备对应的链路情况。
[root@rac2~]#multipath-ll
mpath2(360a9800065344e6f465a6d5773747545)dm-3NETAPP,LUN
size=2.0Gfeatures='1queue_if_no_path'hwhandler='0'wp=rw
`-+-policy='round-robin0'prio=1status=active
|-1:
0:
0:
5 sdf8:
80 activeready running
`-2:
0:
0:
5 sdp8:
240activeready running
mpath1(360a9800065344e6f465a6d5773746878)dm-1NETAPP,LUN
size=2.0Gfeatures='1queue_if_no_path'hwhandler='0'wp=rw
`-+-policy='round-robin0'prio=1status=active
|-1:
0:
0:
3 sdd8:
48 activeready running
`-2:
0:
0:
3 sdn8:
208activeready running
mpath0(360a9800065344e6f465a6d5773745558)dm-0NETAPP,LUN
size=2.0Gfeatures='1queue_if_no_path'hwhandler='0'wp=rw
`-+-policy='round-robin0'prio=1status=active
|-1:
0:
0:
1 sdb8:
16 activeready running
`-2:
0:
0:
1 sdl8:
176activeready running
mpath9(360a9800065344e6e536f6d586d33666e)dm-9NETAPP,LUN
size=3.9Tfeatures='1queue_if_no_path'hwhandler='0'wp=rw
`-+-policy='round-robin0'prio=1status=active
|-1:
0:
0:
10sdk8:
160activeready running
`-2:
0:
0:
10sdu65:
64activeready running
mpath8(360a9800065344e6e536f6d586d32766b)dm-7NETAPP,LUN
size=150Gfeatures='1queue_if_no_path'hwhandler='0'wp=rw
`-+-policy='round-robin0'prio=1status=active
|-1:
0:
0:
8 sdi8:
128activeready running
`-2:
0:
0:
8 sds65:
32activeready running
mpath7(360a9800065344e6e536f6d586d313851)dm-6NETAPP,LUN
size=2.0Gfeatures='1queue_if_no_path'hwhandler='0'wp=rw
`-+-policy='round-robin0'prio=1status=active
|-1:
0:
0:
6 sdg8:
96 activeready running
`-2:
0:
0:
6 sdq65:
0 activeready running
mpath6(360a9800065344e6e536f6d586d307464)dm-4NETAPP,LUN
size=2.0Gfeatures='1queue_if_no_path'hwhandler='0'wp=rw
`-+-policy='round-robin0'prio=1status=active
|-1:
0:
0:
4 sde8:
64 activeready running
`-2:
0:
0:
4 sdo8:
224activeready running
mpath5(360a9800065344e6e536f6d586d306630)dm-2NETAPP,LUN
size=2.0Gfeatures='1queue_if_no_path'