ASMlib操作系統包安裝與配置asm disk磁盤
阿新 • • 發佈:2017-06-24
grid pla admin art flag sca swe part correct
1.加入6塊硬盤,每塊100g。不管是熱加還是冷加。不管是加硬盤,用san存儲劃lun,或者再加上多路徑,都是能夠這麽做的。
在操作系統層,能識別這種lun。以下的sdb就是一個剛劃分的300g的lun(也就是硬盤。或者裸塊設備)。 [[email protected] ~]# cd /dev [[email protected] dev]# ls -l | grep sd brw-r----- 1 root disk 8, 0 Apr 11 12:21 sda brw-r----- 1 root disk 8, 1 Apr 11 12:21 sda1
brw-r----- 1 root disk 8, 2 Apr 11 12:21 sda2
brw-r----- 1 root disk 8, 16 Apr 11 12:21 sdb
分區 我們對硬盤進行分區,興許把分區分別作為asm磁盤。事實上就一塊機械硬盤,根本不是必需分區再做asm。 僅僅有多塊硬盤的時候。能夠用asm做鏡像與條帶化等。假設存儲已經做了raid,給我劃分的lun我也不是必需再做分區,直接能夠加為asm了。 當然,比方有/dev/sda。/dev/sdb兩塊機械硬盤,我能夠分別劃分出/dev/sda1、/dev/sda2、/dev/sdb1、/dev/sdb2,然後摘取/dev/sda1與/dev/sdb1出來聯合做一個asm disk1.
[[email protected] dev]# fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won‘t be recoverable.
The number of cylinders for this disk is set to 39162.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-39162, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-39162, default 39162): 60
Command (m for help): n
Command action
e extended
p primary partition (1-4)
2
Invalid partition number for type `2‘
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (61-39162, default 61): 61
Last cylinder or +size or +sizeM or +sizeK (61-39162, default 39162): 120
Command (m for help): n
Command action
e extended
p primary partition (1-4)
3
Invalid partition number for type `3‘
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (121-39162, default 121): 121
Last cylinder or +size or +sizeM or +sizeK (121-39162, default 39162): 180
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Selected partition 4
First cylinder (181-39162, default 181): 181
Last cylinder or +size or +sizeM or +sizeK (181-39162, default 39162): 240
Command (m for help): n
You must delete some partition and add an extended partition first
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition‘s system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): d
Partition number (1-4): 4
Command (m for help): n
Command action
e extended
p primary partition (1-4)
e
Selected partition 4
First cylinder (181-39162, default 181):
Using default value 181
Last cylinder or +size or +sizeM or +sizeK (181-39162, default 39162): 240
Command (m for help): n
First cylinder (181-240, default 181):
Using default value 181
Last cylinder or +size or +sizeM or +sizeK (181-240, default 240): 210
Command (m for help): n
First cylinder (211-240, default 211):
Using default value 211
Last cylinder or +size or +sizeM or +sizeK (211-240, default 240):
Using default value 240
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition‘s system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[[email protected] dev]# pwd
/dev
[[email protected] dev]# ls | grep sd
sda
sda1
sda2
sdb
sdb1
sdb2
sdb3
sdb4
sdb5
sdb6
我們將sdb這塊裸設備,分區稱sdb1-sdb6,但這些sdb1-6也並不含文件系統。也就是說,還沒被文件系統格式化。
從官方站點下載oracle程序包 pri:orcl2 > uname -a Linux pri 2.6.18-308.el5 #1 SMP Fri Jan 27 17:17:51 EST 2012 x86_64 x86_64 x86_64 GNU/Linux http://www.oracle.com/technetwork/topics/linux/asmlib oracleasmlib-2.0 - ASM庫 oracleasm-support-2.0 - utilities needed to administer ASMLib 管理ASMlib所需的有用程序 oracleasm - a kernel module for the Oracle ASM library ASM庫的內核模塊
下載了這5個,一定要註意,看上面5個rpm包,都寫著是64位的。
對於dji單數據庫用戶來裝,就不用分grid用戶與oracle用戶了。 據說不建asmadmin等等的組,那麽就能夠用普通的oracle用戶也擁有asmdba權限。 加入每一個節點的/etc/security/limits.conf oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft core unlimited oracle soft core unlimited 加入每一個節點的/etc/pam.d/login文件 session required pam_limits.so 對於Bourne、Bash或Korn shell,將下面內容加到每一個節點的/etc/profile文件裏。 if [ $USER = "oracle"] || [ $USER = "grid" ];then if [ $SHELL = "/bin/ksh" ];then ulimit -u 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi umask 022 fi
配置ASMLib,不加-i就是顯示當前配置,然後運行oracleasm init就等同於之前-i的指令。 /usr/sbin/oracleasm configure -i
配置之前: [[email protected] asmlib]# /usr/sbin/oracleasm configure ORACLEASM_ENABLED=false ORACLEASM_UID= ORACLEASM_GID= ORACLEASM_SCANBOOT=true ORACLEASM_SCANORDER="" ORACLEASM_SCANEXCLUDE="" ORACLEASM_USE_LOGICAL_BLOCK_SIZE="false"
配置: [[email protected] asmlib]# /usr/sbin/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 []: oracle Default group to own the driver interface []: dba 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
配置之後: [[email protected] asmlib]# /usr/sbin/oracleasm configure ORACLEASM_ENABLED=true ORACLEASM_UID=oracle ORACLEASM_GID=dba ORACLEASM_SCANBOOT=true ORACLEASM_SCANORDER="" ORACLEASM_SCANEXCLUDE="" ORACLEASM_USE_LOGICAL_BLOCK_SIZE="false"
為asm加入asm磁盤 此時/dev/sdb1僅僅是操作系統認識的分區,我要將其設為讓ASM也認識。 /usr/sbin/oracleasm createdisk data1 /dev/sdb1 每一個節點以root輸入。ASM磁盤對每一個節點可用。 /usr/sbin/oracleasm scandisks /usr/sbin/oracleasm listdisks(檢驗一下)
[[email protected] asmlib]# /usr/sbin/oracleasm createdisk data1 /dev/sdb1 Writing disk header: done Instantiating disk: failed Clearing disk header: done [[email protected] asmlib]# [[email protected] asmlib]# /usr/sbin/oracleasm createdisk data1 /dev/sdb2 Writing disk header: done Instantiating disk: failed Clearing disk header: done [[email protected] asmlib]# /usr/sbin/oracleasm createdisk data1 /dev/sdb3 Writing disk header: done Instantiating disk: failed Clearing disk header: done [[email protected] asmlib]# /usr/sbin/oracleasm createdisk data1 /dev/sdb4 Writing disk header: failed Unable to label device "/dev/sdb4" [[email protected] asmlib]# cd /dev [[email protected] dev]# ls | grep sd sda sda1 sda2 sdb sdb1 sdb2 sdb3 sdb4 sdb5 sdb6
不知道為什麽,我盡管有sdb4,可是這樣會失敗,是不是擴產分區就不能用來做asm盤的。
每一個節點以root輸入,ASM磁盤對每一個節點可用。 [[email protected] dev]# /usr/sbin/oracleasm scandisks Reloading disk partitions: done Cleaning any stale ASM disks... Scanning system for ASM disks...
以下這個必須配置上,不然不能裝GI。這個要跟vip在同一個網段上,而且不能是本機ip,也不能使已經使用的。 /etc/hosts 10.60.17.150 pri-scan 假設出現[ins-40724] no locally defined network interface matches the scan subnet.報錯。重新啟動下主機就好。
後來又發現有報錯,在例如以下這個界面。好像要再再/etc/hosts中,弄一個pri-vip。隨便弄一個跟公網不同一個網段,但地址不一樣的ip才幹通過。
[[email protected] ~]# /usr/sbin/oracleasm createdisk data1 /dev/sdb1 Writing disk header: done Instantiating disk: failed Clearing disk header: done
[[email protected] ~]# vi /var/log/oracleasm Creating /dev/oracleasm mount point: /dev/oracleasm Loading module "oracleasm": failed Unable to load module "oracleasm" Cleaning any stale ASM disks... Loading module "oracleasm": failed Unable to load module "oracleasm"
最後發現。官網上給下載的是oracle linux的asm包。 那redhat 的怎麽辦呢?原來redhat的光碟自帶有iso文件。 [[email protected] Server]# ls | grep oracleasm oracleasm-2.6.18-274.el5-2.0.5-1.el5.x86_64.rpm oracleasm-2.6.18-274.el5debug-2.0.5-1.el5.x86_64.rpm oracleasm-2.6.18-274.el5xen-2.0.5-1.el5.x86_64.rpm oracleasm-support-2.1.7-1.el5.x86_64.rpm
我就是下載了例如以下兩個,rpm -ivh 。其余兩個安裝不了。 oracleasm-support-2.1.7-1.el5.x86_64.rpm oracleasm-2.6.18-274.el5-2.0.5-1.el5.x86_64.rpm
[[email protected] mnt]# cd /mnt [[email protected] mnt]# mkdir cdrom [[email protected] mnt]# mount /dev/cdrom /mnt/cdrom mount: block device /dev/cdrom is write-protected, mounting read-only
發現還是不行。 將之前下載的64bit的oracleasmlib-2.0.4-1.el5.x86_64.rpm也上傳上去,安裝上。 也不行。嘗試重新啟動一下。
[[email protected] ~]# /usr/sbin/oracleasm createdisk data1 /dev/sdc1 Writing disk header: done Instantiating disk: done
成功了。可能剛才直接重新啟動也能夠,不用加一個rpm包,也可能要。
[[email protected] ~]# /usr/sbin/oracleasm createdisk data1 /dev/sdc1 Writing disk header: done Instantiating disk: done [[email protected] ~]# /usr/sbin/oracleasm createdisk data2 /dev/sdb1 Writing disk header: done Instantiating disk: done [[email protected] ~]# /usr/sbin/oracleasm createdisk data3 /dev/sdd1 Writing disk header: done Instantiating disk: done [[email protected] ~]# /usr/sbin/oracleasm createdisk data4 /dev/sde1 Writing disk header: done Instantiating disk: done [[email protected] ~]# /usr/sbin/oracleasm scandisks Reloading disk partitions: done Cleaning any stale ASM disks... Scanning system for ASM disks... [[email protected] ~]#
[[email protected] ~]# /usr/sbin/oracleasm listdisks 或者service oracleasm listdisks DATA1 DATA2 DATA3 DATA4
有了這4個ASM盤後,開始裝GI。
假設要刪除 ASM磁盤可通過下面命令:
[[email protected] ~]#/etc/init.d/oracleasm deletedisk ASMDISK5
在操作系統層,能識別這種lun。以下的sdb就是一個剛劃分的300g的lun(也就是硬盤。或者裸塊設備)。 [[email protected] ~]# cd /dev [[email protected] dev]# ls -l | grep sd brw-r----- 1 root disk 8, 0 Apr 11 12:21 sda brw-r----- 1 root disk 8, 1 Apr 11 12:21 sda1
分區 我們對硬盤進行分區,興許把分區分別作為asm磁盤。事實上就一塊機械硬盤,根本不是必需分區再做asm。 僅僅有多塊硬盤的時候。能夠用asm做鏡像與條帶化等。假設存儲已經做了raid,給我劃分的lun我也不是必需再做分區,直接能夠加為asm了。 當然,比方有/dev/sda。/dev/sdb兩塊機械硬盤,我能夠分別劃分出/dev/sda1、/dev/sda2、/dev/sdb1、/dev/sdb2,然後摘取/dev/sda1與/dev/sdb1出來聯合做一個asm disk1.
[[email protected] dev]# fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won‘t be recoverable.
我們將sdb這塊裸設備,分區稱sdb1-sdb6,但這些sdb1-6也並不含文件系統。也就是說,還沒被文件系統格式化。
從官方站點下載oracle程序包 pri:orcl2 > uname -a Linux pri 2.6.18-308.el5 #1 SMP Fri Jan 27 17:17:51 EST 2012 x86_64 x86_64 x86_64 GNU/Linux http://www.oracle.com/technetwork/topics/linux/asmlib oracleasmlib-2.0 - ASM庫 oracleasm-support-2.0 - utilities needed to administer ASMLib 管理ASMlib所需的有用程序 oracleasm - a kernel module for the Oracle ASM library ASM庫的內核模塊
下載了這5個,一定要註意,看上面5個rpm包,都寫著是64位的。
結果最後僅僅能裝上這三個。
-rw-r--r-- 1 root root 25460 Apr 11 18:34 oracleasm-2.6.18-308.24.1.el5-2.0.5-1.el5.x86_64.rpm
-rw-r--r-- 1 root root 90225 Apr 11 18:36 oracleasm-support-2.1.8-1.el5.x86_64.rpm
-rw-r--r-- 1 root root 14176 Apr 11 18:36 oracleasmlib-2.0.4-1.el5.x86_64.rpm
對於dji單數據庫用戶來裝,就不用分grid用戶與oracle用戶了。 據說不建asmadmin等等的組,那麽就能夠用普通的oracle用戶也擁有asmdba權限。 加入每一個節點的/etc/security/limits.conf oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft core unlimited oracle soft core unlimited 加入每一個節點的/etc/pam.d/login文件 session required pam_limits.so 對於Bourne、Bash或Korn shell,將下面內容加到每一個節點的/etc/profile文件裏。 if [ $USER = "oracle"] || [ $USER = "grid" ];then if [ $SHELL = "/bin/ksh" ];then ulimit -u 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi umask 022 fi
配置ASMLib,不加-i就是顯示當前配置,然後運行oracleasm init就等同於之前-i的指令。 /usr/sbin/oracleasm configure -i
配置之前: [[email protected] asmlib]# /usr/sbin/oracleasm configure ORACLEASM_ENABLED=false ORACLEASM_UID= ORACLEASM_GID= ORACLEASM_SCANBOOT=true ORACLEASM_SCANORDER="" ORACLEASM_SCANEXCLUDE="" ORACLEASM_USE_LOGICAL_BLOCK_SIZE="false"
配置: [[email protected] asmlib]# /usr/sbin/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 []: oracle Default group to own the driver interface []: dba 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
配置之後: [[email protected] asmlib]# /usr/sbin/oracleasm configure ORACLEASM_ENABLED=true ORACLEASM_UID=oracle ORACLEASM_GID=dba ORACLEASM_SCANBOOT=true ORACLEASM_SCANORDER="" ORACLEASM_SCANEXCLUDE="" ORACLEASM_USE_LOGICAL_BLOCK_SIZE="false"
為asm加入asm磁盤 此時/dev/sdb1僅僅是操作系統認識的分區,我要將其設為讓ASM也認識。 /usr/sbin/oracleasm createdisk data1 /dev/sdb1 每一個節點以root輸入。ASM磁盤對每一個節點可用。 /usr/sbin/oracleasm scandisks /usr/sbin/oracleasm listdisks(檢驗一下)
[[email protected] asmlib]# /usr/sbin/oracleasm createdisk data1 /dev/sdb1 Writing disk header: done Instantiating disk: failed Clearing disk header: done [[email protected] asmlib]# [[email protected] asmlib]# /usr/sbin/oracleasm createdisk data1 /dev/sdb2 Writing disk header: done Instantiating disk: failed Clearing disk header: done [[email protected] asmlib]# /usr/sbin/oracleasm createdisk data1 /dev/sdb3 Writing disk header: done Instantiating disk: failed Clearing disk header: done [[email protected] asmlib]# /usr/sbin/oracleasm createdisk data1 /dev/sdb4 Writing disk header: failed Unable to label device "/dev/sdb4" [[email protected] asmlib]# cd /dev [[email protected] dev]# ls | grep sd sda sda1 sda2 sdb sdb1 sdb2 sdb3 sdb4 sdb5 sdb6
不知道為什麽,我盡管有sdb4,可是這樣會失敗,是不是擴產分區就不能用來做asm盤的。
每一個節點以root輸入,ASM磁盤對每一個節點可用。 [[email protected] dev]# /usr/sbin/oracleasm scandisks Reloading disk partitions: done Cleaning any stale ASM disks... Scanning system for ASM disks...
以下這個必須配置上,不然不能裝GI。這個要跟vip在同一個網段上,而且不能是本機ip,也不能使已經使用的。 /etc/hosts 10.60.17.150 pri-scan 假設出現[ins-40724] no locally defined network interface matches the scan subnet.報錯。重新啟動下主機就好。
後來又發現有報錯,在例如以下這個界面。好像要再再/etc/hosts中,弄一個pri-vip。隨便弄一個跟公網不同一個網段,但地址不一樣的ip才幹通過。
[[email protected] ~]# /usr/sbin/oracleasm createdisk data1 /dev/sdb1 Writing disk header: done Instantiating disk: failed Clearing disk header: done
[[email protected] ~]# vi /var/log/oracleasm Creating /dev/oracleasm mount point: /dev/oracleasm Loading module "oracleasm": failed Unable to load module "oracleasm" Cleaning any stale ASM disks... Loading module "oracleasm": failed Unable to load module "oracleasm"
最後發現。官網上給下載的是oracle linux的asm包。 那redhat 的怎麽辦呢?原來redhat的光碟自帶有iso文件。 [[email protected] Server]# ls | grep oracleasm oracleasm-2.6.18-274.el5-2.0.5-1.el5.x86_64.rpm oracleasm-2.6.18-274.el5debug-2.0.5-1.el5.x86_64.rpm oracleasm-2.6.18-274.el5xen-2.0.5-1.el5.x86_64.rpm oracleasm-support-2.1.7-1.el5.x86_64.rpm
我就是下載了例如以下兩個,rpm -ivh 。其余兩個安裝不了。 oracleasm-support-2.1.7-1.el5.x86_64.rpm oracleasm-2.6.18-274.el5-2.0.5-1.el5.x86_64.rpm
[[email protected] mnt]# cd /mnt [[email protected] mnt]# mkdir cdrom [[email protected] mnt]# mount /dev/cdrom /mnt/cdrom mount: block device /dev/cdrom is write-protected, mounting read-only
發現還是不行。 將之前下載的64bit的oracleasmlib-2.0.4-1.el5.x86_64.rpm也上傳上去,安裝上。 也不行。嘗試重新啟動一下。
[[email protected] ~]# /usr/sbin/oracleasm createdisk data1 /dev/sdc1 Writing disk header: done Instantiating disk: done
成功了。可能剛才直接重新啟動也能夠,不用加一個rpm包,也可能要。
反正重新啟動是必須的。
[[email protected] ~]# /usr/sbin/oracleasm createdisk data1 /dev/sdc1 Writing disk header: done Instantiating disk: done [[email protected] ~]# /usr/sbin/oracleasm createdisk data2 /dev/sdb1 Writing disk header: done Instantiating disk: done [[email protected] ~]# /usr/sbin/oracleasm createdisk data3 /dev/sdd1 Writing disk header: done Instantiating disk: done [[email protected] ~]# /usr/sbin/oracleasm createdisk data4 /dev/sde1 Writing disk header: done Instantiating disk: done [[email protected] ~]# /usr/sbin/oracleasm scandisks Reloading disk partitions: done Cleaning any stale ASM disks... Scanning system for ASM disks... [[email protected] ~]#
[[email protected] ~]# /usr/sbin/oracleasm listdisks 或者service oracleasm listdisks DATA1 DATA2 DATA3 DATA4
有了這4個ASM盤後,開始裝GI。
假設要刪除 ASM磁盤可通過下面命令:
[[email protected] ~]#/etc/init.d/oracleasm deletedisk ASMDISK5
[[email protected] mapper]# /usr/sbin/oracleasm createdisk data1 /dev/mapper/mpath0p7
Writing disk header: done
Instantiating disk: done
ASMlib操作系統包安裝與配置asm disk磁盤