티스토리 뷰
어째 오라클하고 엮이는 일이 많은데 어쨌든 국내엔 정리된 게 없어 asmlib에 관해 정리해 본다.
RAC를 깔려면 grid를 설치해야 하는데 거기에 필요한 건 asm디스크 그룹이다. 파티션을 나눠서 라벨링을 해 주면 grid가 인식하게 된다.
거기에 필요한 유틸리티가 ASMLib인데...다른 방법도 이것저것 있지만 ASMLib쪽이 직관적이고 사용하기 편한 것 같다. 데몬이 돌아가니까 그에 따른 문제는 좀 있을 순 있겠다. 그 외에 asmcmd로 라벨링을 할 수도 있는데 이쪽은 뜬금없이 라벨이 지워지는 등의 문제도 있었고... dd /dev/zero 등으로 나눠도 인식이 된다....만 이쪽은 NFS.
(참고:https://oracle-base.com/articles/linux/using-nfs-with-asm)
rpm파일은 오라클 홈페이지 등에서 찾을수있다. 필자는 centos 7을 사용했다.(http://www.oracle.com/technetwork/server-storage/linux/asmlib/rhel7-2773795.html)
support또한 깔아줘야 함.
우선 kmod-oracleasm을 깔아주고
# yum install oracleasm*
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: data.nicehosting.co.kr
* extras: data.nicehosting.co.kr
* updates: mirror.navercorp.com
Resolving Dependencies
--> Running transaction check
---> Package kmod-oracleasm.x86_64 0:2.0.8-19.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================
Package Arch Version Repository Size
=============================================================================================
Installing:
kmod-oracleasm x86_64 2.0.8-19.el7 base 34 k
Transaction Summary
=============================================================================================
Install 1 Package
Total download size: 34 k
Installed size: 119 k
Is this ok [y/d/N]: y
Downloading packages:
kmod-oracleasm-2.0.8-19.el7.x86_64.rpm | 34 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : kmod-oracleasm-2.0.8-19.el7.x86_64 1/1
Verifying : kmod-oracleasm-2.0.8-19.el7.x86_64 1/1
Installed:
kmod-oracleasm.x86_64 0:2.0.8-19.el7
Complete!
다운받은 rpm파일을 깔아주자
# rpm -ivh oracleasmlib-2.0.4-1.el5.x86_64.rpm
warning: oracleasmlib-2.0.4-1.el5.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 1e5e0159: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:oracleasmlib-2.0.4-1.el5 ################################# [100%]
# rpm -ivh oracleasm-support-2.1.8-1.el5.x86_64.rpm
warning: oracleasm-support-2.1.8-1.el5.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 1e5e0159: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:oracleasm-support-2.1.8-1.el5 ################################# [100%]
# oracleasm
Usage: oracleasm [--exec-path=<exec_path>] <command> [ <args> ]
oracleasm --exec-path
oracleasm -h
oracleasm -V
The basic oracleasm commands are:
configure Configure the Oracle Linux ASMLib driver
init Load and initialize the ASMLib driver
exit Stop the ASMLib driver
scandisks Scan the system for Oracle ASMLib disks
status Display the status of the Oracle ASMLib driver
listdisks List known Oracle ASMLib disks
querydisk Determine if a disk belongs to Oracle ASMlib
createdisk Allocate a device for Oracle ASMLib use
deletedisk Return a device to the operating system
renamedisk Change the label of an Oracle ASMlib disk
update-driver Download the latest ASMLib driver
그 다음은 asm 환경설정
# 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) [y]:
Scan for Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration: done
설정을 끝난 단말로 해서 이렇게 나오는데 실제로는 조금 더 많던 걸로 기억한다.
grid 설치 중에 필요조건 체크를 할 때 디바이스의 권한을 설정해 달라는 경우가 있는데, 그럴 땐 oracleasm을 통해서 디폴트 유저와 그룹을 지정해 주면 정상적으로 진행된다.
# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xe7333a6d.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-24657919, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-24657919, default 24657919):
Using default value 24657919
Partition 1 of type Linux and of size 11.8 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
# 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
# oracleasm createdisk ASM1 /dev/sdb1
Writing disk header: done
Instantiating disk: done
ASM에 사용할 디스크를 fdisk로 파티션을 생성해 주고, 생성된 파티션을 createdisk로 라벨링해 주면 된다.
oracleasm init명령을 주면 /dev/oracleasm 디렉토리가 만들어지고, oracleasm/disks에 라벨링된 디스크가 저장된다.
grid 설치 중에 이곳을 경로로 지정해주면 정상적으로 인식된다. 단 scandisk, listdisk를 했을 때 인식이 되어야 한다.
# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
# oracleasm listdisks
CRS1
CRS2
CRS3
DATA1
DATA2
FRA1
GIMR1
GIMR2
GIMR3
(scandisk를 하면 이미 라벨링된 디스크 또한 인식함)
systemctl을 써서 상태 정보가 확인 가능하다. systemctl start, stop 또한 쓸수 있음.
# systemctl status oracleasm
● oracleasm.service - LSB: Load OracleASM driver at system boot
Loaded: loaded (/etc/rc.d/init.d/oracleasm; bad; vendor preset: disabled)
Active: active (exited) since Tue 2018-01-23 19:59:30 EST; 19min ago
Docs: man:systemd-sysv-generator(8)
Process: 1174 ExecStart=/etc/rc.d/init.d/oracleasm start (code=exited, status=0/SUCCESS)
Jan 23 19:59:26 rac1 systemd[1]: Starting LSB: Load OracleASM driver at system boot...
Jan 23 19:59:26 rac1 oracleasm[1174]: Initializing the Oracle ASMLib driver: [ OK ]
Jan 23 19:59:30 rac1 oracleasm[1174]: Scanning the system for Oracle ASMLib disks: [ OK ]
Jan 23 19:59:30 rac1 systemd[1]: Started LSB: Load OracleASM driver at system boot.
이것저것 써봤는데 가끔 디스크가 인식이 안 되는 문제만 빼면 oracleasm이 가장 쓰기 편한 듯.