|
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驱动。
* z1 C% A! b2 D% y- q" Z# M7 U! h" |' wAIX http://blog.163.com/herod_xiao/blog/static/871883992011819112227689/
0 D" K: p7 m9 n. H- y$ O! m# y# R
5 A: ~- f+ S: K- B! Q1 H4 V; t! b1. 检查multipath模块,如果没有相关模块就说明没有安装相关软件包 lsmod | grep dm_multipath yum -y install device-mapper device-mapper-multipath
# r- X+ Q* u8 V2. 加载相关模块 modprobe dm-multipath modprobe dm-round-robin 1 @7 U" c5 Y1 [# _3 x( N0 i
3. 生成multipath配置文件,并配置 /sbin/mpathconf --enable 配置multipath.conf文件 & u) X2 @/ `7 _$ n; H
4. 启动multipath服务 service multipathd start chkcofig multipathd on [backcolor=rgb(245, 245, 245) !important][url=] [/url]6 \9 O8 j( G$ c$ F c
[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]
: r9 ]# j* }6 L2 ~) T8 f6 B
1 W- n* K8 @' r5 d- }
) L" |0 a6 G/ k7 m+ V1 a2 p
& z }+ Z8 P+ N如果完成配置后,不能使用multipath -ll查看到任何多路径信息,就需要手工重新扫描HBA信息 一般新增LUN映射给主机后,系统无法直接更新挂载的存储盘,需要重新扫描。 # cd /sys/class/scsi_host/host4/# echo '- - - ' > scan或echo "1" > /sys/class/fc_host/host/issue_lip //某些存储或系统没有scan文件,可以通issue_lip文件识别
( A$ O! `5 C+ |# r" T
& z4 j& J0 a/ ]! pRHEL5.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
$ {4 ~8 U: T/ Y) m2
% Y2 ?3 x& L. N6 j2 X7 G, Q3
( o" k' F Z, |4 0 @/ D! u; y' ]$ M
5 " r, j/ P4 C3 R* n
6
7 c) j/ l! ]' |. b4 ` Y2 n7 5 Q4 O; ] k. Q7 @6 x z& \1 z
8
6 W7 m9 m0 B) t% B6 q1 \9 9 u. P* |3 u" j7 u9 W9 B9 Q" T
10 1 ]# _; C% o. Q2 i5 d" O3 b; d
11
7 w v+ g5 C4 V6 e12
4 M+ m1 v; w' B13
# h6 _. T' d, F8 {+ n14 ) v9 V1 ` }& B" G9 F# R' @! p7 _
15
7 n3 h1 o' ` G7 K. U16
4 m( p& o; y6 m' A1 f5 k2 j" ?17
+ z8 ^/ \# B* ~+ H. U/ t" N A# j18 8 F. f' u) @. ]! F9 S# R3 F6 e6 y t
| Run "kpartx -a" after FDISK is completed to add all partition mappings on the
* u& ]4 Y/ | @3 [3 \newly-created multipath device $ k0 D8 Z/ \& B" D. _
3 E+ @# u% O# ^7 m8 \
/ p8 H8 l; O$ H) f& G% o7 L( H9 `
- i z, F8 B' S
[root@TYEDI1 host4]# ls -l /dev/mapper/dm-*
; @- \% R1 C) g* s; B- Q7 }brw-rw---- 1 root disk 253, 0 Jan 21 22:59 /dev/mapper/dm-app * T2 u/ n/ _; `1 g/ [
brw-rw---- 1 root disk 253, 2 Jan 21 22:35 /dev/mapper/dm-arch
* P+ @- }0 ]4 x# ]brw-rw---- 1 root disk 253, 1 Jan 21 22:52 /dev/mapper/dm-db
3 R; Q7 Y8 v+ C* f( y# P5 _3 [, S' | `; v9 }: H$ F6 z/ H
[root@TYEDI1 host4]# kpartx -a /dev/mapper/dm-app
- d8 r) W+ A% k5 G
1 t- q5 h, M8 z" [7 i3 ^" J6 e2 F0 Y, k& B4 Z4 y
[root@TYEDI1 host4]# ls -l /dev/mapper/dm-*
9 S% b" G& e/ R+ P- s; Kbrw-rw---- 1 root disk 253, 0 Jan 21 22:59 /dev/mapper/dm-app
1 ?3 l/ k4 I6 H1 p* s lbrw-rw---- 1 root disk 253, 3 Jan 21 23:01 /dev/mapper/dm-app1 & k" e) E9 |/ O7 x
brw-rw---- 1 root disk 253, 2 Jan 21 22:35 /dev/mapper/dm-arch
9 ?( N4 u, [ C2 w# |4 Y: ]brw-rw---- 1 root disk 253, 1 Jan 21 22:52 /dev/mapper/dm-db " I5 M% w; o' b2 t# s
: ]+ d, o* j$ B* C) b
|
- B/ |+ V( F c
; s g) k- X! C! n* M1 t4 k& e
. p3 \ {3 [$ G1 t" W
) w" {; H8 G1 i: Q; R0 w: N2 }# B8 ?6 Q
( o* ?1 j3 R* t
其他配置: 1. udev绑定权限 RHEL6.5,对于multipath的权限,手工去修改几秒后会变回root。所以需要使用udev去绑定好权限。 [backcolor=rgb(245, 245, 245) !important][url=] [/url]/ Q9 Z3 H: |& N4 C4 m! h. S
1)搜索对应的配置文件模板:[root@jyrac1 ~]# find / -name 12-*/usr/share/doc/device-mapper-1.02.79/12-dm-permissions.rules\
' H6 q" |) L# t2 {8 G7 f2)根据模板新增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] Q$ N9 A$ f; {; d/ w! w
8 E7 Q- f: T# `
" {1 J: o7 b. s! t7 [/ a8 V2 |
2 e1 P0 T1 U4 w( n* g- p# ^' g# B
6 J; f1 y* S! z
# @0 O# g; B! F
可以使用lsscsi查看识别的磁盘信息: [backcolor=rgb(245, 245, 245) !important][url=] [/url]! V4 m' N5 M: s: Q
[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]
! @5 K) v4 c8 M) a+ ~
: m8 R) j2 \" Q! y! {+ ~1 n' { `& |1 O1 R0 e8 t
% h: L/ A$ w; l0 {- O3 m; R" G3 z+ Y; k
$ C* g0 ^" _$ `6 f
1. multipath常用操作: multipath -r (修改multipath.conf配置文件之后重新加载)
6 w, L$ D+ W9 s; }' H; [' fmultipath -ll (查看多路径状态)
2 g5 L, c8 c7 A* \5 omultipath -v2 (格式化路径,检测路径,合并路径)
# b8 _: w% ^! `% @! Lmultipath -v3 (查看多路径详情blacklist、whitelist和设备wwid)
5 B8 X. d3 n5 H; Umultipath -F (删除现有链路) 2. multipath文件详细介绍 接下来的工作就是要编辑/etc/multipath.conf的配置文件 multipath.conf主要包括blacklist、multipaths、devices三部份的配置
7 c1 A& K' w# @1 r' O6 R1 Zblacklist配置5 C# G1 t2 Y1 W" h9 n8 V. G6 T! \
blacklist {
/ I) Y* L9 r' k/ K7 T3 i3 f$ B devnode "^sda"
" v& ^1 I% T% R9 }8 v3 q; V$ a}
: [7 V9 l' D7 |4 j0 UMultipaths部分配置multipaths和devices两部份的配置。$ X. s- G. J. [# s! H" ] K- P
multipaths {
0 x* N R. Q+ B" t& j4 R! _! H) m multipath {6 [& t" m& Z( K' P* ~ T* f) T2 i, D
wwid **************** #此值multipath -v3可以看到* C+ Y8 `' D4 x' m; h) h
alias iscsi-dm0 #映射后的别名,可以随便取
* k- r2 U" l5 Y4 L' t0 o path_grouping_policy multibus #路径组策略
: O' G) I2 ?& L path_checker tur #决定路径状态的方法
9 Y, E `, ^4 c5 k% K' ^ path_selector "round-robin 0" #选择那条路径进行下一个IO操作的方法
- W; h( p- p7 X9 H }
1 m8 ^# d# x+ p/ Q7 V4 M}% g |; O1 u: z: [0 ~
Devices部分配置
& l% K& J3 L' O1 U0 _% Ndevices {
, t% [6 T* a; s' Y* O device {: P- ~. v J! V3 m
vendor "iSCSI-Enterprise" #厂商名称- D I9 d3 F& f" G F( @- D6 Z
product "Virtual disk" #产品型号! L0 `# V4 ^- ^' N; g
path_grouping_policy multibus #默认的路径组策略( t# Z6 F- Y. m6 {
getuid_callout "/sbin/scsi_id -g -u -s /block/%n" #获得唯一设备号使用的默认程序
: E& O9 u5 s+ T7 z" W1 x. W prio_callout "/sbin/acs_prio_alua %d" #获取有限级数值使用的默认程序: y2 S2 F+ [4 p' b, |8 O; r* Y
path_checker readsector0 #决定路径状态的方法0 d4 I( @* d3 b8 w$ l1 ]7 n* E: B
path_selector "round-robin 0" #选择那条路径进行下一个IO操作的方法, J: v6 i( d! v' B1 u g! m6 l
failback immediate #故障恢复的模式& i8 B7 |5 \) J) X8 s4 C9 K
no_path_retry queue #在disable queue之前系统尝试使用失效路径的次数的数值1 c9 }) R; f S0 {8 h8 @
rr_min_io 100 #在当前的用户组中,在切换到另外一条路径之前的IO请求的数目
5 D3 ^! X! J1 i! W6 o }
; v. D: m G! H3 {9 G}
( N& }: \: z" {3 Z相关参数的标准文档的介绍: Attribute Description
. Z& [* [$ U& t4 s+ [8 Owwid Specifies the WWID of the multipath device to which the multipath attributes apply. This parameter is mandatory for this section of themultipath.conf file. / q* f: m4 O8 C( P6 P
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. . [6 \1 l: Z" P/ N4 j K
path_grouping_policy Specifies the default path grouping policy to apply to unspecified multipaths. Possible values include:
( b6 Y/ w8 @: I' } @failover = 1 path per priority group
Y0 p5 h, _1 n8 y+ `multibus = all valid paths in 1 priority group
9 m' N: z( C, H# J9 \) Agroup_by_serial = 1 priority group per detected serial number
+ c- [3 z& M3 G2 g+ ygroup_by_prio = 1 priority group per path priority value
/ j; p4 j5 W$ P" D0 n, K: @# Fgroup_by_node_name = 1 priority group per target node name 7 q6 g- \4 u) L9 a
path_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. | 3 G1 U6 n* {& H2 p8 u b
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. | & U4 E# r8 V/ U. a
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. |
0 h4 C. W+ I1 _8 q0 Fno_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. | 0 B& d. Z& ?" z+ y
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. & ?- t" k6 N+ @
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.
+ N- n& [9 l- c/ h) |: I* s, Jrr_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.
% S9 b: ?" W: R& q9 p8 F4 D! fflush_on_last_del If set to yes, then multipath will disable queueing when the last path to a device has been deleted.
# A& k# W1 Y8 \8 t' U ?4 a5 q$ i. J, g3 y
multipath与oracle ASM结合 https://www.cnblogs.com/jyzhao/p/7208620.html
! \; r, v' S6 g: L2 O已有配置文件: [backcolor=rgb(245, 245, 245) !important][url=] [/url]8 N& g `* p' e& q- z. G, `; 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]$ f4 p& i% \3 v- u6 F; ?) |5 g
& L5 w+ x, Z) p/ `5 P |