Linux系统怎么配置多路径

Linux系统怎么配置多路径,第1张

Linux多路径指的是除了主机和硬盘一条路径的连接,还包括了主机和网络服务器的连接形成的主机一对多的路径连接关系。通过多路径的连接,实现了磁盘的虚拟化。

1、安装多路径软件包:

device-mapper-1.02.67-2.el5

device-mapper-event-1.02.67.2.el5

device-mapper-multipath-0.4.7-48.el5

[root@RKDB01 Server]# rpm -ivh device-mapper-1.02.67-2.el5.x86_64.rpm

warning: device-mapper-1.02.67-2.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing.。。 ########################################### [100%]

package device-mapper-1.02.67-2.el5.x86_64 is already installed

[root@RKDB01 Server]# rpm -ivh device-mapper-event-1.02.67-2.el5.x86_64.rpm

warning: device-mapper-event-1.02.67-2.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing.。。 ########################################### [100%]

package device-mapper-event-1.02.67-2.el5.x86_64 is already installed

[root@RKDB01 Server]# rpm -ivh device-mapper-multipath-0.4.7-48.el5.x86_64.rpm

warning: device-mapper-multipath-0.4.7-48.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing.。。 ########################################### [100%]

package device-mapper-multipath-0.4.7-48.el5.x86_64 is already installed

2、设置开机启动,并检查安装包是否正常:

chkconfig --level 345 multipathd on

lsmod |grep dm_multipath

[root@RKDB01 Server]# chkconfig --level 345 multipathd on

[root@RKDB01 Server]# lsmod |grep dm_multipath

dm_multipath 58969 0

scsi_dh 42561 1 dm_multipath

dm_mod 102417 4 dm_mirror,dm_multipath,dm_raid45,dm_log

[root@RKDB01 Server]#

3、配置multipathd 使其正常工作,编辑/etc/multipath.conf,开放如下内容:

defaults {

udev_dir /dev

polling_interval 10

selector “round-robin 0”

path_grouping_policy multibus

getuid_callout “/sbin/scsi_id -g -u -s /block/%n”

prio_callout none

path_checker readsector0

rr_min_io 100

max_fds 8192

rr_weight priorities

failback immediate

no_path_retry fail

user_friendly_names yes

}

blacklist {

wwid 26353900f02796769

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

devnode “^hd[a-z]”

}

4、并关闭如下内容

#blacklist {

# devnode “*”

#}

#defaults {

27 # user_friendly_names yes

28 #}

5、完成之后执行如下命令发现多路径:

[root@RKDB01 Server]# modprobe dm-multipath

[root@RKDB01 Server]# multipath -F

[root@RKDB01 Server]# multipath dm-multipath

[root@RKDB01 Server]# multipath dm-round-robin

[root@RKDB01 Server]# service multipathd restart

正在关闭multipathd 端口监控程序: [确定]

正在启动守护进程multipathd: [确定]

[root@RKDB01 Server]# multipath -v2

[root@RKDB01 Server]# multipath -v2

[root@RKDB01 Server]# multipath -ll

mpath1 (3600d02310000011b16a5d57c6a1bd99a) dm-0 TOYOU,NetStor_iSUM510

[size=3.3T][features=0][hwhandler=0][rw]

\_ round-robin 0 [prio=2][ena bled]

\_ 1:0:0:0 sdb 8:16 [failed][ready]

\_ 1:0:1:0 sdc 8:32 [failed][ready]

[root@RKDB01 Server]#

6、重启服务器后,可以看到多路径信息了:

[root@RKDB01 ~]# ll /dev/mapper/

总计 0

crw------- 1 root root 10, 60 11-05 22:35 control

brw-rw---- 1 root disk 253, 0 11-05 22:35 mpath1

brw-rw---- 1 root disk 253, 1 11-05 22:35 mpath2

[root@RKDB01 ~]# multipath -ll

mpath2 (3600d02310000011b76128b9c63138cf4) dm-1 TOYOU,NetStor_iSUM510

[size=3.2T][features=0][hwhandler=0][rw]

\_ round-robin 0 [prio=2][active]

\_ 1:0:0:1 sdc 8:32 [active][ready]

\_ 1:0:1:1 sde 8:64 [active][ready]

mpath1 (3600d02310000011b16a5d57c6a1bd99a) dm-0 TOYOU,NetStor_iSUM510

[size=20G][features=0][hwhandler=0][rw]

\_ round-robin 0 [prio=2][active]

\_ 1:0:0:0 sdb 8:16 [active][ready]

\_ 1:0:1:0 sdd 8:48 [active][ready]

7、通过fdisk 看可以生成了DM-0/DM-1两个盘,正是上面sdc/sde,sdb/sdd多路径后出来的:

[root@RKDB01 ~]# fdisk -l

Disk /dev/sda: 299.4 GB, 299439751168 bytes

255 heads, 63 sectors/track, 36404 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sda1 * 1 38 305203+ 83 Linux

/dev/sda2 39 13092 104856255 83 Linux

/dev/sda3 13093 19619 52428127+ 83 Linux

/dev/sda4 19620 36404 134825512+ 5 Extended

/dev/sda5 19620 26146 52428096 83 Linux

/dev/sda6 26147 28757 20972826 83 Linux

/dev/sda7 28758 30324 12586896 82 Linux swap / Solaris

/dev/sda8 30325 36404 48837568+ 83 Linux

Disk /dev/sdb: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn‘t contain a valid partition table

Disk /dev/sdc: 3568.4 GB, 3568429957120 bytes

255 heads, 63 sectors/track, 433836 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdc doesn’t contain a valid partition table

Disk /dev/sdd: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdd doesn‘t contain a valid partition table

Disk /dev/sde: 3568.4 GB, 3568429957120 bytes

255 heads, 63 sectors/track, 433836 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sde doesn’t contain a valid partition table

Disk /dev/dm-0: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-0 doesn‘t contain a valid partition table

Disk /dev/dm-1: 3568.4 GB, 3568429957120 bytes

255 heads, 63 sectors/track, 433836 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-1 doesn’t contain a valid partition table

Disk /dev/sdf: 4009 MB, 4009754624 bytes

255 heads, 63 sectors/track, 487 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sdf4 * 1 488 3915744+ b W95 FAT32

Partition 4 has different physical/logical endings:

phys=(486, 254, 63) logical=(487, 125, 22)

[root@RKDB01 ~]#

8、同时也可以在/dev/mapper目录中查看到多路径映射的信息:

[root@RKDB01 ~]# ll /dev/mapper/

总计 0

crw------- 1 root root 10, 60 11-06 00:49 control

brw-rw---- 1 root disk 253, 2 11-06 00:49 data-data001

brw-rw---- 1 root disk 253, 0 11-06 00:49 mpath1

brw-rw---- 1 root disk 253, 1 11-06 00:49 mpath2

如果使用了多路径方案,可以直接使用multipath绑定设备名不需要用到asmlib或UDEV请直接参考文档:Configuringnon-rawmultipathdevicesforOracleClusterware11g(11.1.0,11.2.0)onRHEL5/OL5[ID605828.1][root@vrh1~]#foriin`cat/proc/partitions|awk'{print$4}'|grepsd|grep[a-z]$`doecho"###$i:`scsi_id-g-u-s/block/$i`"done###sda:SATA_VBOX_HARDDISK_VB83d4445f-b8790695_###sdb:SATA_VBOX_HARDDISK_VB0db2f233-269850e0_###sdc:SATA_VBOX_HARDDISK_VBa56f2571-0dd27b33_###sdd:SATA_VBOX_HARDDISK_VBf6b74ff7-871d1de8_###sde:SATA_VBOX_HARDDISK_VB5a531910-25f4eb9a_###sdf:SATA_VBOX_HARDDISK_VB4915e6e3-737b312e_###sdg:SATA_VBOX_HARDDISK_VB512c8f75-37f4a0e9_###sdh:SATA_VBOX_HARDDISK_VBc0115ef6-a48bc15d_###sdi:SATA_VBOX_HARDDISK_VB3a556907-2b72391d_###sdj:SATA_VBOX_HARDDISK_VB7ec8476c-08641bd4_###sdk:SATA_VBOX_HARDDISK_VB743e1567-d0009678_[root@vrh1~]#grep-v^#/etc/multipath.confdefaults{user_friendly_namesyes}defaults{udev_dir/devpolling_interval10selector"round-robin0"path_grouping_policyfailovergetuid_callout"/sbin/scsi_id-g-u-s/block/%n"prio_callout/bin/truepath_checkerreadsector0rr_min_io100rr_weightprioritiesfailbackimmediate#no_path_retryfailuser_friendly_nameyes}devnode_blacklist{devnode"^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"devnode"^hd[a-z]"devnode"^cciss!c[0-9]d[0-9]*"}multipaths{multipath{wwidSATA_VBOX_HARDDISK_VB0db2f233-269850e0_aliasvoting1path_grouping_policyfailover}multipath{wwidSATA_VBOX_HARDDISK_VBa56f2571-0dd27b33_aliasvoting2path_grouping_policyfailover}multipath{wwidSATA_VBOX_HARDDISK_VBf6b74ff7-871d1de8_aliasvoting3path_grouping_policyfailover}multipath{wwidSATA_VBOX_HARDDISK_VB5a531910-25f4eb9a_aliasocr1path_grouping_policyfailover}multipath{wwidSATA_VBOX_HARDDISK_VB4915e6e3-737b312e_aliasocr2path_grouping_policyfailover}multipath{wwidSATA_VBOX_HARDDISK_VB512c8f75-37f4a0e9_aliasocr3path_grouping_policyfailover}}[root@vrh1~]#multipath[root@vrh1~]#multipath-llmpath2(SATA_VBOX_HARDDISK_VB3a556907-2b72391d_)dm-9ATA,VBOXHARDDISKsize=5.0Gfeatures='0'hwhandler='0'wp=rw`-+-policy='round-robin0'prio=1status=active`-8:0:0:0sdi8:128activereadyrunningmpath1(SATA_VBOX_HARDDISK_VBc0115ef6-a48bc15d_)dm-8ATA,VBOXHARDDISKsize=5.0Gfeatures='0'hwhandler='0'wp=rw`-+-policy='round-robin0'prio=1status=active`-7:0:0:0sdh8:112activereadyrunningocr3(SATA_VBOX_HARDDISK_VB512c8f75-37f4a0e9_)dm-7ATA,VBOXHARDDISKsize=5.0Gfeatures='0'hwhandler='0'wp=rw`-+-policy='round-robin0'prio=1status=active`-6:0:0:0sdg8:96activereadyrunningocr2(SATA_VBOX_HARDDISK_VB4915e6e3-737b312e_)dm-6ATA,VBOXHARDDISKsize=5.0Gfeatures='0'hwhandler='0'wp=rw`-+-policy='round-robin0'prio=1status=active`-5:0:0:0sdf8:80activereadyrunningocr1(SATA_VBOX_HARDDISK_VB5a531910-25f4eb9a_)dm-5ATA,VBOXHARDDISKsize=5.0Gfeatures='0'hwhandler='0'wp=rw`-+-policy='round-robin0'prio=1status=active`-4:0:0:0sde8:64activereadyrunningvoting3(SATA_VBOX_HARDDISK_VBf6b74ff7-871d1de8_)dm-4ATA,VBOXHARDDISKsize=40Gfeatures='0'hwhandler='0'wp=rw`-+-policy='round-robin0'prio=1status=active`-3:0:0:0sdd8:48activereadyrunningvoting2(SATA_VBOX_HARDDISK_VBa56f2571-0dd27b33_)dm-3ATA,VBOXHARDDISKsize=40Gfeatures='0'hwhandler='0'wp=rw`-+-policy='round-robin0'prio=1status=active`-2:0:0:0sdc8:32activereadyrunningvoting1(SATA_VBOX_HARDDISK_VB0db2f233-269850e0_)dm-2ATA,VBOXHARDDISKsize=40Gfeatures='0'hwhandler='0'wp=rw`-+-policy='round-robin0'prio=1status=active`-1:0:0:0sdb8:16activereadyrunningmpath4(SATA_VBOX_HARDDISK_VB743e1567-d0009678_)dm-11ATA,VBOXHARDDISKsize=5.0Gfeatures='0'hwhandler='0'wp=rw`-+-policy='round-robin0'prio=1status=active`-10:0:0:0sdk8:160activereadyrunningmpath3(SATA_VBOX_HARDDISK_VB7ec8476c-08641bd4_)dm-10ATA,VBOXHARDDISKsize=5.0Gfeatures='0'hwhandler='0'wp=rw`-+-policy='round-robin0'prio=1status=active`-9:0:0:0sdj8:144activereadyrunning[root@vrh1~]#dmsetupls|sortmpath1(253,8)mpath2(253,9)mpath3(253,10)mpath4(253,11)ocr1(253,5)ocr2(253,6)ocr3(253,7)VolGroup00-LogVol00(253,0)VolGroup00-LogVol01(253,1)voting1(253,2)voting2(253,3)voting3(253,4)[root@vrh1~]#ls-l/dev/mapper/*crw-------1rootroot10,62Oct1709:58/dev/mapper/controlbrw-rw----1rootdisk253,8Oct1900:11/dev/mapper/mpath1brw-rw----1rootdisk253,9Oct1900:11/dev/mapper/mpath2brw-rw----1rootdisk253,10Oct1900:11/dev/mapper/mpath3brw-rw----1rootdisk253,11Oct1900:11/dev/mapper/mpath4brw-rw----1rootdisk253,5Oct1900:11/dev/mapper/ocr1brw-rw----1rootdisk253,6Oct1900:11/dev/mapper/ocr2brw-rw----1rootdisk253,7Oct1900:11/dev/mapper/ocr3brw-rw----1rootdisk253,0Oct1709:58/dev/mapper/VolGroup00-LogVol00brw-rw----1rootdisk253,1Oct1709:58/dev/mapper/VolGroup00-LogVol01brw-rw----1rootdisk253,2Oct1900:11/dev/mapper/voting1brw-rw----1rootdisk253,3Oct1900:11/dev/mapper/voting2brw-rw----1rootdisk253,4Oct1900:11/dev/mapper/voting3[root@vrh1~]#ls-l/dev/dm*brw-rw----1rootroot253,0Oct1709:58/dev/dm-0brw-rw----1rootroot253,1Oct1709:58/dev/dm-1brw-rw----1rootroot253,10Oct1900:11/dev/dm-10brw-rw----1rootroot253,11Oct1900:11/dev/dm-11brw-rw----1rootroot253,2Oct1900:11/dev/dm-2brw-rw----1rootroot253,3Oct1900:11/dev/dm-3brw-rw----1rootroot253,4Oct1900:11/dev/dm-4brw-rw----1rootroot253,5Oct1900:11/dev/dm-5brw-rw----1rootroot253,6Oct1900:11/dev/dm-6brw-rw----1rootroot253,7Oct1900:11/dev/dm-7brw-rw----1rootroot253,8Oct1900:11/dev/dm-8brw-rw----1rootroot253,9Oct1900:11/dev/dm-9[root@vrh1~]#ls-l/dev/disk/by-id/total0lrwxrwxrwx1rootroot15Oct1709:58scsi-SATA_VBOX_HARDDISK_VB0db2f233-269850e0->../../asm-diskblrwxrwxrwx1rootroot15Oct1709:58scsi-SATA_VBOX_HARDDISK_VB3a556907-2b72391d->../../asm-diskilrwxrwxrwx1rootroot15Oct1709:58scsi-SATA_VBOX_HARDDISK_VB4915e6e3-737b312e->../../asm-diskflrwxrwxrwx1rootroot15Oct1709:58scsi-SATA_VBOX_HARDDISK_VB512c8f75-37f4a0e9->../../asm-diskglrwxrwxrwx1rootroot15Oct1709:58scsi-SATA_VBOX_HARDDISK_VB5a531910-25f4eb9a->../../asm-diskelrwxrwxrwx1rootroot15Oct1709:58scsi-SATA_VBOX_HARDDISK_VB743e1567-d0009678->../../asm-diskklrwxrwxrwx1rootroot15Oct1709:58scsi-SATA_VBOX_HARDDISK_VB7ec8476c-08641bd4->../../asm-diskjlrwxrwxrwx1rootroot9Oct1709:58scsi-SATA_VBOX_HARDDISK_VB83d4445f-b8790695->../../sdalrwxrwxrwx1rootroot10Oct1709:58scsi-SATA_VBOX_HARDDISK_VB83d4445f-b8790695-part1->../../sda1lrwxrwxrwx1rootroot10Oct1709:58scsi-SATA_VBOX_HARDDISK_VB83d4445f-b8790695-part2->../../sda2lrwxrwxrwx1rootroot15Oct1709:58scsi-SATA_VBOX_HARDDISK_VBa56f2571-0dd27b33->../../asm-diskclrwxrwxrwx1rootroot15Oct1709:58scsi-SATA_VBOX_HARDDISK_VBc0115ef6-a48bc15d->../../asm-diskhlrwxrwxrwx1rootroot15Oct1709:58scsi-SATA_VBOX_HARDDISK_VBf6b74ff7-871d1de8->../../asm-diskdReportAbuseLike(0)2.Re:asm磁盘使用链路聚合设备名,IO性能只有非聚合设备的1/6!LiuMaclean(刘相兵)ExpertLiuMaclean(刘相兵)Jul21,201311:09AM(inresponseto13628)step1:[oracle@vrh8mapper]$cat/etc/multipath.confmultipaths{multipath{wwidSATA_VBOX_HARDDISK_VBf6b74ff7-871d1de8_aliasasm-disk1mode660uid501gid503}multipath{wwidSATA_VBOX_HARDDISK_VB0db2f233-269850e0_aliasasm-disk2mode660uid501gid503}multipath{wwidSATA_VBOX_HARDDISK_VBa56f2571-0dd27b33_aliasasm-disk3mode660uid501gid503}}第二步:rebootorservicemultipathdrestart第三步:[oracle@vrh8mapper]$ls-l/dev/mapper/asm-disk*brw-rw----1gridasmadmin253,4Jul2107:02/dev/mapper/asm-disk1brw-rw----1gridasmadmin253,2Jul2107:02/dev/mapper/asm-disk2brw-rw----1gridasmadmin253,3Jul2107:02/dev/mapper/asm-disk3


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11808467.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-18
下一篇 2023-05-18

发表评论

登录后才能评论

评论列表(0条)

保存