通过ACFS创建共享的文件系统
安装ACFS
[root@test1 bin]# ./acfsroot install
ACFS-9300: ADVM/ACFS distribution files found.
ACFS-9312: Existing ADVM/ACFS installation detected.
ACFS-9314: Removing previous ADVM/ACFS installation.
ACFS-9315: Previous ADVM/ACFS components successfully removed.
ACFS-9307: Installing requested ADVM/ACFS software.
ACFS-9308: Loading installed ADVM/ACFS drivers.
ACFS-9321: Creating udev for ADVM/ACFS.
ACFS-9323: Creating module dependencies - this may take some time.
ACFS-9154: Loading 'oracleoks.ko' driver.
ACFS-9154: Loading 'oracleadvm.ko' driver.
ACFS-9154: Loading 'oracleacfs.ko' driver.
ACFS-9327: Verifying ADVM/ACFS devices.
ACFS-9156: Detecting control device '/dev/asm/.asm_ctl_spec'.
ACFS-9156: Detecting control device '/dev/ofsctl'.
ACFS-9309: ADVM/ACFS installation correctness verified
加载ADVM/ACFS drivers
[root@test1 bin]# ./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
用ASMCA的方式简单
使用asmca静默方式创建ADVM 逻辑卷
[grid@test1 ~]$ asmca -silent -createVolume -volumename vol2 -volumeDiskGroup ASMVG1 -volumeSizeGB 1;
Volumes fetched successfully. Check /oracle/grid/cfgtoollogs/asmca/asmca-210330AM104752.log for details.
通过视图查看acfs volume信息
SQL> select group_number,VOLUME_NAME,SIZE_MB,STATE,VOLUME_DEVICE from v$asm_volume
GROUP_NUMBER VOLUME_NAME SIZE_MB STATE VOLUME_DEVICE
------------ ------------------------------ ---------- -------- ------------------------------
2 VOL2 1024 DISABLED /dev/asm/vol2-84
都在节点一执行
[grid@test1 ~]$ asmca -silent -createVolume -volumename vol2 -volumeDiskGroup ASMVG1 -volumeSizeGB 1;
Volumes fetched successfully. Check /oracle/grid/cfgtoollogs/asmca/asmca-210330AM113358.log for details.
[grid@test1 ~]$ asmca -silent -createACFS -acfsVolumeDevice /dev/asm/vol2-84 -acfsMountPoint /sharedacfs;
ASM Cluster File System created on /dev/asm/vol2-84 successfully. Run the generated ACFS registration script /oracle/grid/cfgtoollogs/asmca/scripts/acfs_script.sh as privileged user to register the ACFS with Grid Infrastructure and to mount the ACFS. The ACFS registration script needs to be run only on this node: test1.
执行脚本
[root@test1 ~]# /oracle/grid/cfgtoollogs/asmca/scripts/acfs_script.sh
ACFS file system /sharedacfs is mounted on nodes test1,test2
集群状态
ora.ASMVG1.VOL2.advm
ONLINE ONLINE test1 STABLE
ONLINE ONLINE test2 STABLE
ora.ASMVG1.dg
ONLINE ONLINE test1 STABLE
ONLINE ONLINE test2 STABLE
ora.LISTENER.lsnr
ONLINE ONLINE test1 STABLE
ONLINE ONLINE test2 STABLE
ora.asm
ONLINE ONLINE test1 Started,STABLE
ONLINE ONLINE test2 Started,STABLE
ora.asmvg1.vol2.acfs
ONLINE ONLINE test1 mounted on /sharedacfs,STABLE
ONLINE ONLINE test2 mounted on /sharedacfs,STABLE
通过acfsutil工具查看当前的ACFS 文件系统
[grid@test2 ~]$ acfsutil info fs
/stage
ACFS Version: 12.1.0.2.0
on-disk version: 39.0
flags: MountPoint,Available
mount time: Tue Mar 30 12:36:54 2021
allocation unit: 4096
volumes: 1
total size: 1073741824 ( 1.00 GB )
total free: 991641600 ( 945.70 MB )
file entry table allocation: 49152
primary volume: /dev/asm/vol1-84
label:
state: Available
major, minor: 251, 43009
size: 1073741824 ( 1.00 GB )
free: 991641600 ( 945.70 MB )
ADVM diskgroup ASMVG1
ADVM resize increment: 67108864
ADVM redundancy: unprotected
ADVM stripe columns: 8
ADVM stripe width: 1048576
number of snapshots:
snapshot space usage: 0 ( 0.00 )
replication status: DISABLED
/sharedacfs
ACFS Version: 12.1.0.2.0
on-disk version: 39.0
flags: MountPoint,Available
mount time: Tue Mar 30 12:36:54 2021
allocation unit: 4096
volumes: 1
total size: 1073741824 ( 1.00 GB )
total free: 991641600 ( 945.70 MB )
file entry table allocation: 49152
primary volume: /dev/asm/vol2-84
label:
state: Available
major, minor: 251, 43010
size: 1073741824 ( 1.00 GB )
free: 991641600 ( 945.70 MB )
ADVM diskgroup ASMVG1
ADVM resize increment: 67108864
ADVM redundancy: unprotected
ADVM stripe columns: 8
ADVM stripe width: 1048576
number of snapshots:
snapshot space usage: 0 ( 0.00 )
replication status: DISABLED
修改共享文件系统权限,在一个节点执行即可
root@test1 stage]# chown -R oracle.dba /sharedacfs/
[root@test1 stage]# chmod -R 755 /sharedacfs/
[root@test1 stage]#
[root@test1 stage]# ls -lrt /sharedacfs/
total 64
drwxr-xr-x 2 oracle dba 65536 Mar 30 11:39 lost+found
-rwxr-xr-x 1 oracle dba 0 Mar 30 11:42 test.sh
另一个节点确认看到该文件
[root@test2 stage]# ls /sharedacfs/
test.sh
补充:也可以通过asmcmd指令行方式或者asmca图形化方式,下面资料来自12C-doc
https://docs.oracle.com/database/121/OSTMG/GUID-4C98CF06-8CCC-45F1-9316-C40FB3EFF268.htm#OSTMG94787
1
To create a volume:
ASMCMD [+] > volcreate -G data -s 10G volume1
2
ASMCMD [+] > volinfo -G data volume1
Diskgroup Name: DATA
Volume Name: VOLUME1
Volume Device: /dev/asm/volume1-123
State: ENABLED
...
SQL> SELECT volume_name, volume_device FROM V$ASM_VOLUME
WHERE volume_name ='VOLUME1';
VOLUME_NAME VOLUME_DEVICE
----------------- --------------------------------------
VOLUME1 /dev/asm/volume1-123
3
Create a file system with the Oracle ACFS mkfs command.
Create a file system using an existing volume device.
For example:
$ /sbin/mkfs -t acfs /dev/asm/volume1-123
mkfs.acfs: version = 11.2.0.1.0.0
mkfs.acfs: on-disk version = 39.0
mkfs.acfs: volume = /dev/asm/volume1-123
mkfs.acfs: volume size = 10737418240
mkfs.acfs: Format complete.
4
Optionally register the file system with the acfsutil registry command.
For example:
$ /sbin/acfsutil registry -a /dev/asm/volume1-123 /acfsmounts/acfs1
acfsutil registry: mount point /acfsmounts/acfs1 successfully added
to Oracle Registry
这个步骤是可选的,还是建议注册,使得集群节点自动mount文件系统
5 挂载ACFS到挂载点,这个挂载点要提前准备好
- Mount the file system with the Oracle ACFS mount command. You can mount a file system before or after registering the file system. If the file system has been registered, you can wait for the file system to be mounted automatically.For example:
# /bin/mount -t acfs /dev/asm/volume1-123 /acfsmounts/acfs1
See "mount" (Linux environments) or "acfsmountvol" (Windows). The root privilege is required to run the mount command and the Windows Administrator privilege is required to run the acfsmountvol command.
After the file system has been mounted, ensure that the permissions are set to allow access to the file system for the appropriate users. For example:
# chown -R oracle:dba /acfsmounts/acfs
相关文章