ASM Filter Driver是一個能夠取代 ASMLIB 和 udev 設置的新功能,它能夠一舉取代 ASMLIB 和手動設置 udev rules 文件的繁瑣,而且最重要的是 I/O Filter 功能。所謂的I/O Filter功能能夠拒絕全部無效的 I/O 請求,最主要的做用是防止意外覆寫 ASM 磁盤的底層盤,在後面的測試中能夠看到對於 root 用戶的 dd 全盤清零這樣的變態操做也都是能夠過濾的。html
[root@odb02 ~]# crsctl check cluster -all ************************************************************** odb02: CRS-4537: Cluster Ready Services is online CRS-4529: Cluster Synchronization Services is online CRS-4533: Event Manager is online ************************************************************** odb03: CRS-4537: Cluster Ready Services is online CRS-4529: Cluster Synchronization Services is online CRS-4533: Event Manager is online **************************************************************
[root@odb02 ~]# crsctl get cluster mode status Cluster is running in "flex" mode
從12c R2之後,默認的集羣模式爲flex。node
[root@odb02 ~]# oracleasm listdisks | xargs oracleasm querydisk -p Disk "DATA01" is a valid ASM disk /dev/sdb1: LABEL="DATA01" TYPE="oracleasm" Disk "FRA001" is a valid ASM disk /dev/sdc1: LABEL="FRA001" TYPE="oracleasm" [root@odb02 ~]# asmcmd dsget parameter:/dev/oracleasm/disks/* profile:/dev/oracleasm/disks/*
[grid@odb02 ~]$ asmcmd dsset '/dev/oracleasm/disks/*','AFD:*' [grid@odb02 ~]$ asmcmd dsget parameter:/dev/oracleasm/disks/*, AFD:* profile:/dev/oracleasm/disks/*,AFD:*
[grid@odb02 ~]$ olsnodes odb02 odb03
[root@odb02 ~]# crsctl stop crs [root@odb03 ~]# crsctl stop crs
[root@odb02 ~]# systemctl disable oracleasm Removed symlink /etc/systemd/system/multi-user.target.wants/oracleasm.service. [root@odb02 ~]# oracleasm status Checking if ASM is loaded: yes Checking if /dev/oracleasm is mounted: yes [root@odb02 ~]# oracleasm exit Unmounting ASMlib driver filesystem: /dev/oracleasm Unloading module "oracleasm": oracleasm [root@odb02 ~]# ls -ltr /dev/oracleasm/ total 0 [root@odb02 ~]# yum -y remove oracleasm-support
[root@odb03 ~]# systemctl disable oracleasm Removed symlink /etc/systemd/system/multi-user.target.wants/oracleasm.service. [root@odb03 ~]# oracleasm status Checking if ASM is loaded: yes Checking if /dev/oracleasm is mounted: yes [root@odb03 ~]# oracleasm exit Unmounting ASMlib driver filesystem: /dev/oracleasm Unloading module "oracleasm": oracleasm [root@odb03 ~]# ls -ltr /dev/oracleasm/ total 0 [root@odb03 ~]# yum -y remove oracleasm-support
[root@odb02 ~]# lsmod|grep acfs [root@odb02 ~]# acfsload stop [root@odb02 ~]# lsmod|grep acfs
AFD Configure,實際上這是一個解壓程序包,安裝,並加載 Driver 的過程,須要消耗一些時間。oracle
[root@odb02 ~]# asmcmd afd_configure ASMCMD-9523: command cannot be used when Oracle Clusterware stack is up --若是遇到以上報錯,先中止has,再執行一次。 [root@odb02 ~]# crsctl stop has [root@odb02 ~]# asmcmd afd_configure AFD-627: AFD distribution files found. AFD-634: Removing previous AFD installation. AFD-635: Previous AFD components successfully removed. AFD-636: Installing requested AFD software. AFD-637: Loading installed AFD drivers. AFD-9321: Creating udev for AFD. AFD-9323: Creating module dependencies - this may take some time. AFD-9154: Loading 'oracleafd.ko' driver. AFD-649: Verifying AFD devices. AFD-9156: Detecting control device '/dev/oracleafd/admin'. AFD-638: AFD installation correctness verified. Modifying resource dependencies - this may take some time.
配置完成後,驗證下狀態:ide
[root@odb02 ~]# asmcmd afd_state ASMCMD-9526: The AFD state is 'LOADED' and filtering is 'ENABLED' on host 'odb02' [root@odb03 ~]# asmcmd afd_state ASMCMD-9526: The AFD state is 'LOADED' and filtering is 'ENABLED' on host 'odb03' --若是上述的狀態爲disabled,則使用下面的命令啓用 [root@odb02 ~]# asmcmd afd_filter -e
另外,會生成一個/etc/oracleafd.conf文件,內容以下:測試
[root@odb02 ~]# cat /etc/oracleafd.conf afd_diskstring='/dev/oracleasm/disks/*'
若是其餘節點沒有,就把這個文件複製一份過去,避免啓動crs的時候出錯。flex
這個在一個節點操做,在其餘的節點中,再也不須要做label,而是直接scan便可,這跟使用 ASMLIB的操做很是類似。另外命令後面必須加migrate參數,才能夠成功。this
[root@odb02 ~]# asmcmd afd_label data01 /dev/sdb1 --migrate [root@odb02 ~]# asmcmd afd_label fra001 /dev/sdc1 --migrate [root@odb02 ~]# asmcmd afd_lsdsk -------------------------------------------------------------------------------- Label Filtering Path ================================================================================ DATA01 ENABLED /dev/sdb1 FRA001 ENABLED /dev/sdc1
其餘節點執行掃描操做:code
[grid@odb03 ~]$ asmcmd afd_scan [grid@odb03 ~]$ asmcmd afd_lsdsk -------------------------------------------------------------------------------- Label Filtering Path ================================================================================ DATA01 ENABLED /dev/sdb1 FRA001 ENABLED /dev/sdc1
最後,更新/etc/oracleafd.conf的內容以下:component
[root@odb02 ~]# cat /etc/oracleafd.conf afd_diskstring='/dev/sd*
[root@odb02 ~]# acfsload start ACFS-9391: Checking for existing ADVM/ACFS installation. ACFS-9392: Validating ADVM/ACFS installation files for operating system. ACFS-9393: Verifying ASM Administrator setup. ACFS-9308: Loading installed ADVM/ACFS drivers. ACFS-9327: Verifying ADVM/ACFS devices. ACFS-9156: Detecting control device '/dev/asm/.asm_ctl_spec'. ACFS-9156: Detecting control device '/dev/ofsctl'. ACFS-9322: completed
[root@odb02 ~]# crsctl start crs [root@odb03 ~]# crsctl start crs
待全部服務啓動後,檢查下diskstring參數設置:htm
[grid@odb02 ~]$ asmcmd dsget parameter:/dev/oracleasm/disks/*, AFD:* profile:/dev/oracleasm/disks/*,AFD:* [grid@odb02 ~]$ asmcmd dsset 'AFD:*' [grid@odb02 ~]$ asmcmd dsget parameter:AFD:* profile:AFD:* [grid@odb02 ~]$ asmcmd lsdsk Path AFD:DATA01 AFD:FRA001
最後經過SQLplus執行下面的SQL進行驗證:
set linesize 300 col PATH for a20 set pages 20 col LIBRARY for a45 col NAME for a15 select inst_id,group_number grp_num,name,state,header_status header,mount_status mount,path, library from gv$asm_disk order by inst_id,group_number,name;
參考文獻:
一、Oracle ASM Filter Driver (ASMFD)
二、Migrating from ASMLIB to ASMFD