11gR2 RAC使用acfs文件系统

ACFS就是ASM Cluster File System,即自动存储集群文件系统.它可以让我们在ASM(Automated Storage Management)自动存储管理之上建立逻辑卷,文件系统.通过ACFS我们可以实现像GPFS之类的共享文件系统.从而不必依赖其他集群软件来实现,完全由Oracle自己的Grid Infrastructure来实现.那么我们先来看看ACFS的体系结构图.

image

如图所示:首先我们可以在DATA下划逻辑卷.比如名字叫datavolume.它对应到操作系统的设备文件就是/dev/asm/datavolume-276.然后我们可以用操作系统的mount命令将这个卷挂载到文件系统上.挂载到文件系统后,我们就可以在下面创建我们的文件了.接下来就演示一下这个操作.

1.划分ASM卷

[oracle@rac1 ~]$ asmcmd volcreate -G data ogg -s 3G
[oracle@rac1 ~]$ asmcmd volinfo -G data ogg
Diskgroup Name: DATA 

         Volume Name: OGG
         Volume Device: /dev/asm/ogg-276
         State: ENABLED
         Size (MB): 3072
         Resize Unit (MB): 32
         Redundancy: UNPROT
         Stripe Columns: 4
         Stripe Width (K): 128
         Usage:
         Mountpath:

2.将ASM卷格式化成ACFS

[oracle@rac1 ~]$ /sbin/mkfs -t acfs /dev/asm/ogg-276
mkfs.acfs: version                   = 11.2.0.3.0
mkfs.acfs: on-disk version           = 39.0
mkfs.acfs: volume                    = /dev/asm/ogg-276
mkfs.acfs: volume size               = 3221225472
mkfs.acfs: Format complete.

3.把设备文件,挂载点注册到GI的ACFS服务中
这一步的作用是以后重启操作系统,启动完GI后,会自动把我们的文件系统给挂载上.

[root@rac1 oracle]# acfsutil registry -a -f /dev/asm/ogg-276 /cloudfs
acfsutil registry: mount point /cloudfs successfully added to Oracle Registry
[root@rac1 ~]# acfsutil registry
Mount Object:
  Device: /dev/asm/ogg-276
  Mount Point: /cloudfs
  Disk Group: DATA
  Volume: OGG
  Options: none
  Nodes: all

[root@rac1 ~]# acfsutil info fs /cloudfs/
/cloudfs/
    ACFS Version: 11.2.0.3.0
    flags:        MountPoint,Available
    mount time:   Sun Aug  5 22:42:48 2012
    volumes:      1
    total size:   3221225472
    total free:   3145486336
    primary volume: /dev/asm/ogg-276
        label:
        flags:                 Primary,Available,ADVM
        on-disk version:       39.0
        allocation unit:       4096
        major, minor:          252, 141313
        size:                  3221225472
        free:                  3145486336
        ADVM diskgroup         DATA
        ADVM resize increment: 33554432
        ADVM redundancy:       unprotected
        ADVM stripe columns:   4
        ADVM stripe width:     131072
    number of snapshots:  0
    snapshot space usage: 0
    replication status: DISABLED

4.重启ACFS服务.重启后自动挂载.

[oracle@rac1 ~]$ crs_stop ora.registry.acfs
Attempting to stop `ora.registry.acfs` on member `rac1`
Attempting to stop `ora.registry.acfs` on member `rac2`
Stop of `ora.registry.acfs` on member `rac1` succeeded.
Stop of `ora.registry.acfs` on member `rac2` succeeded.
[oracle@rac1 ~]$ crs_start ora.registry.acfs
Attempting to start `ora.registry.acfs` on member `rac2`
Attempting to start `ora.registry.acfs` on member `rac1`
Start of `ora.registry.acfs` on member `rac2` succeeded.
Start of `ora.registry.acfs` on member `rac1` succeeded.
[oracle@rac1 ~]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3              16G   11G  4.2G  72% /
/dev/sda1              99M   12M   83M  13% /boot
tmpfs                 1.5G  200M  1.3G  14% /dev/shm
/dev/asm/ogg-276      3.0G   73M  3.0G   3% /cloudfs

至此我们完成了我们以前在操作系统上做逻辑卷的操作.接下来再演示一下删除的操作.删除操作正好相反.

1.umount两边的文件系统

[root@rac1 ~]# umount /cloudfs/ [root@rac2 ~]# umount /cloudfs/

2.删除ASM卷

[oracle@rac1 ~]$ asmcmd voldelete -G data ogg

3.取消ACFS注册

[root@rac1 ~]# acfsutil registry -d /cloudfs/
acfsutil registry: successfully removed ACFS mount point /cloudfs from Oracle Registry

当然这些也可以通过图形界面ASMCA来实现,但是我使用图形界面删除卷的时候总是抱TNS-12541错误,但是我用命令行却没事,可能图形界面会有一些问题,所以我还是用字符命令来处理.

参考文档:ACFS Technical Overview and Deployment Guide

分享到: 更多

Post a Comment

Your email is never published nor shared. Required fields are marked *