linux4.0下安裝oracle RAC(三)

anycall2010發表於2008-07-08

1、使用 SSH 建立使用者等效性。在叢集就緒服務 (CRS) 和 RAC 安裝過程中,Oracle Universal Installer (OUI) 必須能夠以 oracle 的身份將軟體複製到所有 RAC 節點,而不提示輸入口令。在 Oracle 10g 中,可以使用 ssh 代替 rsh 完成此操作。

要建立使用者等效性,請在兩個節點上以 oracle 使用者身份生成使用者的公鑰和私鑰。開啟 rac1 的電源,在這兩個節點上執行以下任務。
在 rac1 上執行

rac1-> mkdir ~/.ssh
rac1-> chmod 700 ~/.ssh
rac1-> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/export/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /export/home/oracle/.ssh/id_rsa.
Your public key has been saved in /export/home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
87:54:4f:92:ba:ed:7b:51:5d:1d:59:5b:f9:44:da:b6 oracle@rac1.mycorpdomain.com
rac1-> ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/export/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /export/home/oracle/.ssh/id_dsa.
Your public key has been saved in /export/home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
31:76:96:e6:fc:b7:25:04:fd:70:42:04:1f:fc:9a:26 oracle@rac1.mycorpdomain.com	

在 rac2 上執行

rac2-> mkdir ~/.ssh
rac2-> chmod 700 ~/.ssh
rac2-> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/export/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /export/home/oracle/.ssh/id_rsa.
Your public key has been saved in /export/home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
29:5a:35:ac:0a:03:2c:38:22:3c:95:5d:68:aa:56:66 oracle@rac2.mycorpdomain.com
rac2-> ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/export/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /export/home/oracle/.ssh/id_dsa.
Your public key has been saved in /export/home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
4c:b2:5a:8d:56:0f:dc:7b:bc:e0:cd:3b:8e:b9:5c:7c oracle@rac2.mycorpdomain.com
在 rac1 上執行
rac1-> cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
rac1-> cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
rac1-> ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
The authenticity of host 'rac2 (192.168.2.132)' can't be established.
RSA key fingerprint is 63:d3:52:d4:4d:e2:cb:ac:8d:4a:66:9f:f1:ab:28:1f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'rac2,192.168.2.132' (RSA) to the list of known hosts.
oracle@rac2's password:
rac1-> ssh rac2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
oracle@rac2's password:
rac1-> scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys
oracle@rac2's password:
authorized_keys                           100% 1716     1.7KB/s   00:00
在每個節點上測試連線。驗證當您再次執行以下命令時,系統是否不提示您輸入口令。
ssh rac1 date
ssh rac2 date
ssh rac1-priv date
ssh rac2-priv date

2、配置 Oracle 自動儲存管理 (ASM)

Oracle ASM 與 Oracle 資料庫緊密整合在一起,並與 Oracle 的資料管理工具套件配合工作。它可以簡化資料庫儲存管理,並提供原始磁碟 I/O 的效能。

配置 ASMLib。以 root 使用者身份在兩個節點上配置 ASMLib。
# /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  ]
建立 ASM 磁碟。以 root 使用者身份在任何一個節點上建立 ASM 磁碟。
# /etc/init.d/oracleasm createdisk VOL1 /dev/sdc1
Marking disk "/dev/sdc1" as an ASM disk:                   [  OK  ]
# /etc/init.d/oracleasm createdisk VOL2 /dev/sdd1
Marking disk "/dev/sdd1" as an ASM disk:                   [  OK  ]
# /etc/init.d/oracleasm createdisk VOL3 /dev/sde1
Marking disk "/dev/sde1" as an ASM disk:                   [  OK  ]
Verify that the ASM disks are visible from every node. 
# /etc/init.d/oracleasm scandisks
Scanning system for ASM disks:                      [  OK  ]
# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
VOL4

3、 配置 Oracle 叢集檔案系統 (OCFS2)

OCFS2 是 Oracle 開發的一個通用叢集檔案系統,與 Enterprise Linux 核心整合在一起。它允許所有節點在叢集檔案系統上同時共享檔案,因而消除了管理原始裝置的需求。這裡,您將在 OCFS2 檔案系統中寄宿 OCR 和表決磁碟。您可以從 OCFS2 使用者指南獲取有關 OCFS2 的其他資訊。

在 Enterprise Linux 安裝期間,您應該已經安裝了 OCFS2 RPM。驗證 RPM 是否已經安裝在兩個節點上。

rac1-> rpm -qa | grep ocfs
ocfs2-tools-1.2.2-2
ocfs2console-1.2.2-2
ocfs2-2.6.9-42.0.0.0.1.ELsmp-1.2.3-2
建立 OCFS2 配置檔案。 在 rac1 上,以 root 使用者身份執行
# ocfs2console
  1. OCFS2 控制檯:選擇 Cluster,然後選擇 Configure Nodes
  2. “叢集堆疊已經啟動”:單擊 Close
  3. 節點配置:單擊 Add
  4. 新增節點:新增以下節點,然後單擊 Apply
    • 名稱:rac1
    • IP 地址: 192.168.2.131
    • IP 埠: 7777
    • 名稱:rac2
    • IP 地址: 192.168.2.132
    • IP 埠: 7777
  5. 驗證生成的配置檔案。
    # more /etc/ocfs2/cluster.conf
    node:
            ip_port = 7777
            ip_address = 192.168.2.131
            number = 0
            name = rac1
            cluster = ocfs2
    
    node:
            ip_port = 7777
            ip_address = 192.168.2.132
            number = 1
            name = rac2
            cluster = ocfs2
    
    cluster:
            node_count = 2
            name = ocfs2
    
  6. 將配置檔案傳播到 rac2。您可以在 rac2 上重新執行上述步驟以生成配置檔案,或者在 rac1 的 OCFS2 控制檯上選擇 ClusterPropagate Configuration 以將配置檔案傳播到 rac2。
配置 O2CB 驅動程式。O2CB 是一組叢集服務,負責管理節點與叢集檔案系統之間的通訊。下面是對各個服務的說明:
  • NM:用於跟蹤 cluster.conf 中的所有節點的節點管理器
  • HB:當節點加入或離開叢集時向上/向下發出通知的心跳服務
  • TCP:處理節點之間的通訊
  • DLM:用於跟蹤所有鎖、這些鎖的所有者以及狀態的分散式鎖管理器
  • CONFIGFS:在 /config 中掛載的使用者空間驅動的配置檔案系統
  • DLMFS:使用者空間與核心空間 DLM 的介面

在兩個節點上執行下面的過程,將 O2CB 配置為在引導時啟動。

當系統提示您指定心跳死亡閾值時,您必須指定一個大於 7 的值,以防止節點由於較慢的 IDE 磁碟驅動器而崩潰。心跳死亡閾值是一個用於計算隔離時間的變數。

Fence time (seconds) = (heartbeat dead threshold -1) * 2

在我們的環境中,120 秒的隔離時間很合適。兩個節點上的心跳死亡閾值應該完全相同。

以 root 使用者身份執行

# /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

# /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) [y]: y
Cluster to start on boot (Enter "none" to clear) [ocfs2]:
Specify heartbeat dead threshold (>=7) [7]: 61
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 在兩個節點上均聯機;O2CB 心跳當前沒有活動,因為檔案系統未掛載。
# /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
Checking O2CB heartbeat: Not active

您只需在一個節點上格式化檔案系統。在 rac1 上,以 root 使用者身份執行

# ocfs2console
  1. OCFS2 控制檯:選擇 Tasks、Format
  2. 格式:
    • 可用裝置:/dev/sdb1
    • 卷標:oracle
    • 叢集大小:Auto
    • 節點插槽數量: 4
    • 塊大小:Auto
  3. OCFS2 控制檯:按 CTRL-Q 退出。
掛載檔案系統。要掛載檔案系統,在兩個節點上執行以下命令。
# mount -t ocfs2 -o datavolume,nointr /dev/sdb1 /ocfs

要在引導時掛載檔案系統,在兩個節點的 /etc/fstab 中新增以下行。

/etc/fstab

/dev/sdb1 /ocfs ocfs2 _netdev,datavolume,nointr 0 0
建立 Oracle 叢集件目錄。在 OCR 和表決磁碟將駐留的 OCFS2 檔案系統中建立目錄。

在 rac1 上執行

# mkdir /ocfs/clusterware
# chown -R oracle:dba /ocfs 

現在,您已經完成了 OCFS2 的設定。驗證您可以在兩個節點的共享叢集檔案系統上讀寫檔案。

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

相關文章