CentOS6u9 Oracle11g RAC 搭建部署(二)共享存储配置

5-共享存储配置:

依据《CentOS6u9 Oracle11g RAC 共享存储配置》添加7块共享存储盘,配置多路软件+udev权限绑定:

1° 配置多路软件

# 节点1和节点2均操作

# 共享设备挂载验证
for i in $(ls /dev/sd*|grep -v [0-9]|grep -v sda)
do
  echo -ne "$(fdisk -l ${i}|grep ^Disk|grep ${i}|awk '{print $1,$2,$3,$4}') WWID:"
  /sbin/scsi_id -g -u -d "${i}"
done|sort -k5|column -t
# 两节点查询出的7块共享存储的WWID是一致的,说明共享存储成功挂接到了俩节点

# 软件安装,设置开机启动
yum -y install device-mapper-multipath
# 此时只能使用本地ISO镜像进行安装软件包
chkconfig multipathd on
# 生成默认配置文件,启动
mpathconf --enable
/etc/init.d/multipathd start

# 根据WWID和磁盘容量,规划出WWID和别名对应关系如下:
cat >/tmp/WWID_NAME.tmp<1ATA_VBOX_HARDDISK_VB3162a19e-29809f6c lun_crs01
1ATA_VBOX_HARDDISK_VB4765ca8a-69855511 lun_arch01
1ATA_VBOX_HARDDISK_VBb14fa60c-44dd8372 lun_back01
1ATA_VBOX_HARDDISK_VBb2422726-0dda7629 lun_data01
1ATA_VBOX_HARDDISK_VBc658d55e-5480b7e7 lun_ogg01
1ATA_VBOX_HARDDISK_VBd513ae99-0f1351d8 lun_crs02
1ATA_VBOX_HARDDISK_VBf73d8287-f43a5d49 lun_crs03
EOF

# 生成新的配置文件
rm -rf /tmp/multipath.conf.tmp
cat /tmp/WWID_NAME.tmp|while read line
do
  WWID=$(echo $line|awk '{print $1}')
  NAME=$(echo $line|awk '{print $2}')
  echo -e "
  multipath {
    wwid  ${WWID}
    alias ${NAME}
    path_grouping_policy multibus
    path_selector \"round-robin 0\"
    mode 0600
  }">>/tmp/multipath.conf.tmp
done
# 先根据WWID和NAME的对应关系,拼出所有的multipath标签,存入文件
vendor=$(multipath -v3|grep sdb|grep 'vendor'|awk '{print $NF}')
product=$(multipath -v3|grep sdb|grep 'product'|awk '{print $(NF-1),$NF}')
INFO=$(cat /tmp/multipath.conf.tmp)
# 将存入文件的multipath标签加载成变量
cat >/etc/multipath.conf<"^sda"
}
multipaths {
${INFO}
}
devices {
  device {
    vendor "${vendor}"
    product "${product}"
    getuid_callout "/sbin/scsi_id -g -u -d /dev/%n"
    failback immediate
    no_path_retry fail
  }
}
EOF

# 启动并验证
/etc/init.d/multipathd restart
ls -l /dev/mapper/

2° 配置udev权限绑定

# 节点1和节点2均操作
# 修复BUG
echo "options=--whitelisted --replace-whitespace"  >> /etc/scsi_id.config
cat >>/lib/udev/rules.d/90-pulseaudio.rules<"pulseaudio_check_usb"
LABEL="pulseaudio_check_usb"
EOF
# 生成配置文件
cd /etc/udev/rules.d
rm -rf 12-dm-permissions.rules
OWNER=grid
GROUP=asmadmin
for NAME in $(cat /tmp/WWID_NAME.tmp |awk '{print $2}'|grep -Ev 'lun_back01|lun_ogg01')
do
  echo "ENV{DM_NAME}==\"${NAME}\", OWNER:=\"${OWNER}\", GROUP:=\"${GROUP}\", MODE:=\"0660\"">>12-dm-permissions.rules
done
# 启动验证:
start_udev
ls -l /dev/dm-*

# 注意,备份盘和OGG盘并不做成ASM盘组,直接格式化后挂载到某一节点的文件系统上做备份
# 不建议使用ACFS挂载OGG盘,BUG太多
# 如果将备份盘做成ASM盘组,备份到ASM中,当需要做备份恢复时,ASM库无法启动...

[TOC]

你可能感兴趣的:(RAC)