|
1. device-mapper-multipath 即multipath-tools,主要提供multipathd和multipath等工具和 multipath.conf等配置文件。这些工具通过device mapper的ioctr的接口创建和配置multipath,设备创建的多路径设备映射会在/dev /mapper中。 2. device-mapper 主要包括两大部分:内核部分和用户部分。内核部分主要由device mapper核心(dm.ko)和一些target driver(md-multipath.ko)。核心完成设备的映射,而target根据映射关系和自身特点具体处理从mappered device 下来的i/o。同时,在核心部分,提供了一个接口,用户通过ioctr可和内核部分通信,以指导内核驱动的行为,比如如何创建mappered device,这些divece的属性等。linux device mapper的用户空间部分主要包括device-mapper这个包。其中包括dmsetup工具和一些帮助创建和配置mappered device的库。这些库主要抽象,封装了与ioctr通信的接口,以便方便创建和配置mappered device。multipath-tool的程序中就需要调用这些库 3. dm-multipath.ko和dm.ko:dm.ko是device mapper驱动。它是实现multipath的基础。dm-multipath其实是dm的一个target驱动。
" N! B, r* R% I' R N3 NAIX http://blog.163.com/herod_xiao/blog/static/871883992011819112227689/ # J+ f: X- S' o4 N0 I
& u+ r6 N& ]/ }/ h+ _, m+ N1. 检查multipath模块,如果没有相关模块就说明没有安装相关软件包 lsmod | grep dm_multipath yum -y install device-mapper device-mapper-multipath ! A5 F* p, c0 \5 {, ?
2. 加载相关模块 modprobe dm-multipath modprobe dm-round-robin ! H& J/ N7 a, Y g& ?0 }+ \- |9 T
3. 生成multipath配置文件,并配置 /sbin/mpathconf --enable 配置multipath.conf文件 2 B( X6 O1 P! U& b" |1 r, F
4. 启动multipath服务 service multipathd start chkcofig multipathd on [backcolor=rgb(245, 245, 245) !important][url=] [/url]+ u) _3 O( @5 f# h( D* b* D0 U
[root@tyhr ~]# multipath -llmpathc (36005076801820709e000000000000087) dm-3 IBM,2145size=300G features='1 queue_if_no_path' hwhandler='0' wp=rw`-+- policy='round-robin 0' prio=1 status=active |- 4:0:0:1 sdc 8:32 active ready running |- 4:0:2:1 sde 8:64 active ready running |- 5:0:2:1 sdg 8:96 active ready running `- 5:0:4:1 sdi 8:128 active ready runningmpathb (36005076801820709e000000000000086) dm-2 IBM,2145size=100G features='1 queue_if_no_path' hwhandler='0' wp=rw`-+- policy='round-robin 0' prio=1 status=active |- 4:0:0:0 sdb 8:16 active ready running |- 4:0:2:0 sdd 8:48 active ready running |- 5:0:2:0 sdf 8:80 active ready running `- 5:0:4:0 sdh 8:112 active ready running[backcolor=rgb(245, 245, 245) !important][url=] [/url]
" a4 z E a2 _7 i% c1 G2 D g; S7 @$ a# T; A: V/ o' B$ s+ w, b
( v8 Z4 r+ X( A2 D* l+ N1 f
8 ^5 P, }* O; z- Q" ^
如果完成配置后,不能使用multipath -ll查看到任何多路径信息,就需要手工重新扫描HBA信息 一般新增LUN映射给主机后,系统无法直接更新挂载的存储盘,需要重新扫描。 # cd /sys/class/scsi_host/host4/# echo '- - - ' > scan或echo "1" > /sys/class/fc_host/host/issue_lip //某些存储或系统没有scan文件,可以通issue_lip文件识别8 ~7 x- X# T5 f B1 Z- t' H( F
" A6 p8 i' C' U" l$ {& N- H$ lRHEL5.x 操作系统,新增multipath后,能够识别磁盘,但是通过fdisk分区后,不能显示分区信息(/dev/mapper/dm-app 磁盘不显示/dev/mapper/dm-appp1)。partprob无报错但是没有效果。fdisk w保存后有报错: WARNING: Re-reading the partition table failed with error 22: Invalid argument. [backcolor=rgb(255, 255, 255) !important][size=1em]1 . M# o: A# c5 |. Z; p* Q+ M4 @
2
% g" r+ {. L& h) E3
0 [ m8 {1 J, d9 A1 g4 ' J8 O$ E( p, e# r& x' c
5 0 M4 y/ r& k& X6 l; C
6
5 e$ b0 w. o2 j. v. s/ ^7 7 B$ ?; {6 i9 X' D
8 . S+ E& ~" T1 s" G" I$ b
9
. p- O7 H; ^# {7 N. I10 7 ^6 ^9 E- ^5 ~4 f; Y
11
* W4 U! Y& M0 R3 j% u/ v12 0 Y9 S4 {0 C! G4 }
13 \" P5 Y0 B: z8 v u
14 - p3 }! c2 y- I. G2 N( C) b4 _
15 $ e% |' X+ C2 [0 M0 S* T1 l
16
- B7 J2 v8 v: K9 A+ R17 # Y U. q7 w2 b) b1 M) W
18 2 Y( n% @, f0 e5 F
| Run "kpartx -a" after FDISK is completed to add all partition mappings on the : q6 R+ \' t8 l0 \2 G
newly-created multipath device ; p- x f8 k7 V d
8 s: E2 @( b- A7 K% L( m4 t; I& r% T2 K4 }
3 T/ T1 _, Y+ M% i: y[root@TYEDI1 host4]# ls -l /dev/mapper/dm-* ) r J) f3 }3 q8 D
brw-rw---- 1 root disk 253, 0 Jan 21 22:59 /dev/mapper/dm-app . D) u, O5 u" y$ v- v
brw-rw---- 1 root disk 253, 2 Jan 21 22:35 /dev/mapper/dm-arch 9 _. y/ e1 a% @$ g
brw-rw---- 1 root disk 253, 1 Jan 21 22:52 /dev/mapper/dm-db 4 P' @4 X* Q* {% u- @; |
0 g9 q2 O/ J' L[root@TYEDI1 host4]# kpartx -a /dev/mapper/dm-app
( X$ d! n- {% U0 w7 f0 t- C; N$ @' ]; T1 d- e$ D
' V8 b+ `8 q W! {* Q& @ I- }
[root@TYEDI1 host4]# ls -l /dev/mapper/dm-* 2 Z" e0 F% D/ h. j( F
brw-rw---- 1 root disk 253, 0 Jan 21 22:59 /dev/mapper/dm-app 1 f) o6 S* T8 A) L4 |
brw-rw---- 1 root disk 253, 3 Jan 21 23:01 /dev/mapper/dm-app1 0 J+ F( E1 ]3 C( h1 G' }% a2 z( ]
brw-rw---- 1 root disk 253, 2 Jan 21 22:35 /dev/mapper/dm-arch
5 e9 \: X0 w4 a5 x2 t" Jbrw-rw---- 1 root disk 253, 1 Jan 21 22:52 /dev/mapper/dm-db
# l# D- v; P5 J
% E4 {% L6 P4 U: q |
& \6 p, O6 u0 u4 q( e. _6 _
+ }9 z5 } N3 R$ S, m$ `
7 y7 W; E* M% H1 z j2 f8 Y# a0 W* D% [. ]) r+ s" B( a$ l2 s
9 d2 x# X' N) i" m
) x# I- R# K% ~8 c( M6 ` 其他配置: 1. udev绑定权限 RHEL6.5,对于multipath的权限,手工去修改几秒后会变回root。所以需要使用udev去绑定好权限。 [backcolor=rgb(245, 245, 245) !important][url=] [/url]' V% Q& M' ]" P# J3 ?
1)搜索对应的配置文件模板:[root@jyrac1 ~]# find / -name 12-*/usr/share/doc/device-mapper-1.02.79/12-dm-permissions.rules\' F/ a. V" k7 N/ f, t( C
2)根据模板新增12-dm-permissions.rules文件在/etc/udev/rules.d/下面:vi /etc/udev/rules.d/12-dm-permissions.rules# MULTIPATH DEVICES## Set permissions for all multipath devicesENV{DM_UUID}=="mpath-?*", OWNER:="grid", GROUP:="asmadmin", MODE:="660"# Set permissions for first two partitions created on a multipath device (and detected by kpartx)# ENV{DM_UUID}=="part[1-2]-mpath-?*", OWNER:="root", GROUP:="root", MODE:="660"3)查看多路径对应的底层dm设备:[root@jyrac2 rules.d]# ls -lh /dev/dm*brw-rw---- 1 root disk 253, 0 Jul 19 16:40 /dev/dm-0brw-rw---- 1 root disk 253, 1 Jul 19 16:40 /dev/dm-1brw-rw---- 1 root disk 253, 2 Jul 19 21:20 /dev/dm-2brw-rw---- 1 root disk 253, 3 Jul 19 21:20 /dev/dm-34)启动start_udev[root@jyrac2 rules.d]# start_udev Starting udev: [ OK ]5)查看权限:[root@jyrac2 rules.d]# ls -lh /dev/dm*brw-rw---- 1 root disk 253, 0 Jul 19 21:35 /dev/dm-0brw-rw---- 1 root disk 253, 1 Jul 19 21:35 /dev/dm-1brw-rw---- 1 grid asmadmin 253, 2 Jul 19 21:35 /dev/dm-2brw-rw---- 1 grid asmadmin 253, 3 Jul 19 21:35 /dev/dm-36)等30s后再查,权限固定:[root@jyrac2 rules.d]# ls -lh /dev/dm*brw-rw---- 1 root disk 253, 0 Jul 19 21:35 /dev/dm-0brw-rw---- 1 root disk 253, 1 Jul 19 21:35 /dev/dm-1brw-rw---- 1 grid asmadmin 253, 2 Jul 19 21:35 /dev/dm-2brw-rw---- 1 grid asmadmin 253, 3 Jul 19 21:35 /dev/dm-3[backcolor=rgb(245, 245, 245) !important][url=] [/url]
1 E7 ~% z+ H q) b, ^
1 b6 i0 |9 P$ ~' A/ n: q5 D* l2 z6 o9 }
( z2 A* e1 ^# c% y$ |
* T6 t: B2 }* t0 [8 h' q
1 Y1 d3 E4 o9 }% l8 l
+ W0 ] ]- s( Q$ M0 R% c. q; E 可以使用lsscsi查看识别的磁盘信息: [backcolor=rgb(245, 245, 245) !important][url=] [/url]8 ?6 e: i& H, L- B
[root@tyhr ~]# lsscsi [0:0:0:0] cd/dvd TSSTcorp DVD-ROM TS-L333H ID03 /dev/sr0 [2:0:0:0] cd/dvd IMM Virtual CD/DVD 0316 /dev/sr1 [3:0:0:0] disk IBM-ESXS MBF2300RC SB27 - [3:0:1:0] disk IBM-ESXS MBF2300RC SB27 - [3:1:1:0] disk LSILOGIC Logical Volume 3000 /dev/sda [4:0:0:0] disk IBM 2145 0000 /dev/sdb [4:0:0:1] disk IBM 2145 0000 /dev/sdc [4:0:2:0] disk IBM 2145 0000 /dev/sdd [4:0:2:1] disk IBM 2145 0000 /dev/sde [5:0:2:0] disk IBM 2145 0000 /dev/sdf [5:0:2:1] disk IBM 2145 0000 /dev/sdg [5:0:4:0] disk IBM 2145 0000 /dev/sdh [5:0:4:1] disk IBM 2145 0000 /dev/sdi [backcolor=rgb(245, 245, 245) !important][url=] [/url]. K5 r0 l3 X* _
8 |9 |% W2 G+ }* l+ ]; `- q
- ^/ D+ |/ Y; q* e+ k# ]! B7 J3 @
P8 y/ z3 n6 a. j
% C& \9 c1 X! j* [
1. multipath常用操作: multipath -r (修改multipath.conf配置文件之后重新加载)
- W9 x8 d( b. x5 l: kmultipath -ll (查看多路径状态)
9 s! L) \, @- `3 Hmultipath -v2 (格式化路径,检测路径,合并路径)
5 l' w# d9 \7 i0 R( q3 X( xmultipath -v3 (查看多路径详情blacklist、whitelist和设备wwid)8 |9 f5 ~. q; V) e: `: N# T8 Q
multipath -F (删除现有链路) 2. multipath文件详细介绍 接下来的工作就是要编辑/etc/multipath.conf的配置文件 multipath.conf主要包括blacklist、multipaths、devices三部份的配置5 d7 V2 M4 ]2 [) Q) @
blacklist配置5 ~2 J6 s5 X" F; G
blacklist { . ]# Y+ U; j- M
devnode "^sda" * H0 P! g3 B, B7 h1 N X
}
& g& e/ F4 t# ?Multipaths部分配置multipaths和devices两部份的配置。4 r$ m6 s4 r, r. A/ J7 w
multipaths {/ Y% V8 e# j+ ?3 D0 ` ?
multipath {0 _5 j" A8 I' h, L5 s, `4 `
wwid **************** #此值multipath -v3可以看到2 e* B& r% y# c7 E& O
alias iscsi-dm0 #映射后的别名,可以随便取( T- b5 d# U# H9 d0 w8 V! E
path_grouping_policy multibus #路径组策略! }" }+ u5 t( H# |
path_checker tur #决定路径状态的方法. f3 R- X5 s0 Y* I) j
path_selector "round-robin 0" #选择那条路径进行下一个IO操作的方法
# \6 n9 o5 H4 b2 _; B4 Q8 V& }0 {7 Z }
W+ B5 z/ y, r+ s S! G6 M}4 U: ^8 \& E) v5 _
Devices部分配置# a* c4 A3 R8 @9 c% {; m
devices {1 I' ]0 g+ g, ~0 S
device {
9 w Y3 U2 i& ^. t% O5 A4 N vendor "iSCSI-Enterprise" #厂商名称" x5 V) E8 t( R
product "Virtual disk" #产品型号9 W0 ?3 I' l, j8 q; a
path_grouping_policy multibus #默认的路径组策略
5 G8 u: Q: ^9 J+ s getuid_callout "/sbin/scsi_id -g -u -s /block/%n" #获得唯一设备号使用的默认程序
* O' w6 ~1 a1 d1 e6 T prio_callout "/sbin/acs_prio_alua %d" #获取有限级数值使用的默认程序9 x7 H% U5 m$ _ d* i$ D B
path_checker readsector0 #决定路径状态的方法7 x& ^- k. }8 U7 ?
path_selector "round-robin 0" #选择那条路径进行下一个IO操作的方法) G% S- L k7 {
failback immediate #故障恢复的模式& N' ^/ @1 Q# ?, L8 Y
no_path_retry queue #在disable queue之前系统尝试使用失效路径的次数的数值' \" u) o2 E- k! @; R! A; j: Z
rr_min_io 100 #在当前的用户组中,在切换到另外一条路径之前的IO请求的数目
6 T8 k& ]1 R! j8 g) i) | }0 G0 E/ r- c; s
}3 O" o) b- q h. q3 B" `) `3 b
相关参数的标准文档的介绍: Attribute Description 8 ~9 J/ P( h( a+ k1 A. I
wwid Specifies the WWID of the multipath device to which the multipath attributes apply. This parameter is mandatory for this section of themultipath.conf file.
8 |8 ~) O$ N* m4 H$ g$ ?alias Specifies the symbolic name for the multipath device to which themultipath attributes apply. If you are using user_friendly_names, do not set this value tompathn; this may conflict with an automatically assigned user friendly name and give you incorrect device node names. ( P4 `6 G! H- h- h7 {( k
path_grouping_policy Specifies the default path grouping policy to apply to unspecified multipaths. Possible values include:
$ A# H3 o; C) D+ r7 sfailover = 1 path per priority group
9 D: O1 ` ^5 v9 o Hmultibus = all valid paths in 1 priority group
/ U- f4 d6 m) R+ f$ e) _0 h4 Dgroup_by_serial = 1 priority group per detected serial number
! w4 ]3 B& |# z( o: ~ v( ^: Mgroup_by_prio = 1 priority group per path priority value 5 A, \1 k+ i U$ _. x: o
group_by_node_name = 1 priority group per target node name
' B E# T2 _8 m- e2 bpath_selector Specifies the default algorithm to use in determining what path to use for the next I/O operation. Possible values include: | round-robin 0: Loop through every path in the path group, sending the same amount of I/O to each. | queue-length 0: Send the next bunch of I/O down the path with the least number of outstanding I/O requests. | service-time 0: Send the next bunch of I/O down the path with the shortest estimated service time, which is determined by dividing the total size of the outstanding I/O to each path by its relative throughput. |
; j1 z L6 w/ w8 J# ]9 [failback Manages path group failback. | A value of immediate specifies immediate failback to the highest priority path group that contains active paths. | A value of manual specifies that there should not be immediate failback but that failback can happen only with operator intervention. | A value of followover specifies that automatic failback should be performed when the first path of a path group becomes active. This keeps a node from automatically failing back when another node requested the failover. | A numeric value greater than zero specifies deferred failback, expressed in seconds. | 3 `3 h7 Y; E" ?* M( T
prio Specifies the default function to call to obtain a path priority value. For example, the ALUA bits in SPC-3 provide an exploitableprio value. Possible values include: | const: Set a priority of 1 to all paths. | emc: Generate the path priority for EMC arrays. | alua: Generate the path priority based on the SCSI-3 ALUA settings. | tpg_pref: Generate the path priority based on the SCSI-3 ALUA settings, using the preferred port bit. | ontap: Generate the path priority for NetApp arrays. | rdac: Generate the path priority for LSI/Engenio RDAC controller. | hp_sw: Generate the path priority for Compaq/HP controller in active/standby mode. | hds: Generate the path priority for Hitachi HDS Modular storage arrays. |
- A/ e; {" x3 Ono_path_retry A numeric value for this attribute specifies the number of times the system should attempt to use a failed path before disabling queueing. | A value of fail indicates immediate failure, without queueing. | A value of queue indicates that queueing should not stop until the path is fixed. | % `4 R' @" G( Q
rr_min_io Specifies the number of I/O requests to route to a path before switching to the next path in the current path group. This setting is only for systems running kernels older that 2.6.31. Newer systems should userr_min_io_rq. The default value is 1000. 0 @. k6 \% v+ Y! h# B; u
rr_min_io_rq Specifies the number of I/O requests to route to a path before switching to the next path in the current path group, using request-based device-mapper-multipath. This setting should be used on systems running current kernels. On systems running kernels older than 2.6.31, use rr_min_io. The default value is 1.
! B, d" a1 t' e0 @9 wrr_weight If set to priorities, then instead of sending rr_min_io requests to a path before callingpath_selector to choose the next path, the number of requests to send is determined byrr_min_io times the path's priority, as determined by the prio function. If set touniform, all path weights are equal.
8 h4 b2 \* z1 yflush_on_last_del If set to yes, then multipath will disable queueing when the last path to a device has been deleted. 1 k9 [1 r7 D4 z# Z
) U' y0 D' Z3 ]) Emultipath与oracle ASM结合 https://www.cnblogs.com/jyzhao/p/7208620.html / a) ~9 V' r1 r/ S5 f3 I
已有配置文件: [backcolor=rgb(245, 245, 245) !important][url=] [/url] K# E. y& i' b+ x( C# |
defaults { polling_interval 30 failback immediate no_path_retry 5 rr_min_io 100 path_checker tur user_friendly_names yes }devnode_blacklist { devnode "sda"}devices { device { vendor "IBM" product "2145" path_grouping_policy group_by_prio prio_callout "/sbin/mpath_prio_alua /dev/%n" } device { vendor "IBM" product "1750500" path_grouping_policy group_by_prio prio_callout "/sbin/mpath_prio_alua /dev/%n" } device { vendor "IBM" product "2107900" path_grouping_policy group_by_serial } device { vendor "IBM" product "2105800" path_grouping_policy group_by_serial }}multipaths { multipath { wwid 36005076801820709e000000000000043 alias dm-vote01 }}[backcolor=rgb(245, 245, 245) !important][url=] [/url]& b) P8 S! Z6 \0 U {* _$ Y
: ]0 R+ J6 y8 f6 r1 b9 n8 y7 t
|