本文主要是介绍使用ASMLib配置共享磁盘,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一 安装ASMLIB
点击这里下载安装包。
#在所有rac节点上安装
rpm -ivh oracleasm-support-2.1.8-1.el6.x86_64.rpm
rpm -ivh kmod-oracleasm-2.0.8-13.el6_8.x86_64.rpm
rpm -ivh oracleasmlib-2.0.4-1.el6.x86_64.rpm
二 配置ASMLIB
#在所有rac节点上配置:
[root@rac1 opt]# oracleasm configure -i
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting <ENTER> without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: grid
Default group to own the driver interface []: asmadmin
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
#查看配置
[root@rac1 opt]# oracleasm configure
ORACLEASM_ENABLED=true
ORACLEASM_UID=grid
ORACLEASM_GID=asmadmin
ORACLEASM_SCANBOOT=true
ORACLEASM_SCANORDER=""
ORACLEASM_SCANEXCLUDE=""
ORACLEASM_USE_LOGICAL_BLOCK_SIZE="false"
三 加载 oracleasm 内核模块
#在所有rac节点上执行:
[root@rac2 opt]# /usr/sbin/oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module "oracleasm": oracleasm
Configuring "oracleasm" to use device physical block size
Mounting ASMlib driver filesystem: /dev/oracleasm
/*
该步骤完成以下任务:
• 创建 /etc/sysconfig/oracleasm 配置文件
• 创建 /dev/oracleasm 挂载点
• 挂载 ASMLib 驱动程序文件系统
*/
#检查状态
[root@rac2 opt]# oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes
四 创建ASM磁盘
创建 ASM 磁盘只需在 RAC 集群中的一个节点上以 root 用户帐户执行。
4.1 对共享磁盘进行分区
这里以共享磁盘/dev/sdb为例
[root@rac1 opt]# fdisk /dev/sdbDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel with disk identifier 0x15d3e0e7.Changes will remain in memory only, until you decide to write them.After that, of course, the previous content won't be recoverable.Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)WARNING: DOS-compatible mode is deprecated. It's strongly recommended toswitch off the mode (command 'c') and change display units tosectors (command 'u').Command (m for help): mCommand actiona toggle a bootable flagb edit bsd disklabelc toggle the dos compatibility flagd delete a partitionl list known partition typesm print this menun add a new partitiono create a new empty DOS partition tablep print the partition tableq quit without saving changess create a new empty Sun disklabelt change a partition's system idu change display/entry unitsv verify the partition tablew write table to disk and exitx extra functionality (experts only)Command (m for help): nCommand actione extendedp primary partition (1-4)pPartition number (1-4): 1First cylinder (1-2610, default 1):Using default value 1Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610):Using default value 2610Command (m for help): tSelected partition 1Hex code (type L to list codes): 8eChanged system type of partition 1 to 8e (Linux LVM)Command (m for help): pDisk /dev/sdb: 21.5 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x15d3e0e7Device Boot Start End Blocks Id System/dev/sdb1 1 2610 20964793+ 8e Linux LVMCommand (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.
#查看分区
[root@rac1 opt]# fdisk -l /dev/sdb
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x15d3e0e7
Device Boot Start End Blocks Id System
/dev/sdb1 1 2610 20964793+ 8e Linux LVM
在其他节点上也能看到该分区:
4.2 创建ASM磁盘
oracleasm createdisk DATA /dev/sdb1
在其他RAC 节点上,需要执行 scandisk 以识别asm磁盘:
[root@rac2 opt]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
Instantiating disk "DATA"
#查看磁盘
[root@rac2 opt]# oracleasm listdisks
DATA
[root@rac1 rpm]# oracleasm querydisk -p data
Disk "DATA" is a valid ASM disk
/dev/sdb1: LABEL="DATA" TYPE="oracleasm"
--本篇文章主要参考了https://blog.csdn.net/XiaoHG_CSDN/article/details/113839926
这篇关于使用ASMLib配置共享磁盘的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!