且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

配置Oracle ACFS集群文件系统

更新时间:2022-09-25 19:22:29

首先来看下,神马是ACFS,请看oracle官方给出的定义:
Oracle Automatic Storage Management Cluster File System (Oracle ACFS) is a multi-platform, scalable file system, and storage management technology that extends Oracle Automatic Storage Management (Oracle ASM) functionality to support customer files maintained outside of Oracle Database. Oracle ACFS supports many database and application files, including executables,database trace files, database alert logs, application reports, BFILEs, and configuration files. Other supported files are video, audio, text, images, engineering drawings, and other general-purpose application file data.

大意是ACFS是一个支持多个平台,可扩展的,基于ASM的集群文件系统,可以用来存储数据库和各种应用的文件,包括数据库的trace文件,alert日志文件和配置文件等等,也可以用来存储视频,音频,文本,图片等文件!

在这之前,集群文件系统使用过redhat的gfs,还有开源的ocfs2,gfs的感觉是配置太繁琐且复杂,因为是基于RHCS套件,所以很多功能对应单纯的集群文件系统来说显得有些冗余;ocfs2属于被放弃的孩子,目前已经停止开发了,不过胜在配置简单;ACFS在11g r2中推出,基于grid infrastructure,配置上也算容易,且在ASM的基础上进行发展,稳定性应该还是有保证的,下一步打算利用ACFS测试下rac环境下的golden gate复制!下面来介绍下11G RAC环境下ACFS的使用!

一:查看acfs相关的服务是否正常


  1. [grid@rac1 ~]$ crs_stat -t -v ora.registry.acfs  
  2. Name           Type           R/RA   F/FT   Target    State     Host          
  3. ----------------------------------------------------------------------  
  4. ora....ry.acfs ora....fs.type 0/5    0/     ONLINE    ONLINE    rac1     
  5.  
  6. [grid@rac1 ~]$ crs_stat -t -v ora.ACFS.dg  
  7. Name           Type           R/RA   F/FT   Target    State     Host          
  8. ----------------------------------------------------------------------  
  9. ora.ACFS.dg    ora....up.type 0/5    0/     ONLINE    ONLINE    rac1  

二:使用asmca图形化工具,在asm磁盘组中创建volume并格式化成ACFS文件系统


  1. [root@rac1 ~]# su - grid  
  2. [grid@rac1 ~]$ !exp  
  3. export DISPLAY=192.168.1.105:0  
  4. [grid@rac1 ~]$ asmca  

配置Oracle ACFS集群文件系统 

配置Oracle ACFS集群文件系统  

配置Oracle ACFS集群文件系统 

配置Oracle ACFS集群文件系统 

配置Oracle ACFS集群文件系统

三:查看两个节点是否均已成功挂载ACFS,并测试读写


  1. [grid@rac1 ~]$ df -h  
  2. Filesystem            Size  Used Avail Use% Mounted on  
  3. /dev/vda3              26G   14G   11G  58% /  
  4. /dev/vda1              99M   12M   83M  13% /boot  
  5. tmpfs                 1.2G  787M  441M  65% /dev/shm  
  6. /dev/asm/vol1-330     5.0G   75M  5.0G   2% /u01/app/grid/acfsmounts/acfs_vol1  
  7. [grid@rac1 ~]$ ssh rac2 "df -h"  
  8. Filesystem            Size  Used Avail Use% Mounted on  
  9. /dev/vda3              26G   14G   10G  59% /  
  10. /dev/vda1              99M   12M   83M  13% /boot  
  11. tmpfs                 1.2G  787M  441M  65% /dev/shm  
  12. /dev/asm/vol1-330     5.0G   75M  5.0G   2% /u01/app/grid/acfsmounts/acfs_vol1  
  13.  
  14. [grid@rac1 ~]$ cd /u01/app/grid/acfsmounts/acfs_vol1  
  15. [grid@rac1 acfs_vol1]$ ls  
  16. lost+found  
  17. drwx------ 2 root root 65536 Jul  9 09:24 lost+found  
  18. [grid@rac1 acfs_vol1]$ cp /etc/passwd ./  
  19.  
  20. [grid@rac2 ~]$ cd /u01/app/grid/acfsmounts/acfs_vol1  
  21. [grid@rac2 acfs_vol1]$ ls  
  22. lost+found  passwd  
  23. [grid@rac2 acfs_vol1]$ head -1 passwd   
  24. root:x:0:0:root:/root:/bin/bash 

四:在asmcmd命令行下面操作


  1. [grid@rac1 ~]$ echo $ORACLE_SID  
  2. +ASM1  
  3. [grid@rac1 ~]$ asmcmd  
  4. ASMCMD> ls  
  5. ACFS/  
  6. CRS/  
  7. DATA/  
  8. FRA/  
  9.  
  10. ASMCMD> volcreate  //查看帮助命令  
  11. usage: volcreate -G diskgroup -s size [ --column number ] [ --width stripe_width ] [--redundancy {high|mirror|unprotected} ]   
  12.  
  13. [--primary {hot|cold}] [--secondary {hot|cold}] volume  
  14. help:  help volcreate  
  15.  
  16. ASMCMD> volcreate -G ACFS -s 5G vol2  //如果空间不足就会报这个错误  
  17. ORA-15032: not all alterations performed  
  18. ORA-15041: diskgroup "ACFS" space exhausted (DBD ERROR: OCIStmtExecute)  
  19.  
  20. ASMCMD> volcreate -G ACFS -s 4G vol2   
  21. ASMCMD> volinfo -G ACFS vol2  
  22. Diskgroup Name: ACFS  
  23.  
  24.          Volume Name: VOL2  
  25.          Volume Device: /dev/asm/vol2-330  
  26.          State: ENABLED  
  27.          Size (MB): 4096  
  28.          Resize Unit (MB): 32  
  29.          Redundancy: UNPROT  
  30.          Stripe Columns: 4  
  31.          Stripe Width (K): 128  
  32.          Usage:   
  33.          Mountpath:   
  34.  
  35. ASMCMD> volinfo -G ACFS vol1  
  36. Diskgroup Name: ACFS  
  37.  
  38.          Volume Name: VOL1  
  39.          Volume Device: /dev/asm/vol1-330  
  40.          State: ENABLED  
  41.          Size (MB): 5120  
  42.          Resize Unit (MB): 32  
  43.          Redundancy: UNPROT  
  44.          Stripe Columns: 4  
  45.          Stripe Width (K): 128  
  46.          Usage: ACFS  
  47.          Mountpath: /u01/app/grid/acfsmounts/acfs_vol1   
  48.  
  49.  
  50. [root@rac1 ~]# mkdir /vol2 (节点2创建相同的挂载点)  
  51. [root@rac1 ~]# mkfs.acfs /dev/asm/vol2-330   
  52. mkfs.acfs: version                   = 11.2.0.3.0  
  53. mkfs.acfs: on-disk version           = 39.0  
  54. mkfs.acfs: volume                    = /dev/asm/vol2-330  
  55. mkfs.acfs: volume size               = 4294967296 
  56. mkfs.acfs: Format complete.  
  57.  
  58. [root@rac1 ~]# mount -t acfs /dev/asm/vol2-330 /vol2/  
  59. [root@rac1 ~]# df -h /vol2  
  60. Filesystem            Size  Used Avail Use% Mounted on  
  61. /dev/asm/vol2-330     4.0G   45M  4.0G   2% /vol2  
  62.  
  63. [root@rac1 ~]# acfsutil registry -a /dev/asm/vol2-330 /vol2/(注册后,节点2会自动挂载)  
  64. acfsutil registry: mount point /vol2 successfully added to Oracle Registry 

更多ACFS的使用场景,如使用ACFS快照,删除卷和ACFS的维护等请参考:
http://candon123.blog.51cto.com/704299/469004
http://docs.oracle.com/cd/E16338_01/server.112/e10500/asmfilesystem.htm#CACGJEAJ

本文转自斩月博客51CTO博客,原文链接http://blog.51cto.com/ylw6006/925545如需转载请自行联系原作者


ylw6006