手機版
你好,游客 登錄 注冊
背景:
閱讀新聞

從Oracle ASMLIB遷移到ASM Filter Driver

[日期:2019-09-27] 來源:Linux社區  作者:candon123 [字體: ]

ASM Filter Driver是一個可以取代 ASMLIB 和 udev 設置的新功能,它可以一舉取代 ASMLIB 和手動設置 udev rules 文件的繁瑣,并且最重要的是 I/O Filter 功能。所謂的I/O Filter功能可以拒絕所有無效的 I/O 請求,最主要的作用是防止意外覆寫 ASM 磁盤的底層盤,在后面的測試中可以看到對于 root 用戶的 dd 全盤清零這樣的變態操作也都是可以過濾的。

1、查詢集群狀態

[[email protected] ~]# 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
**************************************************************

2、查詢集群模式

[[email protected] ~]# crsctl get cluster mode status
Cluster is running in "flex" mode

從12c R2以后,默認的集群模式為flex。

3、查詢當前的ASM磁盤以及發現路徑

[[email protected] ~]# 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" 
[[email protected] ~]# asmcmd dsget
parameter:/dev/oracleasm/disks/*
profile:/dev/oracleasm/disks/*

4、設置新的ASM磁盤發現路徑

[[email protected] ~]$ asmcmd dsset '/dev/oracleasm/disks/*','AFD:*'
[[email protected] ~]$ asmcmd  dsget
parameter:/dev/oracleasm/disks/*, AFD:*
profile:/dev/oracleasm/disks/*,AFD:*

5、檢查 GI 環境中的節點

[[email protected] ~]$ olsnodes 
odb02
odb03

6、RAC所有節點停止集群服務

[[email protected] ~]# crsctl stop crs
[[email protected] ~]# crsctl stop crs

7、RAC所有節點卸載ASMLIB軟件

  • odb02
    [[email protected] ~]# systemctl disable oracleasm
    Removed symlink /etc/systemd/system/multi-user.target.wants/oracleasm.service.
    [[email protected] ~]# oracleasm status
    Checking if ASM is loaded: yes
    Checking if /dev/oracleasm is mounted: yes
    [[email protected] ~]# oracleasm exit
    Unmounting ASMlib driver filesystem: /dev/oracleasm
    Unloading module "oracleasm": oracleasm
    [[email protected] ~]# ls -ltr /dev/oracleasm/
    total 0
    [[email protected] ~]# yum -y remove oracleasm-support
  • odb03
    [[email protected] ~]# systemctl disable oracleasm
    Removed symlink /etc/systemd/system/multi-user.target.wants/oracleasm.service.
    [[email protected] ~]# oracleasm status
    Checking if ASM is loaded: yes
    Checking if /dev/oracleasm is mounted: yes
    [[email protected] ~]# oracleasm exit
    Unmounting ASMlib driver filesystem: /dev/oracleasm
    Unloading module "oracleasm": oracleasm
    [[email protected] ~]# ls -ltr /dev/oracleasm/
    total 0
    [[email protected] ~]# yum -y remove oracleasm-support

    8、RAC所有節點停止acfsload服務

    [[email protected] ~]# lsmod|grep acfs
    [[email protected] ~]# acfsload stop
    [[email protected] ~]# lsmod|grep acfs

    9、RAC所有節點配置AFD

    AFD Configure,實際上這是一個解壓程序包,安裝,并加載 Driver 的過程,需要消耗一些時間。

    [[email protected] ~]# asmcmd afd_configure
    ASMCMD-9523: command cannot be used when Oracle Clusterware stack is up
    --如果遇到以上報錯,先停止has,再執行一次。
    [[email protected] ~]# crsctl stop has
    [[email protected] ~]# 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.

    配置完成后,驗證下狀態:

    [[email protected] ~]# asmcmd afd_state
    ASMCMD-9526: The AFD state is 'LOADED' and filtering is 'ENABLED' on host 'odb02'
    [[email protected] ~]# asmcmd afd_state
    ASMCMD-9526: The AFD state is 'LOADED' and filtering is 'ENABLED' on host 'odb03'
    --如果上述的狀態為disabled,則使用下面的命令啟用
    [[email protected] ~]# asmcmd afd_filter -e

    另外,會生成一個/etc/oracleafd.conf文件,內容如下:

    [[email protected] ~]# cat /etc/oracleafd.conf
    afd_diskstring='/dev/oracleasm/disks/*'

    如果其他節點沒有,就把這個文件復制一份過去,避免啟動crs的時候出錯。

    10、遷移所有ASM磁盤

    這個在一個節點操作,在其他的節點中,不再需要作label,而是直接scan即可,這跟使用 ASMLIB的操作非常相似。另外命令后面必須加migrate參數,才可以成功。

[[email protected] ~]# asmcmd afd_label data01 /dev/sdb1 --migrate
[[email protected] ~]# asmcmd afd_label fra001 /dev/sdc1 --migrate    
[[email protected] ~]# asmcmd afd_lsdsk
--------------------------------------------------------------------------------
Label                     Filtering   Path
================================================================================
DATA01                      ENABLED   /dev/sdb1
FRA001                      ENABLED   /dev/sdc1

其他節點執行掃描操作:

[[email protected] ~]$ asmcmd afd_scan
[[email protected] ~]$ asmcmd afd_lsdsk
--------------------------------------------------------------------------------
Label                     Filtering   Path
================================================================================
DATA01                      ENABLED   /dev/sdb1
FRA001                      ENABLED   /dev/sdc1

最后,更新/etc/oracleafd.conf的內容如下:

[[email protected] ~]# cat /etc/oracleafd.conf 
afd_diskstring='/dev/sd*

11、RAC所有節點啟動acfsload

[[email protected] ~]# 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

12、RAC所有節點啟動CRS

[[email protected] ~]# crsctl start crs 
[[email protected] ~]# crsctl start crs 

待所有服務啟動后,檢查下diskstring參數設置:

[[email protected] ~]$ asmcmd dsget
parameter:/dev/oracleasm/disks/*, AFD:*
profile:/dev/oracleasm/disks/*,AFD:*
[[email protected] ~]$ asmcmd dsset 'AFD:*'
[[email protected] ~]$ asmcmd dsget
parameter:AFD:*
profile:AFD:*
[[email protected] ~]$ 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;

Migrating from Oracle ASMLIB to ASM Filter Driver

參考文獻:
1、Oracle ASM Filter Driver (ASMFD)
2、Migrating from ASMLIB to ASMFD

更多Oracle相關信息見Oracle 專題頁面 http://www.nluszu.live/topicnews.aspx?tid=12

Linux公社的RSS地址http://www.nluszu.live/rssFeed.aspx

本文永久更新鏈接地址http://www.nluszu.live/Linux/2019-09/160843.htm

linux
相關資訊       ASMLib  ASM Filter Driver 
本文評論   查看全部評論 (0)
表情: 表情 姓名: 字數

       

評論聲明
  • 尊重網上道德,遵守中華人民共和國的各項有關法律法規
  • 承擔一切因您的行為而直接或間接導致的民事或刑事法律責任
  • 本站管理人員有權保留或刪除其管轄留言中的任意內容
  • 本站有權在網站內轉載或引用您的評論
  • 參與本評論即表明您已經閱讀并接受上述條款
彩票投注骗局