linux6-multipath +udev 配置虚拟机共享存储

1.双节点安装multipath的包,先后顺序不能乱:

rpm -ivh device-mapper-multipath-libs-0.4.9-93.el6.x86_64.rpm
rpm -ivh device-mapper-multipath-0.4.9-93.el6.x86_64.rpm

2.启动multipath(rac1、rac2都跑)

modprobe dm-multipath
modprobe dm-round-robin
检查内核添加情况:
lsmod |grep multipath
将多路径软件multipath设置未开机自启动
chkconfig --level 2345 multipathd on // chkconfig multipathd on
chkconfig --list|grep multipathd
multipathd   0:关闭 1:关闭 2:启用 3:启用 4:启用  5:启用  6:关闭
启动multipath服务:
service multipathd restart

3.多路径配置(rac、rac2)

oracle RAC所需多路径配置要点是一个RAC节点一个RAC节点一次执行如下操作(如果需要再添加使用多路径的存储,也需遵循如下步骤):
service multipathd stop
multipath -F

所得所有存储的lun的wwid:
for i in `cat /proc/partitions | awk {'print $4'} |grep sd`; do val=`/sbin/blockdev --getsize64 /dev/$i` ; val2=`expr $val / 1073741824`; echo "/dev/$i: $val2 `scsi_id -gud /dev/$i`" ; done

先查看是否存在/etc/multipath.conf,不存在
方法1:创建配置文件:cp /etc/multipath_bak.conf   /etc/multipath.conf
vi /etc/multipath.conf

defaults {
user_friendly_names yes
}

devices {
device {  
vendor "(COMPAQ|HP)"
product "HSV1[01]1|HSV2[01]0|HSV300|HSV4[05]0"
#getuid_callout "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
features "0"
hardware_handler "0"
path_selector "round-robin 0"
path_grouping_policy group_by_prio
failback immediate
rr_weight uniform
no_path_retry 12
rr_min_io 1000
path_checker tur
prio alua
}
}

multipaths {

        multipath {                                                                               //每多一块盘,加这个一组。
                wwid                    36000c29834a381e8a88835b639a373b5
                alias                   OCR
                path_grouping_policy    multibus
                path_selector           "round-robin 0"
                failback                immediate
                rr_weight               priorities
                no_path_retry           queue
    }
}

multipaths {

        multipath {                                                                               //每多一块盘,加这个一组。
                wwid                    36000c296018de505012ccd5854db468f
                alias                   DATA
                path_grouping_policy    multibus
                path_selector           "round-robin 0"
                failback                immediate
                rr_weight               priorities
                no_path_retry           queue
    }
}

multipaths {

        multipath {                                                                               //每多一块盘,加这个一组。
                wwid                    36000c297448260e8adee440316e9c11b
                alias                   ARCH
                path_grouping_policy    multibus
                path_selector           "round-robin 0"
                failback                immediate
                rr_weight               priorities
                no_path_retry           queue
    }
}

blacklist {
        devnode "^(sda|ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
        devnode "^hd[a-z]"
        devnode "^asm/*"         # Here
        devnode "ofsctl"             # Here
}

#启动多路径:
service multipathd restart

启动multipath配置后,会在/dev/mapper下生成多路径逻辑盘
cd /dev/mapper
ll
#查看多路径的状态:multipath -ll

4.配置udev,更改属组

vi /etc/udev/rules.d/99-oracle-asmdevices.rules
ENV{DM_NAME}=="OCR", OWNER:="grid", GROUP:="asmadmin", MODE:="0660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="DATA", OWNER:="grid", GROUP:="asmadmin", MODE:="0660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="ARCH", OWNER:="grid", GROUP:="asmadmin", MODE:="0660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"

重启udev
[root@sanan1 rules.d]# start_udev
正在启动 udev:                                            [确定]

5、验证是否成功

ls /dev/iscsi/
oraasm-arch1   oraasm-mes1.2  oraasm-mes1.4  oraasm-mes2.2  oraasm-ocr2
oraasm-mes1.1  oraasm-mes1.3  oraasm-mes2.1  oraasm-ocr1    oraasm-ocr3
---验证权限
 ls -l /dev/dm-*
---验证命名结果
ls -l /dev/mapper/*

Related Posts