在Red Hat Linux Server 6上能否使用ASMLib?

luashin發表於2016-02-01
    從安裝Oracle Database的角度來看,Oracle Linux要比Red Hat Linux更加適合,況且即使是Red Hat Linux 6,ASMLib也不是唯一的選擇,但出於歷史原因,我們透過這篇文章討論一下在Red Hat Linux Server 6上能否使用ASMLib?

下面是Oracle對在Red Hat Linux 6上使用ASMLib的說明:

Oracle ASMLib Downloads for Red Hat Enterprise Linux Server 6

Note: All ASMLib installations require that the 'kmod-oracleasm','oracleasmlib' and 'oracleasm-support' packages be installed on the system. The 'oracleasmlib' and 'oracleasm-support' packages are available for download at the locations listed below. 
 
The kernel driver package 'kmod-oracleasm' is available directly from Red Hat, and can be installed from the "RHEL Server Supplementary (v. 6 64-bit x86_64)" channel on Red Hat Network (RHN).  Use the ASMLib kernel driver that corresponds to the version of the Red Hat Enterprise Linux kernel you're running. 

To identify which version of the ASMLib kernel driver you need, view the description field of the 'kmod-oracleasm' package in the "RHEL Server Supplementary (v. 6 64-bit x86_64)" channel on RHN. 

   使用ASMLib需要3個包:kmod-oracleasm oracleasmlib oracleasm-support,
後兩個包都可以直接在網站上下載到,關鍵是第一個ASMLib核心驅動包需要到RHN上更新,且應該匹配作業系統的核心版本。
上文字來源於:
[root@localhost opt]# cd /opt
[root@localhost opt]# ls
rh  rhel-server-supplementary-6.4-x86_64-dvd.iso
[root@localhost opt]# mount -o loop rhel-server-supplementary-6.4-x86_64-dvd.iso /mnt
[root@localhost opt]# cd /mnt
[root@localhost mnt]# find . -name kmod-oracleasm*
rhel-server-supplementary光碟中找不到kmod-oracleasm包。

下面是Oracle對在Oracle Linux 6上使用ASMLib的說明:

Oracle ASMLib Downloads for Oracle Linux 6

Note: All ASMLib installations require the oracleasmlib and oracleasm-support packages appropriate for their machine.
The oracleasm-support package can be downloaded from the (ULN) if you have an active support subscription, or from  if you do not. 
The oracleasm kernel driver is built into the Unbreakable Enterprise Kernel for Oracle Linux 6 and does not need to be installed manually. 
The oracleasm kernel driver for the 64-bit (x86_64) Red Hat Compatible Kernel for Oracle Linux 6 can be installed manually from  or  using the yum tool:
# yum install kmod-oracleasm

This kernel driver is not version-specific and does not need to be upgraded when the kernel is upgraded.

如果使用的是Oracle Linux的uek核心,oracleasm已經被編譯到了核心中,如果使用的是和Red Hat相容的核心,那麼需要手動安裝kmod-oracleasm包。
以上文字來源於:

下載oracle提供的yum配置檔案,從Oracle伺服器上安裝kmod-oracleasm檔案:
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
rhel-source.repo
[root@localhost yum.repos.d]# wget
--2014-03-25 22:43:05--  
Resolving public-yum.oracle.com... 2.16.54.48, 2.16.54.96
Connecting to public-yum.oracle.com|2.16.54.48|:80... failed: Connection reset by peer.
Connecting to public-yum.oracle.com|2.16.54.96|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4233 (4.1K) [text/plain]
Saving to: “public-yum-ol6.repo”
100%[===================================================================================================>] 4,233       --.-K/s   in 0s      
2014-03-25 22:43:07 (190 MB/s) - “public-yum-ol6.repo” saved [4233/4233]

[root@localhost yum.repos.d]# yum install kmod-oracleasm
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
ol6_UEK_latest                                                                                                        | 1.2 kB     00:00     
ol6_UEK_latest/primary                                                                                                |  13 MB     03:26     
ol6_UEK_latest                                                                                                                       281/281
ol6_latest                                                                                                            | 1.4 kB     00:00     
ol6_latest/primary                                                                                                    |  36 MB     15:39     
ol6_latest                                                                                                                       24977/24977
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package kmod-oracleasm.x86_64 0:2.0.6.rh1-2.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================
 Package                             Arch                        Version                               Repository                       Size
=============================================================================================================================================
Installing:
 kmod-oracleasm                      x86_64                      2.0.6.rh1-2.el6                       ol6_latest                       34 k
Transaction Summary
=============================================================================================================================================
Install       1 Package(s)
Total download size: 34 k
Installed size: 115 k
Is this ok [y/N]: y
Downloading Packages:
kmod-oracleasm-2.0.6.rh1-2.el6.x86_64.rpm                                                                             |  34 kB     00:00     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
GPG key retrieval failed: [Errno 14] Could not open/read file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle

參考頁面,在Red Hat Linux Server 6上執行下面的wget命令:

[root@localhost yum.repos.d]# wget RPM-GPG-KEY-oracle-ol6 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
--2014-03-25 23:06:00--  RPM-GPG-KEY-oracle-ol6
Resolving public-yum.oracle.com... 46.33.75.121, 46.33.75.138
Connecting to public-yum.oracle.com|46.33.75.121|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1011 [text/plain]
Saving to: “/etc/pki/rpm-gpg/RPM-GPG-KEY-oracle”
100%[===================================================================================================>] 1,011       --.-K/s   in 0s      
2014-03-25 23:06:01 (27.6 MB/s) - “/etc/pki/rpm-gpg/RPM-GPG-KEY-oracle” saved [1011/1011]

[root@localhost yum.repos.d]# yum install kmod-oracleasm
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package kmod-oracleasm.x86_64 0:2.0.6.rh1-2.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================
 Package                             Arch                        Version                               Repository                       Size
=============================================================================================================================================
Installing:
 kmod-oracleasm                      x86_64                      2.0.6.rh1-2.el6                       ol6_latest                       34 k
Transaction Summary
=============================================================================================================================================
Install       1 Package(s)

Total size: 34 k
Installed size: 115 k
Is this ok [y/N]: y
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
Importing GPG key 0xEC551F03:
 Userid: "Oracle OSS group (Open Source Software group) "
 From  : /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : kmod-oracleasm-2.0.6.rh1-2.el6.x86_64                                                                                     1/1 
mylocalnet/productid                                                                                                  | 1.7 kB     00:00 ... 
  Verifying  : kmod-oracleasm-2.0.6.rh1-2.el6.x86_64                                                                                     1/1 
Installed:
  kmod-oracleasm.x86_64 0:2.0.6.rh1-2.el6                                                                                            
Complete!

[root@localhost yum.repos.d]# cd /opt
[root@localhost opt]# ls
oracleasmlib-2.0.4-1.el6.x86_64.rpm  oracleasm-support-2.1.8-1.el6.x86_64.rpm  rh  rhel-server-supplementary-6.4-x86_64-dvd.iso
[root@localhost opt]# rpm -ivh oracleasmlib-2.0.4-1.el6.x86_64.rpm oracleasm-support-2.1.8-1.el6.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:oracleasm-support      ########################################### [ 50%]
   2:oracleasmlib           ########################################### [100%]
    至此在Red Hat Linux Server 6.4 x86_64bit上成功安裝了kmod-oracleasm oracleasm-support oracleasmlib 3個包。

下面是ASMLib的配置和使用實驗:

[root@localhost ~]# /etc/init.d/oracleasm configure
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 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]: 
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [  OK  ]
Scanning the system for Oracle ASMLib disks: [  OK  ]

[root@localhost ~]# fdisk -l
Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 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: 0x000f1993
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26         679     5242880   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3             679        6528    46980096   83  Linux
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 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: 0x00000000

[root@localhost ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x15fd0887.
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 to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1044, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1044, default 1044): 
Using default value 1044
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# /etc/init.d/oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes
[root@localhost ~]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk "VOL1" as an ASM disk: [FAILED]
跟蹤/var/log/messages可以發現有如下的報錯:
......
Mar 25 15:34:47 localhost kernel: type=1400 audit(1395732887.792:22623): avc:  denied  { associate } for  pid=2044 comm="oracleasm-insta" name="VOL1" scontext=unconfined_u:object_r:unlabeled_t:s0 tcontext=system_u:object_r:unlabeled_t:s0 tclass=filesystem
可以大致看出這個錯誤根作業系統的核心有關係。
由此在Red Hat Linux Server 6上安裝、使用ASMLib失敗!

   透過這個實驗並不能確切的說在Red Hat Linux Server 6上不能使用ASMLib,或許透過更換核心,或購買正版Linux從Redhat更新kmod-oracleasm可以正常的使用ASMLib,但這未免也太過於折騰了吧,使用udev將塊裝置轉換為字元裝置來直接使用就挺好!

--end--

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9034054/viewspace-1985350/,如需轉載,請註明出處,否則將追究法律責任。

相關文章