LINUX自带多路径详解

本文发布时间: 2019-Mar-22
一、多路径解释多路径,顾名思义就是有多种选择的路径。在SAN或IPSAN环境,主机和存储之间外加了光纤交换机,这就导致主机和存储之间交换速度和效率增强,一条路径肯定是不行的,也是不安全不稳定的。多路径就是要来解决从主机到磁盘之间最快,最高效的问题。主要实现如下几个功能故障的切换和恢复IO流量的负载均衡磁盘的虚拟化多路径之前一直是存储厂商负责解决,竟来被拆分出来单独卖钱了。构架基本是这样的:存储,多路径软件,光纤交换机,主机,主机系统。二、LINUX下的multipath1、查看是否自带安装?[[email protected] multipath]# rpm -qa|grep devicedevice-mapper-1.02.39-1.el5device-mapper-1.02.39-1.el5device-mapper-multipath-0.4.7-34.el5device-mapper-event-1.02.39-1.el5[[email protected] multipath]# 2、安装rpm -ivh device-mapper-1.02.39-1.el5.rpm #安装映射包rpm -ivh device-mapper-multipath-0.4.7-34.el5.rpm #安装多路径包外加加入开机启动chkconfig –level 2345 multipathd on #设置成开机自启动multipathdlsmod |grep dm_multipath #来检查安装是否正常3、配置# on the default devices.blacklist {devnode "^(ram|raw|loop|fd|md|dm-|sr|sr|scd|st)[0-9]*"devnode "^hd[a-z]"}devices {device {vendor "HP"path_grouping_policy multibusfeatures "1 queue_if_no_path"path_checker readsector()failback immediate}}完整的配置如下:blacklist {devnode "^sda"}defaults {user_friendly_names no}multipaths {multipath {wwid14945540000000000a67854c6270b4359c66c272e2f356321aliasiscsi-dm0path_grouping_policymultibuspath_checkerturpath_selector"round-robin 0"}multipath {wwid14945540000000000dcca2eda91d70b81edbcfce2357f99eealiasiscsi-dm1path_grouping_policymultibuspath_checkerturpath_selector"round-robin 0"}multipath {wwid1494554000000000020f763489c165561101813333957ed96aliasiscsi-dm2path_grouping_policymultibuspath_checkerturpath_selector"round-robin 0"}multipath {wwid14945540000000000919ca813020a195422ba3663e1f03cc3aliasiscsi-dm3path_grouping_policymultibuspath_checkerturpath_selector"round-robin 0"}}devices {device {vendor"iSCSI-Enterprise"product"Virtual disk"path_grouping_policymultibusgetuid_callout"/sbin/scsi_id -g -u -s /block/%n"path_checkerreadsector0path_selector"round-robin 0"}}4、命令[[email protected] ~]# multipath -hmultipath-tools v0.4.7 (03/12, 2006)Usage: multipath [-v level] [-d] [-h|-l|-ll|-f|-F|-r] [-p failover|multibus|group_by_serial|group_by_prio] [device] -v level verbosity level 0 no output 1 print created devmap names only 2 default verbosity 3 print debug information -h print this usage text -b file bindings file location -d dry run, do not create or update devmaps -l show multipath topology (sysfs and DM info) -ll show multipath topology (maximum info) -f flush a multipath device map -F flush all multipath device maps -r force devmap reload -p policy force all maps to specified policy : failover 1 path per priority group multibus all paths in 1 priority group group_by_serial 1 priority group per serial group_by_prio 1 priority group per priority lvl group_by_node_name 1 priority group per target node device limit scope to the device's multipath (udev-style $DEVNAME reference, eg /dev/sdb or major:minor or a device map name)[[email protected] ~]# 5、启动关闭# /etc/init.d/multipathd start #开启mulitipath服务service multipath startservice multipath restartservice multipath shutdown6、如何获取wwid1、[[email protected] ~]# cat /var/lib/multipath/bindings# Multipath bindings, Version : 1.0# NOTE: this file is automatically maintained by the multipath program.# You should not need to edit this file in normal circumstances.## Format:# alias wwid#mpath0 36006016051d50e0035744871c912de11mpath3 36006016051d50e0034744871c912de11mpath4 36006016051d50e0032744871c912de11mpath3 36006016051d50e0039744871c912de11mpath4 36006016051d50e003a744871c912de112、[[email protected] ~]# multipath -v3 |grep 3600sdb: uid = 36006016051d50e003a744871c912de11 (callout)sdc: uid = 36006016051d50e003a744871c912de11 (callout)sdd: uid = 36006016051d50e003a744871c912de11 (callout)sde: uid = 36006016051d50e003a744871c912de11 (callout)36006016051d50e003a744871c912de11 1:0:0:0 sdb 8:16 0 [undef][ready] DGC,RAI36006016051d50e003a744871c912de11 1:0:1:0 sdc 8:32 1 [undef][ready] DGC,RAI36006016051d50e003a744871c912de11 2:0:0:0 sdd 8:48 1 [undef][ready] DGC,RAI36006016051d50e003a744871c912de11 2:0:1:0 sde 8:64 0 [undef][ready] DGC,RAIFound matching wwid [36006016051d50e003a744871c912de11] in bindings file.


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2020-Jul-13 01:14am
栏目列表