首先来看下,神马是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相关的服务是否正常
[grid@rac1 ~]$ crs_stat -t -v ora.registry.acfs
Name Type R/RA F/FT Target State Host
----------------------------------------------------------------------
ora....ry.acfs ora....fs.type 0/5 0/ ONLINE ONLINE rac1
[grid@rac1 ~]$ crs_stat -t -v ora.ACFS.dg
Name Type R/RA F/FT Target State Host
----------------------------------------------------------------------
ora.ACFS.dg ora....up.type 0/5 0/ ONLINE ONLINE rac1
二:使用asmca图形化工具,在asm磁盘组中创建volume并格式化成ACFS文件系统
[root@rac1 ~]# su - grid
[grid@rac1 ~]$ !exp
export DISPLAY=192.168.1.105:0
[grid@rac1 ~]$ asmca
三:查看两个节点是否均已成功挂载ACFS,并测试读写
[grid@rac1 ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda3 26G 14G 11G 58% /
/dev/vda1 99M 12M 83M 13% /boot
tmpfs 1.2G 787M 441M 65% /dev/shm
/dev/asm/vol1-330 5.0G 75M 5.0G 2% /u01/app/grid/acfsmounts/acfs_vol1
[grid@rac1 ~]$ ssh rac2 "df -h"
Filesystem Size Used Avail Use% Mounted on
/dev/vda3 26G 14G 10G 59% /
/dev/vda1 99M 12M 83M 13% /boot
tmpfs 1.2G 787M 441M 65% /dev/shm
/dev/asm/vol1-330 5.0G 75M 5.0G 2% /u01/app/grid/acfsmounts/acfs_vol1
[grid@rac1 ~]$ cd /u01/app/grid/acfsmounts/acfs_vol1
[grid@rac1 acfs_vol1]$ ls
lost+found
drwx------ 2 root root 65536 Jul 9 09:24 lost+found
[grid@rac1 acfs_vol1]$ cp /etc/passwd ./
[grid@rac2 ~]$ cd /u01/app/grid/acfsmounts/acfs_vol1
[grid@rac2 acfs_vol1]$ ls
lost+found passwd
[grid@rac2 acfs_vol1]$ head -1 passwd
root:x:0:0:root:/root:/bin/bash
四:在asmcmd命令行下面操作
[grid@rac1 ~]$ echo $ORACLE_SID
+ASM1
[grid@rac1 ~]$ asmcmd
ASMCMD> ls
ACFS/
CRS/
DATA/
FRA/
ASMCMD> volcreate //查看帮助命令
usage: volcreate -G diskgroup -s size [ --column number ] [ --width stripe_width ] [--redundancy {high|mirror|unprotected} ]
[--primary {hot|cold}] [--secondary {hot|cold}] volume
help: help volcreate
ASMCMD> volcreate -G ACFS -s 5G vol2 //如果空间不足就会报这个错误
ORA-15032: not all alterations performed
ORA-15041: diskgroup "ACFS" space exhausted (DBD ERROR: OCIStmtExecute)
ASMCMD> volcreate -G ACFS -s 4G vol2
ASMCMD> volinfo -G ACFS vol2
Diskgroup Name: ACFS
Volume Name: VOL2
Volume Device: /dev/asm/vol2-330
State: ENABLED
Size (MB): 4096
Resize Unit (MB): 32
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage:
Mountpath:
ASMCMD> volinfo -G ACFS vol1
Diskgroup Name: ACFS
Volume Name: VOL1
Volume Device: /dev/asm/vol1-330
State: ENABLED
Size (MB): 5120
Resize Unit (MB): 32
Redundancy: UNPROT
Stripe Columns: 4
Stripe Width (K): 128
Usage: ACFS
Mountpath: /u01/app/grid/acfsmounts/acfs_vol1
[root@rac1 ~]# mkdir /vol2 (节点2创建相同的挂载点)
[root@rac1 ~]# mkfs.acfs /dev/asm/vol2-330
mkfs.acfs: version = 11.2.0.3.0
mkfs.acfs: on-disk version = 39.0
mkfs.acfs: volume = /dev/asm/vol2-330
mkfs.acfs: volume size = 4294967296
mkfs.acfs: Format complete.
[root@rac1 ~]# mount -t acfs /dev/asm/vol2-330 /vol2/
[root@rac1 ~]# df -h /vol2
Filesystem Size Used Avail Use% Mounted on
/dev/asm/vol2-330 4.0G 45M 4.0G 2% /vol2
[root@rac1 ~]# acfsutil registry -a /dev/asm/vol2-330 /vol2/(注册后,节点2会自动挂载)
acfsutil registry: mount point /vol2 successfully added to Oracle Registry