多路径multipath配置,udev绑定
多路径multipath配置
以root用户登录
1.查看共享磁盘是否挂载成功
#fdisk -l
2.生成配置文件
#mpathconf --enable
修改配置文件权限
#chmod 644 /etc/multipath.conf
查看挂载磁盘(本机挂载的磁盘为sdc--sdn)
挂载磁盘为6块,因为多路径会显示12块
#ll /dev/sd*
查看磁盘ID 依次执行 (可以写个脚本,懒得搞了)
#/usr/lib/udev/scsi_id -g -u -d /dev/sdc
~
#/usr/lib/udev/scsi_id -g -u -d /dev/sdn
根据上图ID可以看出两两ID相同,实际只有6块
修改配置文件内容(注意根据磁盘ID修改wwid和alias,下面只写了一个示例)
#vim /etc/multipath.conf
multipaths {
multipath {
wwid 360050764008201d2680000000000002f
alias disk1
path_grouping_policy multibus
path_selector "round-robin 0"
failback immediate
rr_weight priorities
no_path_retry 5
}
}
3.启动multipathd服务
#/bin/systemctl start multipathd.service
4.设置开机自启动
#systemctl enable multipathd
5.查看聚合后的磁盘
#ll /dev/mapper
配置udev
重启UDEV
/sbin/udevadm trigger –type=devices –action=change
如果是HDLM多路径存储,则配置UDEV
添加以下内容(字符有乱码,建议手敲)
#vim /etc/udev/rules.d/99-dm.rules
KERNEL=="sd*[!0-9]",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="",RUN+="/bin/sh -c 'mknod /dev/asmdisk1 b $major $minor;chown grid:asmadmin /dev/asmdisk1;chmod 0660 /dev/asmdisk1'"
如果是Multipath多路径存储,则配置UDEV
添加以下内容
#vim /etc/udev/rules.d/99-dm.rules
ENV{DM_NAME}=="disk1",OWNER:="grid",GROUP:="asmadmin",MODE:="660",SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="disk2",OWNER:="grid",GROUP:="asmadmin",MODE:="660",SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="disk3",OWNER:="grid",GROUP:="asmadmin",MODE:="660",SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="disk4",OWNER:="grid",GROUP:="asmadmin",MODE:="660",SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="disk5",OWNER:="grid",GROUP:="asmadmin",MODE:="660",SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
ENV{DM_NAME}=="disk6",OWNER:="grid",GROUP:="asmadmin",MODE:="660",SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
清空磁盘头(单台服务器操作即可)(首次安装不需要操作),慎重勿选错磁盘,后果是灾难性的
#dd if=/dev/zero of=/dev/mapper/disk1 bs=1024k count=200
~
#dd if=/dev/zero of=/dev/mapper/disk6 bs=1024k count=200
磁盘格式化
#fdisk /dev/mapper/disk1
~
#fdisk /dev/mapper/disk6
依次输入n 回车 回车 回 回车 回车 w 回车
# partprobe
# ll /dev/mapper/*