lxlj00 2018-11-28
对于没有共享存储的环境下,可以使用基于NFS的ASM来配置RAC。这里简单描述如何在Oracle 18c RAC环境下配置基于NFS的ASM服务。
所用到的主机信息如图中所示:
[root@onas ~]# vi /etc/exports /u02 *(rw,sync,no_wdelay,insecure,no_root_squash) [root@onas ~]# systemctl restart nfs [root@onas ~]# showmount -e Export list for onas: /u02 *
RAC节点分别编辑/etc/fstab文件,加入以下内容:
[root@odb01 ~]# vi /etc/fstab onas:/u02 /u02 nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0 0 0 [root@odb01 ~]# mount -a [root@odb02 ~]# vi /etc/fstab onas:/u02 /u02 nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0 0 0 [root@odb02 ~]# mount -a
具体的安装过程不做过多描述,只截取几张ASM部分的截图。
这里使用第二个选项“Configure ASM on NFS”,使用了此选项后,系统会自动创建共享磁盘。
指定OCR的位置,下一步。待Grid组件安装并配置完成后,默认会创建一块30G大小的磁盘ocrvfdgdisk0,用于OCRVFDG磁盘组,如下:
[root@odb01 ~]# la /u02/asmrac/ total 33G drwxr-xr-x 2 grid oinstall 40 Sep 4 17:05 . drwxr-xr-x 8 root root 4.0K Sep 4 15:09 .. -rw-rw---- 1 grid asmadmin 28G Sep 5 09:52 ocrvfdgdisk0
通过asmca图形界面查看,如下图所示:
在共享目录下,创建了10块虚拟磁盘:asmdisk1~asmdisk10,分别演示使用asmca和命令行创建磁盘组。通过asmca图形界面创建data磁盘组,通过asmca命令创建fra磁盘组。
[grid@odb01 ~]$ asmca -silent -sysAsmPassword abcABC12 -asmsnmpPassword abcABC12 -createDiskGroup -diskString '/u02/asmrac' -diskGroupName fra -diskList /u02/asmrac/asmdisk6 -redundancy external -au_size 4 [INFO] [DBT-30001] Disk groups created successfully. Check /u01/app/grid/cfgtoollogs/asmca/asmca-180905AM105833.log for details. //添加磁盘 [grid@odb01 ~]$ asmca -silent -sysAsmPassword abcABC12 -asmsnmpPassword abcABC12 -addDisk -diskString '/u02/asmrac' -diskGroupName fra -diskList /u02/asmrac/asmdisk7,/u02/asmrac/asmdisk8,/u02/asmrac/asmdisk9 [grid@odb01 ~]$ asmcmd lsdsk -t -G fra Create_Date Mount_Date Repair_Timer Path 05-SEP-18 05-SEP-18 0 /u02/asmrac/asmdisk6 05-SEP-18 05-SEP-18 0 /u02/asmrac/asmdisk7 05-SEP-18 05-SEP-18 0 /u02/asmrac/asmdisk8 05-SEP-18 05-SEP-18 0 /u02/asmrac/asmdisk9
[root@onas asmdisks]# for i in {1..10};do dd if=/dev/zero of=/u02/asmrac/asmdisk$i bs=1024k count=10000;done [root@odb01 ~]# ll /u02/asmrac/ total 102400000 -rw-r--r-- 1 root root 10485760000 Sep 4 11:41 asmdisk1 -rw-r--r-- 1 root root 10485760000 Sep 4 11:41 asmdisk2 -rw-r--r-- 1 root root 10485760000 Sep 4 11:41 asmdisk3 -rw-r--r-- 1 root root 10485760000 Sep 4 11:41 asmdisk4 -rw-r--r-- 1 root root 10485760000 Sep 4 11:41 asmdisk5 -rw-r--r-- 1 root root 10485760000 Sep 4 11:41 asmdisk6 -rw-r--r-- 1 root root 10485760000 Sep 4 11:41 asmdisk7 -rw-r--r-- 1 root root 10485760000 Sep 4 11:41 asmdisk8 -rw-r--r-- 1 root root 10485760000 Sep 4 11:41 asmdisk9 -rw-r--r-- 1 root root 10485760000 Sep 4 11:41 asmdisk10
在RAC各个节点分别配置asmlib服务,如下:
root@odb01 ~]# oracleasm configure -i Configuring the Oracle ASM library driver. This will configure the on-boot properties of the Oracle ASM library driver. The following questions will determine whether the driver is loaded on boot and what permissions it will have. The current values will be shown in brackets ('[]'). Hitting <ENTER> without typing an answer will keep that current value. Ctrl-C will abort. Default user to own the driver interface []: grid Default group to own the driver interface []: dba Start Oracle ASM library driver on boot (y/n) [n]: y Scan for Oracle ASM disks on boot (y/n) [y]: Writing Oracle ASM library driver configuration: done [root@odb01 ~]# oracleasm init Creating /dev/oracleasm mount point: /dev/oracleasm Loading module "oracleasm": oracleasm Configuring "oracleasm" to use device physical block size Mounting ASMlib driver filesystem: /dev/oracleasm
如果使用asmlib,必须使用losetup命令创建块设备,如下:
[root@odb01 ~]# for i in {1..10};do losetup /dev/loop$i /u02/asmdisks/asmdisk$i;done [root@odb01 ~]# ll /dev/loop* brw-rw---- 1 root disk 7, 1 Sep 4 14:35 /dev/loop1 brw-rw---- 1 root disk 7, 10 Sep 4 14:35 /dev/loop10 brw-rw---- 1 root disk 7, 2 Sep 4 14:35 /dev/loop2 brw-rw---- 1 root disk 7, 3 Sep 4 14:35 /dev/loop3 brw-rw---- 1 root disk 7, 4 Sep 4 14:35 /dev/loop4 brw-rw---- 1 root disk 7, 5 Sep 4 14:35 /dev/loop5 brw-rw---- 1 root disk 7, 6 Sep 4 14:35 /dev/loop6 brw-rw---- 1 root disk 7, 7 Sep 4 14:35 /dev/loop7 brw-rw---- 1 root disk 7, 8 Sep 4 14:35 /dev/loop8 brw-rw---- 1 root disk 7, 9 Sep 4 14:35 /dev/loop9 crw-rw---- 1 root disk 10, 237 Sep 4 14:35 /dev/loop-control [root@odb02 ~]# for i in {1..10};do losetup /dev/loop$i /u02/asmdisks/asmdisk$i;done [root@odb02 ~]# ll /dev/loop*
[root@odb01 ~]# for i in {1..10};do oracleasm createdisk vol$i /dev/loop$i;done [root@odb02 ~]# oracleasm scandisks Reloading disk partitions: done Cleaning any stale ASM disks... Scanning system for ASM disks... Instantiating disk "VOL1" Instantiating disk "VOL2" Instantiating disk "VOL3" Instantiating disk "VOL4" Instantiating disk "VOL5" Instantiating disk "VOL6" Instantiating disk "VOL7" Instantiating disk "VOL8" Instantiating disk "VOL9" Instantiating disk "VOL10"
在安装Grid组件时,在配置“Storage Option”中选择第一个选项“Configure ASM using block devices”,如下图: