Linux MultiPath多路径软件如何实施

60次阅读
没有评论

共计 5654 个字符,预计需要花费 15 分钟才能阅读完成。

这篇文章主要介绍“Linux MultiPath 多路径软件如何实施”,在日常操作中,相信很多人在 Linux MultiPath 多路径软件如何实施问题上存在疑惑,丸趣 TV 小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”Linux MultiPath 多路径软件如何实施”的疑惑有所帮助!接下来,请跟着丸趣 TV 小编一起来学习吧!

Multipath 的工作原理

  当 multipath 启动的时候,它通过系统命令 scsi_id -eg -s /block/sdX 得到 proc/partitions 里面所有块设备的 UUID(universally unique identify),然后把所有具有同一个 UUID 的块设备组成一个 Group,在 /dev/mapper 生产一个对应的单独的设备。当设备生成后就可以使用 fdisk 或者 parted 进行分区,分区可以使用 kpartx 命令进行注册,然后就可以是用系统命令进行创建文件系统和 mount。

    一般在系列安装过程中都会同时安装 device-mapper 软件包,使用 linux 自带命令 rpm 查询一下是否已经安装次软件包。使用命令 rpm –ivh 进行安装,安装以下 rpm 包:

device-mapper-*

device-mapper-multipath-*

device-mapper-1*

启动多路径及配置多路径

启动多路径,通过 mpathconf 命令创建默认模板。创建默认配置,启动和激活 multipathd 进程,可以使用以下命令:

mpathconf –enable –with_multipathd y

配置完成后建议重新启动多路径软件:

/etc/init.d/multipathd restart

备注:启动完成后会在 /etc/ 下生成 multipath.conf 文件以及在 /etc/multipath 下生成 bindings 及 wwid,其中 wwid 记录了系统中所有挂载盘的盘唯一 ID,Bindings 记录了 ID 对应的映射盘一般绑定完后会在 /dev/mapper 下产生类似于 mpathx 等文件

备注 ——————————————————

如果没有没有生成可以按照 Deploying Oracle RAC 11g R2 Database on Red Hat EnterpriseLinux 6

的如下方式来进行操作:

1. As the root user, install the device-mapper-multipath package using the yum package

manager.

# yum -y install device-mapper-multipath

2. Copy the multipath.conf file found within /usr/share/doc/device-mapper-multipath-0.4.9/ to /etc/

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

3. Capture the scsi id of the local disk(s) on the system.

# scsi_id –whitelisted –replace-whitespace –-device=/dev/sda

3600508b1001030353434363646301200

4. Uncomment and modify the blacklist section within the /etc/multipath.conf file to include

the scsi id of the local disk on the system. Once complete, save the changes made to

the multipath.conf file.

blacklist {

wwid 3600508b1001030353434363646301200

devnode ^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*

devnode ^hd[a-z]

}

5. Start the multipath daemon.

# service multipathd start

Starting multipathd daemon: [OK]

6. Enable the multipath daemon to ensure it is started upon boot time.

# chkconfig multipathd on

7. Identify the dm- device, size, and WWID of each device mapper volume for Oracle

OCR and voting disks, data disks and recovery disks. In this example, volume mpathb

is identified via the following command:

# multipath -ll

Figure  Multipath Device (mpathb)

8. Uncomment the defaults section found within the /etc/multipath.conf file.

defaults {

udev_dir /dev

polling_interval 10

path_selector round-robin 0

path_grouping_policy multibus

getuid_callout /lib/udev/scsi_id –whitelisted –device=/dev/%n

prio alua

path_checker readsector0

rr_min_io 100

max_fds 8192

rr_weight priorities

failback immediate

no_path_retry fail

user_friendly_names yes

}

NOTE: The standard options can be customized to better fit your storage array s

capabilities. Check with your storage vendor for details.

9. Un-comment the multipath section found within the /etc/multipath.conf file and create an alias for each device mapper volume in order to enable persistent naming of those volumes. Once complete, save the changes made to the multipath.conf file. The output should resemble the example below. For reference, refer the Oracle data volumes created for the reference environment as displayed in Table 2.4.3: Oracle OCR,Voting Disk, Data File Sizes.

/etc/multipath.conf

multipaths {

multipath {

wwid 3600c0ff000d7e7a854a0f65101000000

alias db1

}

multipath {

wwid 3600c0ff000dabfe562a0f65101000000

alias db2

}

multipath {

wwid 3600c0ff000d7e7a874a0f65101000000

alias fra

}

multipath {

wwid 3600c0ff000dabfe585a0f65101000000

alias redo

}

multipath {

wwid 3600c0ff000dabfe596a0f65101000000

alias ocrvote1

}

multipath {

wwid 3600c0ff000dabfe5a2a0f65101000000

alias ocrvote2

}

multipath {

wwid 3600c0ff000dabfe5b4a0f65101000000

alias ocrvote3

}

}

10.Restart the device mapper multipath daemon.

# service multipathd restart

ok

Stopping multipathd daemon: [OK]

Starting multipathd daemon: [OK]

11.Verify the device mapper paths and aliases are displayed properly. Below is an example of one device mapper device labeled fra.

# multipath -ll

fra (3600c0ff000d7e7a89e85ac5101000000) dm-10 HP,MSA2324fc

size=186G features= 1 queue_if_no_path hwhandler= 0 wp=rw

|-+- policy= round-robin 0 prio=130 status=active

| |- 3:0:0:3 sdd 8:48 active ready running

| |- 3:0:1:3 sdh 8:112 active ready running

| |- 4:0:0:3 sdt 65:48 active ready running

| `- 4:0:1:3 sdx 65:112 active ready running

`-+- policy= round-robin 0 prio=10 status=enabled

|- 3:0:2:3 sdl 8:176 active ready running

|- 3:0:3:3 sdp 8:240 active ready running

|- 4:0:2:3 sdab 65:176 active ready running

`- 4:0:3:3 sdaf 65:240 active ready running 

———————————————————————————————-

配置文件      

    默认情况下,DM-Multipath 为大多数多路径的使用提供配置值。另外,DM-Multipath 支持大多数常见的、支持 DM-Multipath 的存储阵列。默认配置值和支持的设备请参考 /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf.defaults 件。可以编辑 /etc/multipath.conf 覆盖 DM-Multipath 的默认配置。如果有必要,您还可以默认配置文件不支持的存储阵列。 

多路径配置文件可分为以下几个部分: 

blacklist

不被视为多路径的具体设备列表。 

blacklist_exceptions

根据 blacklist 部分中的参数列出不在黑名单中的多路径设备。 

defaults

DM-Multipath 的常规默认设置。 

multipaths

各个独立多路径设备的特性设置。这些数值覆盖了在配置文件的 defaults 和 devices 部分中指定的数值。 

devices

各个存储控制器的设置。这些数值覆盖了在配置文件的 defaults 部分指定的数值。如果您要使用不是默认支持的存储阵列,您可能需要为您的阵列创建 devices 子部分。 

当系统决定多路径设备的属性时,首先它会检查多路径设置,然后是每个设备的设置,然后才是多路径系统默认设置。

以上配置完成后,启动 multipathd 进程,进程启动后会自动 scan 设备,在 /dev/mapper 目录下可以看到 生成的设备 如:mapth5 
1. 使用命令 multipath 可以查看路径状态是否正常,

[root@dbserv1 mapper]# multipath -d -l

 
2. 使用系统 fdisk 命令分区后,使用命令   kpartx l  /dev/mapper/mpath5 查看分区信息

 
3. 如果未发现可以使用 kpartx d /dev/mapper/mpath5 命令进行注册分区  

4. 如果下使用 ASM 磁盘管理,则下一步就是通过 udev 进行配置分区权限和别名,以便让 Oracle 在 ASM 配置过程中能够看到这些分区。关于 udev 的具体配置过程在下篇文章中会进行说明。 

5. 当然也可以使用 Oracle ASMLib 来配置 ASM 磁盘,这个相对 udev 方式来时稍微麻烦,但是也有相应的好处,即,在 ASM 里多余出来空间通过配置能够让 OS 文件系统识别到。

 
6. 如果不用 Rac, 在单节点环境,则使用 mke2fs –j /dev/mapper/mapth5p1 在相对应的分区上创建文件系统  

7. 使用 mount 的命令挂载文件系统就可以用。

多路径基本维护命令

1. 启停多路径:

/etc/init.d/multipathd stop/start/reatart

2. 查看当前多路径链路状态及盘情况:

multipath –ll

3. 删除多路径设备:

multipath –F

4. 重新扫描设备:

multipath –v3

5. 当在 DM-Multipath 中添加新设备时,这些新设备会位于 /dev 目录的两个不同位置:

/dev/mapper/mpathn

/dev/dm-n

/dev/mapper 中的设备是在引导过程中生成的。可使用这些设备访问多路径设备,例如在生成逻辑卷时

所有 /dev/dm- n 格式的设备都只能是作为内部使用,请不要使用它们

到此,关于“Linux MultiPath 多路径软件如何实施”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注丸趣 TV 网站,丸趣 TV 小编会继续努力为大家带来更多实用的文章!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-08-03发表,共计5654字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)