RHEL 6.4搭建Oracle RAC前共享存储配置(Iscsi-SAN+Multipath+udev)

IP配置:
Server:(192.168.2.30、192.168.2.40)

添加一个100G磁盘/dev/sdb,添加两张网卡,并分配IP。
[root@server ~]# pvcreate /dev/sdb
pvs
vgcreate iscsi_store /dev/sdb
vgs
lvcreate -L 10G -n ocr_vd1 iscsi_store
lvcreate -L 10G -n ocr_vd2 iscsi_store
lvcreate -L 10G -n ocr_vd3 iscsi_store
lvcreate -L 50G -n data iscsi_store
lvcreate -l 5119 -n arch iscsi_store
lsblk
yum -y install scsi-target-utils
service tgtd start && chkconfig tgtd on
chkconfig --list | grep tgtd

[root@server ~]# vim /etc/tgt/targets.conf
<target iqn.2019-11.com.example.server:target>
backing-store /dev/iscsi_store/ocr_vd1
backing-store /dev/iscsi_store/ocr_vd2
backing-store /dev/iscsi_store/ocr_vd3
backing-store /dev/iscsi_store/data
backing-store /dev/iscsi_store/arch
</target>
[root@server ~]# service tgtd restart && tgt-admin --show
Target 1: iqn.2019-11.com.example.server:target

 

客户端(192.168.2.20、192.168.2.21)
RACDB1:
[root@racdb1 ~]# yum -y install iscsi-initiator-utils && chkconfig --list|grep scsi
iscsiadm -m discovery -t sendtargets -p 192.168.2.30
iscsiadm -m discovery -t sendtargets -p 192.168.2.40
iscsiadm -m node -T iqn.2019-11.com.example.server:target --login
lsblk
[root@racdb1 ~]# iscsiadm -m node
192.168.2.30:3260,1 iqn.2019-11.com.example.server:testtarget
192.168.2.40:3260,1 iqn.2019-11.com.example.server:testtarget
[root@racdb1 ~]# ls -lrt /var/lib/iscsi/nodes/
total 4
drw------- 4 root root 4096 Nov 29 06:09 iqn.2019-11.com.example.server:testtarget

 

RACDB2:
[root@racdb2 ~]# yum -y install iscsi-initiator-utils && chkconfig --list | grep scsi
iscsiadm -m discovery -t sendtargets -p 192.168.2.30
iscsiadm -m discovery -t sendtargets -p 192.168.2.40
iscsiadm -m node -T iqn.2019-11.com.example.server:target --login
lsblk
[root@racdb2 ~]# iscsiadm -m node
192.168.2.30:3260,1 iqn.2019-11.com.example.server:target
192.168.2.40:3260,1 iqn.2019-11.com.example.server:target
[root@racdb2 ~]# ls -lrt /var/lib/iscsi/nodes/
total 4
drw------- 4 root root 4096 Nov 29 14:25 iqn.2019-11.com.example.server:testtarget

 

多路径配置设置开机启动:
RACDB1:
[root@racdb1 ~]# rpm -qa | grep device-mapper-multipath
[root@racdb1 ~]# chkconfig multipathd on && chkconfig --list|grep multipathd

RACDB2:
[root@racdb2 ~]# rpm -qa | grep device-mapper-multipath
[root@racdb2 ~]# chkconfig multipathd on && chkconfig --list|grep multipathd

 

生成多路径配置文件
RACDB1:
[root@racdb1 ~]# /sbin/mpathconf --enable

RACDB2:
[root@racdb2 ~]# /sbin/mpathconf --enable

 

启动服务
RACDB1:
[root@racdb1 ~]# service multipathd status && service multipathd start

[root@racdb1 ~]# multipath -ll
mpathe (1IET 00010005) dm-4 IET,VIRTUAL-DISK
size=10G features=‘0‘ hwhandler=‘0‘ wp=rw
|-+- policy=‘round-robin 0‘ prio=1 status=active
| `- 34:0:0:5 sdi 8:128 active ready running
`-+- policy=‘round-robin 0‘ prio=1 status=enabled
`- 33:0:0:5 sdk 8:160 active ready running
mpathd (1IET 00010004) dm-3 IET,VIRTUAL-DISK
size=10G features=‘0‘ hwhandler=‘0‘ wp=rw
|-+- policy=‘round-robin 0‘ prio=1 status=active
| `- 34:0:0:4 sdg 8:96 active ready running
`-+- policy=‘round-robin 0‘ prio=1 status=enabled
`- 33:0:0:4 sdj 8:144 active ready running
mpathc (1IET 00010003) dm-2 IET,VIRTUAL-DISK
size=10G features=‘0‘ hwhandler=‘0‘ wp=rw
|-+- policy=‘round-robin 0‘ prio=1 status=active
| `- 34:0:0:3 sde 8:64 active ready running
`-+- policy=‘round-robin 0‘ prio=1 status=enabled
`- 33:0:0:3 sdh 8:112 active ready running
mpathb (1IET 00010002) dm-1 IET,VIRTUAL-DISK
size=50G features=‘0‘ hwhandler=‘0‘ wp=rw
|-+- policy=‘round-robin 0‘ prio=1 status=active
| `- 34:0:0:2 sdc 8:32 active ready running
`-+- policy=‘round-robin 0‘ prio=1 status=enabled
`- 33:0:0:2 sdf 8:80 active ready running
mpatha (1IET 00010001) dm-0 IET,VIRTUAL-DISK
size=20G features=‘0‘ hwhandler=‘0‘ wp=rw
|-+- policy=‘round-robin 0‘ prio=1 status=active
| `- 34:0:0:1 sdb 8:16 active ready running
`-+- policy=‘round-robin 0‘ prio=1 status=enabled
`- 33:0:0:1 sdd 8:48 active ready running

 

RACDB2:
[root@racdb2 ~]# service multipathd status && service multipathd start
[root@racdb2 ~]# multipath -ll
mpathe (1IET 00010005) dm-4 IET,VIRTUAL-DISK
size=10G features=‘0‘ hwhandler=‘0‘ wp=rw
|-+- policy=‘round-robin 0‘ prio=1 status=active
| `- 33:0:0:5 sdk 8:160 active ready running
`-+- policy=‘round-robin 0‘ prio=1 status=enabled
`- 34:0:0:5 sdj 8:144 active ready running
mpathd (1IET 00010003) dm-3 IET,VIRTUAL-DISK
size=10G features=‘0‘ hwhandler=‘0‘ wp=rw
|-+- policy=‘round-robin 0‘ prio=1 status=active
| `- 33:0:0:3 sdg 8:96 active ready running
`-+- policy=‘round-robin 0‘ prio=1 status=enabled
`- 34:0:0:3 sdf 8:80 active ready running
mpathc (1IET 00010004) dm-2 IET,VIRTUAL-DISK
size=10G features=‘0‘ hwhandler=‘0‘ wp=rw
|-+- policy=‘round-robin 0‘ prio=1 status=active
| `- 34:0:0:4 sdh 8:112 active ready running
`-+- policy=‘round-robin 0‘ prio=1 status=enabled
`- 33:0:0:4 sdi 8:128 active ready running
mpathb (1IET 00010002) dm-1 IET,VIRTUAL-DISK
size=50G features=‘0‘ hwhandler=‘0‘ wp=rw
|-+- policy=‘round-robin 0‘ prio=1 status=active
| `- 34:0:0:2 sdc 8:32 active ready running
`-+- policy=‘round-robin 0‘ prio=1 status=enabled
`- 33:0:0:2 sde 8:64 active ready running
mpatha (1IET 00010001) dm-0 IET,VIRTUAL-DISK
size=20G features=‘0‘ hwhandler=‘0‘ wp=rw
|-+- policy=‘round-robin 0‘ prio=1 status=active
| `- 34:0:0:1 sdb 8:16 active ready running
`-+- policy=‘round-robin 0‘ prio=1 status=enabled
`- 33:0:0:1 sdd 8:48 active ready running

 

修改多路径配置文件
RACDB1、RACDB2:
[root@racdb1 ~]# vim /etc/multipathd.conf
multipaths {
  multipath {
    wwid 1IET_00010001
    alias arch
    path_grouping_policy failover
    }
  multipath {
    wwid 1IET_00010002
    alias data
    path_grouping_policy failover
    }
  multipath {
    wwid 1IET_00010003
    alias ocr_vd1
    path_grouping_policy failover
    }
  multipath {
    wwid 1IET_00010004
    alias ocr_vd2
    path_grouping_policy failover
    }
  multipath {
    wwid 1IET_00010005
    alias ocr_vd3
    path_grouping_policy failover
    }
}

 

udev绑定磁盘:
RACDB1:
[root@racdb1 /]# vim /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-1IET\x20\x20\x20\x20\x2000010005",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-1IET\x20\x20\x20\x20\x2000010001",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-1IET\x20\x20\x20\x20\x2000010003",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-1IET\x20\x20\x20\x20\x2000010004",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-1IET\x20\x20\x20\x20\x2000010002",OWNER="grid",GROUP="asmadmin",MODE="0660"
[root@racdb1 ~]# start_udev
[root@racdb1 ~]# ls -lrt /dev/dm-*
brw-rw---- 1 grid asmadmin 253, 3 Dec 2 17:55 /dev/dm-3
brw-rw---- 1 grid asmadmin 253, 0 Dec 2 17:55 /dev/dm-0
brw-rw---- 1 grid asmadmin 253, 4 Dec 2 17:55 /dev/dm-4
brw-rw---- 1 grid asmadmin 253, 1 Dec 2 17:55 /dev/dm-1
brw-rw---- 1 grid asmadmin 253, 2 Dec 2 17:55 /dev/dm-2

 

RACDB1:
[root@racdb1 /]# vim /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-1IET\x20\x20\x20\x20\x2000010005",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-1IET\x20\x20\x20\x20\x2000010001",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-1IET\x20\x20\x20\x20\x2000010003",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-1IET\x20\x20\x20\x20\x2000010004",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-1IET\x20\x20\x20\x20\x2000010002",OWNER="grid",GROUP="asmadmin",MODE="0660"
[root@racdb2 ~]# ls -lrt /dev/dm-*
brw-rw---- 1 grid asmadmin 253, 2 Dec 3 10:53 /dev/dm-2
brw-rw---- 1 grid asmadmin 253, 4 Dec 3 10:53 /dev/dm-4
brw-rw---- 1 grid asmadmin 253, 1 Dec 3 10:53 /dev/dm-1
brw-rw---- 1 grid asmadmin 253, 0 Dec 3 10:53 /dev/dm-0
brw-rw---- 1 grid asmadmin 253, 3 Dec 3 10:53 /dev/dm-3
[root@racdb2 ~]# start_udev

[root@racdb1 ~]# ls -lrt /dev/mapper/*
lrwxrwxrwx 1 root root 7 Dec 1 23:51 /dev/mapper/mpathd -> ../dm-4
lrwxrwxrwx 1 root root 7 Dec 1 23:51 /dev/mapper/mpathc -> ../dm-1
lrwxrwxrwx 1 root root 7 Dec 1 23:51 /dev/mapper/mpathb -> ../dm-0
lrwxrwxrwx 1 root root 7 Dec 1 23:51 /dev/mapper/mpatha -> ../dm-3
lrwxrwxrwx 1 root root 7 Dec 1 23:51 /dev/mapper/mpathe -> ../dm-2

[root@racdb2 ~]# ls -lrt /dev/mapper/*
lrwxrwxrwx 1 root root 7 Dec 2 19:07 /dev/mapper/mpathe -> ../dm-2
lrwxrwxrwx 1 root root 7 Dec 2 19:07 /dev/mapper/mpathb -> ../dm-3
lrwxrwxrwx 1 root root 7 Dec 2 19:07 /dev/mapper/mpathd -> ../dm-1
lrwxrwxrwx 1 root root 7 Dec 2 19:07 /dev/mapper/mpatha -> ../dm-0
lrwxrwxrwx 1 root root 7 Dec 2 19:07 /dev/mapper/mpathc -> ../dm-4
多路径已经将磁盘设置别名,不知道为何/dev/mapper/名字没有改变,猜测是虚拟机磁盘UUID的问题。

 

参考链接:
https://www.cnblogs.com/jyzhao/p/7200585.html
https://www.cnblogs.com/jyzhao/p/7208620.html

RHEL 6.4搭建Oracle RAC前共享存储配置(Iscsi-SAN+Multipath+udev)

上一篇:Oracle对当前时间的处理


下一篇:使用hbase,hive,hbase与建立宽表和ES 的分布式架构,实时监听到 db 的字段变更,再将变更的内容实时同步到 ES 和宽表设计天生支持海量数据查询