linux多路徑multipath配置

煙花丶易冷發表於2017-01-05

OS:oracle linux6.8
儲存:HP EVA8100(儲存過老,不支援軟體安裝)
1、檢視多路徑軟體包是否安裝
[root@node1 ~]# rpm -qa|grep device
device-mapper-event-libs-1.02.117-7.el6.x86_64
device-mapper-libs-1.02.117-7.el6.x86_64
device-mapper-event-1.02.117-7.el6.x86_64
device-mapper-persistent-data-0.6.2-0.1.rc7.el6.x86_64
device-mapper-multipath-libs-0.4.9-93.0.1.el6.x86_64
libimobiledevice-0.9.7-4.el6.x86_64
device-mapper-1.02.117-7.el6.x86_64
PackageKit-device-rebind-0.5.8-26.0.1.el6.x86_64
device-mapper-multipath-0.4.9-93.0.1.el6.x86_64 ?   ---如果未安裝則找到系統包進行安裝
設定開機自啟動,檢查安裝包是否正常
chkconfig –level 2345 multipathd on
lsmod |grep dm_multipath
2.配置multipathd 使其正常工作,編輯/etc/multipath.conf,開放如下內容:

defaults {
       udev_dir                /dev
       polling_interval        5
       path_grouping_policy    failover
       getuid_callout          "/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/%n"
       prio                    const
       path_checker            directio
       rr_min_io               1000
       rr_weight               uniform
       failback                manual
       no_path_retry           fail
       user_friendly_names     yes
}
blacklist {
        devnode "^hd[a-z]"
        devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
}
multipaths {
        multipath {
                wwid                    3600508b4000c3bcf0000e00005630000
                   alias                   asm-diskb
    
#               path_grouping_policy    multibus
#               path_checker            readsector0
#               path_selector           "round-robin 0"
#               failback                manual
#               rr_weight               priorities
#               no_path_retry           5
#       }
        multipath {
                wwid                    3600508b4000c3bcf0000e00005660000
                alias                   asm-diskc
devices {
device {
vendor "iSCSI-Enterprise"
product "Virtual disk"
path_grouping_policy multibus
getuid_callout "/sbin/scsi_id -g -u -s /block/%n"
path_checker readsector0
path_selector "round-robin 0"
}
}

如果沒有multipath檔案,可以執行下列命令試試
[root@node1 multipath]# mpathconf --enable --with_multipathd y
[root@node1 multipath]# multipath -v$ |grep uid
[root@node1 multipath]# multipath -v3|grep 3600

3、重啟multipath服務
[root@node1 etc]# service multipathd restart
ok
Stopping multipathd daemon:                                [  OK  ]
Starting multipathd daemon:                                [  OK  ]
4.[root@node1 mapper]# multipath -ll
asm-diskb (3600508b4000c3bcf0000e00005630000) dm-0 HP,HSV210
size=5.0G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| |- 1:0:0:1 sdb 8:16  active ready running
| |- 2:0:0:1 sdj 8:144 active ready running
| |- 1:0:3:1 sdh 8:112 active ready running
| `- 2:0:3:1 sdp 8:240 active ready running
`-+- policy='round-robin 0' prio=10 status=enabled
  |- 1:0:1:1 sdd 8:48  active ready running
  |- 2:0:1:1 sdl 8:176 active ready running
  |- 1:0:2:1 sdf 8:80  active ready running
  `- 2:0:2:1 sdn 8:208 active ready running
asm-diskc (3600508b4000c3bcf0000e00005660000) dm-1 HP,HSV210
size=300G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| `- 1:0:1:2 sde 8:64  active ready running
|-+- policy='round-robin 0' prio=50 status=enabled
| `- 1:0:2:2 sdg 8:96  active ready running
|-+- policy='round-robin 0' prio=50 status=enabled
| `- 2:0:1:2 sdm 8:192 active ready running
|-+- policy='round-robin 0' prio=50 status=enabled
| `- 2:0:2:2 sdo 8:224 active ready running
|-+- policy='round-robin 0' prio=10 status=enabled
| `- 1:0:0:2 sdc 8:32  active ready running
|-+- policy='round-robin 0' prio=10 status=enabled
| `- 1:0:3:2 sdi 8:128 active ready running
|-+- policy='round-robin 0' prio=10 status=enabled
| `- 2:0:0:2 sdk 8:160 active ready running
`-+- policy='round-robin 0' prio=10 status=enabled
  `- 2:0:3:2 sdq 65:0  active ready running
 4、檢視ASM磁碟組
[root@node1 mapper]# ls -l /dev/mapper/

total 0
lrwxrwxrwx. 1 root root       7 Dec 29 15:52 asm-diskb -> ../dm-0
lrwxrwxrwx. 1 root root       7 Dec 29 15:52 asm-diskc -> ../dm-1
crw-rw----. 1 root root 10, 236 Dec 29 09:54 control
[root@node1 mapper]# ls
asm-diskb  asm-diskc  control
5、udev繫結磁碟
[root@node1 ~]# cat /etc/udev/rules.d/99-oracle-asmdevices.rules 

ENV{DM_NAME}=="asm-diska", OWNER:="grid", GROUP:="asmadmin", MODE:="660"
ENV{DM_NAME}=="asm-diskb", OWNER:="grid", GROUP:="asmadmin", MODE:="660"
ENV{DM_NAME}=="asm-diskc", OWNER:="grid", GROUP:="asmadmin", MODE:="660"

[root@node1 rules.d]# start_udev
Starting udev:                                             [  OK  ]

[root@node1 rules.d]# ls -l /dev/mapper/
total 0
lrwxrwxrwx 1 root root       7 Jul  1 15:18 asm-diska -> ../dm-2
lrwxrwxrwx 1 root root       7 Jul  1 15:18 asm-diskb -> ../dm-3
lrwxrwxrwx 1 root root       7 Jul  1 15:18 asm-diskc -> ../dm-4
crw-rw---- 1 root root 10, 236 Jul  1 15:18 control
lrwxrwxrwx 1 root root       7 Jul  1 15:18 vg_oel-lv_root -> ../dm-0
lrwxrwxrwx 1 root root       7 Jul  1 15:18 vg_oel-lv_swap -> ../dm-1
[root@node1 rules.d]# ls -l /dev/dm-*
brw-rw---- 1 root disk     252, 0 Jul  1 15:18 /dev/dm-0
brw-rw---- 1 root disk     252, 1 Jul  1 15:18 /dev/dm-1
brw-rw---- 1 grid asmadmin 252, 2 Jul  1 15:18 /dev/dm-2
brw-rw---- 1 grid asmadmin 252, 3 Jul  1 15:18 /dev/dm-3
brw-rw---- 1 grid asmadmin 252, 4 Jul  1 15:18 /dev/dm-4

在建立asm磁碟組的時候,路徑選擇/dev/mapper/*,可自動識別到聚合後的磁碟,雖然軟連線的許可權還是root,但實際磁碟已改變,asm可用。
繫結磁碟還有一種方式:

[root@pdmdb1 ~]# cat /etc/rc.local

#!/bin/sh

#

# This script will be executed *after* all the other init scripts.

# You can put your own initialization stuff in here if you don't

# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

chown grid:asmadmin /dev/dm-0

chown grid:asmadmin /dev/dm-1

chmod 660 /dev/dm-0

chmod 660 /dev/dm-1
--配置別名已經在multipath.conf裡面配置過了




來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29618264/viewspace-2131954/,如需轉載,請註明出處,否則將追究法律責任。

相關文章