CentOS4.6安裝Oracle 10g RAC tips

oracle_ace發表於2008-01-03

花了一點時間在自己的環境上安裝了一個Oracle 10g RAC環境
安裝的步驟比較煩瑣而且有些麻煩www.oracle.com/technology/global/cn/pub/articles/chan-ubl-vmware.html
自己也總結了一些tips以備忘:

準備磁碟(shared disk)
---------------------------------

安裝完CentOS4.6之後還需要安裝如下RPM包:
------------------------------------------------------------------
libaio-0.3.105-2.i386.rpm
openmotif21-2.1.30-11.RHEL4.6.i386.rpm
sysstat-5.0.5-14.rhel4.i386.rpm
oracleasm-2.6.9-67.EL-2.0.3-1.i686.rpm
oracleasmlib-2.0.2-1.i386.rpm
oracleasm-support-2.0.3-1.i386.rpm
ocfs2-2.6.9-42.EL-1.2.3-1.i686.rpm
ocfs2console-1.2.1-1.i386.rpm
ocfs2-tools-1.2.1-1.i386.rpm


/etc/hosts檔案中的解析內容:
----------------------------------------
[oracle@rac1 ~]$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               rac1.cn.ibm.com rac1 localhost.localdomain localhost
192.168.0.77            rac1    rac1.cn.ibm.com
192.168.0.5             rac1-vip
10.10.10.31             rac1-priv

192.168.0.78            rac2    rac2.cn.ibm.com
192.168.0.6             rac2-vip
10.10.10.32             rac2-priv


/etc/modprobe.conf中新增裝置
-----------------------------------------
options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
並執行
modprobe -v hangcheck-timer命令


OCFS32和ASM磁碟的分割槽(Fdisk)
---------------------------------------------
fdisk /dev/sdb

對映其中3塊磁碟的裝置檔案到ASM(sda是localdisk,sdb是ocfs32)
----------------------------------------------------------------------------------------
[oracle@rac1 ~]$ cat /etc/sysconfig/rawdevices
# This file and interface are deprecated.
# Applications needing raw device access should open regular
# block devices with O_DIRECT.
# raw device bindings
# format: 
#         
# example: /dev/raw/raw1 /dev/sda1
#          /dev/raw/raw2 8 5
/dev/raw/raw1 /dev/sdc1
/dev/raw/raw2 /dev/sdd1
/dev/raw/raw3 /dev/sde1

以root使用者重新啟動rawdevices服務
[root@rac1 ~]# service rawdevices restart
Assigning devices:
           /dev/raw/raw1  --&gt   /dev/sdc1
/dev/raw/raw1:  bound to major 8, minor 33
           /dev/raw/raw2  --&gt   /dev/sdd1
/dev/raw/raw2:  bound to major 8, minor 49
           /dev/raw/raw3  --&gt   /dev/sde1
/dev/raw/raw3:  bound to major 8, minor 65
done

授權Oracle使用者訪問/dev/raw的許可權
[root@rac1 ~]# chown oracle:dba /dev/raw/raw[1-3]
[root@rac1 ~]# chmod 660 /dev/raw/raw[1-3]
[root@rac1 ~]# ls -l /dev/raw/raw*
crw-rw----  1 oracle dba 162, 1 Jan  3 16:59 /dev/raw/raw1
crw-rw----  1 oracle dba 162, 2 Jan  3 16:59 /dev/raw/raw2
crw-rw----  1 oracle dba 162, 3 Jan  3 16:59 /dev/raw/raw3

並建立軟連線
[oracle@rac1 ~]# ln -sf /dev/raw/raw1 /u01/oradata/devdb/asmdisk1
[oracle@rac1 ~]# ln -sf /dev/raw/raw2 /u01/oradata/devdb/asmdisk2
[oracle@rac1 ~]# ln -sf /dev/raw/raw3 /u01/oradata/devdb/asmdisk3

修改/etc/udev/permissions.d/50-udev.permissions
--------------------------------------------------------------------
修改其中的內容.
# raw devices
ram*:root:disk:0660
#raw/*:root:disk:0660
raw/*:oracle:dba:0660

建立RAC節點之間的信任關係
-----------------------------------------
su - oracle
mkdir ~/.ssh
chmod 700  ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys
測試兩個節點之間的信任關係

在兩個節點上都以root使用者配置Oracle ASM管理
--------------------------------------------------------------------
[root@rac1 ~]# /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 []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: [  OK  ]
Loading module "oracleasm": [  OK  ]
Mounting ASMlib driver filesystem: [  OK  ]
Scanning system for ASM disks: [  OK  ]

在任何一個節點上面以root使用者建立ASM磁碟
-------------------------------------------------------------
[root@rac1 ~]# /etc/init.d/oracleasm createdisk mydisk1 /dev/sdc1
Marking disk "/dev/sdc1" as an ASM disk: [  OK  ]
[root@rac1 ~]# /etc/init.d/oracleasm createdisk mydisk2 /dev/sdd1
Marking disk "/dev/sdd1" as an ASM disk: [  OK  ]
[root@rac1 ~]# /etc/init.d/oracleasm createdisk mydisk3 /dev/sde1
Marking disk "/dev/sde1" as an ASM disk: [  OK  ]
[root@rac1 ~]# /etc/init.d/oracleasm listdisks;
MYDISK1
MYDISK2
MYDISK3
[root@rac1 ~]# /etc/init.d/oracleasm scandisks;
Scanning system for ASM disks: [  OK  ]

配置Oracle叢集檔案系統(OCFS2)
---------------------------------------------
OCFS2是Oracle開發的一個通用叢集檔案系統,與Linux核心整合在一起,他允許所有節點在叢集檔案系統上同時共享檔案,因而消除了管理原始裝置的需求,我們需要在ocfs2上寄宿OCR和表決磁碟。
OCR - Oracle Cluster Registry(叢集註冊檔案),記錄每個節點的相關資訊
Voting Disk - Establishes quorum (表決磁碟),仲裁機制用於仲裁多個節點向共享節點同時寫的行為,這樣做是為了避免發生衝突。

進入GUI以root使用者來執行ocfs2console來生成OCFS2配置檔案
在configure Nodes的時候出現了“Could not start cluster stack,this must be resolved before any ocfs2...."
發現原因是
1.沒有disable SELINUX,to do /etc/selinux/config 將SELINUX=disable就可以,並重新啟動計算機
2.用錯了OCFS2的rpm包,因為ocfs2-2.6.9-42.EL-1.2.3-1.i686.rpm這個包和自己的核心引數並不相符
[root@rac1 ~]# uname -r
2.6.9-67.EL
重新下載並安裝了對應當前系統核心的ocfs2包,問題得到解決:
ocfs2-2.6.9-67.EL-1.2.7-1.el4.i686.rpm
ocfs2console-1.2.7-1.el4.i386.rpm
ocfs2-tools-1.2.7-1.el4.i386.rpm

配置檔案生成在:
/etc/ocfs2/cluster.conf
同時可以通過Propagate Configuration的功能將配置檔案從rac1傳播到rac2上面去

在兩個節點上配置O2CB驅動程式
--------------------------------------------
這是一組叢集服務,負責管理節點於叢集檔案系統之間的通訊
NM:跟蹤cluster.conf中所有的節點的節點管理器
HB:當節點加入或離開叢集時向上/下發出通知的心跳服務
TCP:處理節點之間的通訊
DLM:分散式的鎖管理器,跟蹤所有鎖以及這些鎖所有者的狀態
CONFIGFS:在/config中掛載的使用者空間驅動的配置檔案系統
DLMFS:使用者空間和核心空間的DLM介面

在兩個節點rac1和rac2執行
[root@rac1 ~]# /etc/init.d/o2cb unload
Stopping O2CB cluster ocfs2: OK
Unmounting ocfs2_dlmfs filesystem: OK
Unloading module "ocfs2_dlmfs": OK
Unmounting configfs filesystem: OK
Unloading module "configfs": OK

[root@rac1 ~]# /etc/init.d/o2cb configure
Configuring the O2CB driver.

This will configure the on-boot properties of the O2CB driver.
The following questions will determine whether the driver is loaded on
boot.  The current values will be shown in brackets ('[]').  Hitting
without typing an answer will keep that current value.  Ctrl-C
will abort.

Load O2CB driver on boot (y/n) [n]: y
Cluster to start on boot (Enter "none" to clear) [ocfs2]:
Specify heartbeat dead threshold (>=7) [31]: 61
Specify network idle timeout in ms (>=5000) [30000]:
Specify network keepalive delay in ms (>=1000) [2000]:
Specify network reconnect delay in ms (>=2000) [2000]:
Writing O2CB configuration: OK
Loading module "configfs": OK
Mounting configfs filesystem at /config: OK
Loading module "ocfs2_nodemanager": OK
Loading module "ocfs2_dlm": OK
Loading module "ocfs2_dlmfs": OK
Mounting ocfs2_dlmfs filesystem at /dlm: OK
Starting O2CB cluster ocfs2: OK

配置好兩個節點後,在格式化和掛載系統之前,驗證一下o2cb在兩個節點上均聯機。
[root@rac1 ~]# /etc/init.d/o2cb status
Module "configfs": Loaded
Filesystem "configfs": Mounted
Module "ocfs2_nodemanager": Loaded
Module "ocfs2_dlm": Loaded
Module "ocfs2_dlmfs": Loaded
Filesystem "ocfs2_dlmfs": Mounted
Checking O2CB cluster ocfs2: Online
  Heartbeat dead threshold: 61
  Network idle timeout: 30000
  Network keepalive delay: 2000
  Network reconnect delay: 2000
Checking O2CB heartbeat: Not active

[root@rac2 ~]# /etc/init.d/o2cb status
Module "configfs": Loaded
Filesystem "configfs": Mounted
Module "ocfs2_nodemanager": Loaded
Module "ocfs2_dlm": Loaded
Module "ocfs2_dlmfs": Loaded
Filesystem "ocfs2_dlmfs": Mounted
Checking O2CB cluster ocfs2: Online
  Heartbeat dead threshold: 61
  Network idle timeout: 30000
  Network keepalive delay: 2000
  Network reconnect delay: 2000
Checking O2CB heartbeat: Not active
此時還沒有心跳,因為我們的檔案系統沒有被掛載

在一個節點上,格式化並掛載檔案系統(兩個節點都掛載到節點中的/ocfs目錄)
----------------------------------------------------------------------------------------------------
通過ocfs2console來進行格式化
Tasks->Format

之後在rac1和rac2兩個節點上分別掛載檔案系統
[root@rac1 /]# ls -ld ocfs
drwxr-xr-x  2 root root 4096 Jan  3 15:42 ocfs
[root@rac1 /]# mount -t ocfs2 -o datavolume,nointr /dev/sdb1 /ocfs
我們在看一下o2bc輸出的心跳
[root@rac1 /]# /etc/init.d/o2bc status
-bash: /etc/init.d/o2bc: No such file or directory
[root@rac1 /]# /etc/init.d/o2cb status
Module "configfs": Loaded
Filesystem "configfs": Mounted
Module "ocfs2_nodemanager": Loaded
Module "ocfs2_dlm": Loaded
Module "ocfs2_dlmfs": Loaded
Filesystem "ocfs2_dlmfs": Mounted
Checking O2CB cluster ocfs2: Online
  Heartbeat dead threshold: 61
  Network idle timeout: 30000
  Network keepalive delay: 2000
  Network reconnect delay: 2000
Checking O2CB heartbeat: Active
已經是active狀態

通過編輯兩個節點的/etc/fstab,我們還可以在系統引導的時候掛載檔案系統
/dev/sdb1       /ocfs       ocfs2       _netdev,datavolume,nointr       0 0

在OCR和voting disk將駐留的OCFS32系統中建立目錄
-------------------------------------------------------------------------
我們假設rac1將駐留ocr和voting disk
[root@rac1 /]# mkdir /ocfs/clusterware
[root@rac1 /]# chown -R oracle:dba /ocfs


安裝Oracle叢集軟體
----------------------------
在一個節點安裝會自動分發給其他節點
to be continued......

 

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

相關文章