Oracle 10gas 之 集群
2024-08-29 13:41:10
供稿:網友
對于大規(guī)模的企業(yè)級應用來講,沒有集群是不太現實的,考慮到可擴展性和高可用性,
在通常的生產環(huán)境中,都會應用到中間件集群這種技術。
本文主要講述了10gas相關的集群配置,一般的治理方面的內容。
10gas的集群分為兩大類
1.基于治理的集群
基于治理的集群主要通過 Repository 來記錄 整個集群得相關配置信息,比如集群發(fā)布的程序阿等等。
這個方式下,治理員需要手工操作的東西比較少。比如發(fā)布一個程序,只要對整個集群做一次發(fā)布即可。
2..手工治理的集群方式
在這種方式下,除了最基本的session復制以及ejb cluster 外,10gas不提供更多的治理手段,
假如需要發(fā)布程序,你需要對參與集群的所有instance做發(fā)布。你可以想象再你有10幾臺服務器的情況下,假如每次發(fā)布程序,都需要一臺臺去發(fā)布,不但工作量大,而且很輕易搞錯。
所以建議采用基于治理的方式來做集群。
基于治理的集群主要用到需要 Repository 來存儲相關的配置信息。
由于 Repository 的重要性,這里花點時間講一下 Repository得相關信息。
Repository 有兩種存儲方式,databased-Repository 和 filebased-Repository.
其中 filebased-Repository 是 10gas才新心出來的功能。主要是解決以前只能創(chuàng)建
databased-Repository cluster 的問題,而 databased-Repository 需要安裝 InfrastrUCture 。
這個Infrastructure 是大家頗為頭疼的東西,不太龐大,而且極輕易出問題。所以才有了filebased-Repository。
存放在 Repository 的信息主要有下面幾種
1.PRoduct metadata
2.Management metadata
3.Idendity Management metadata (databased-Repository 才有)
對于集群主要需要用到的信息是 1.Product metadata 和 2.Management metadata。
還記得我10gas 系列文章的第一篇嗎 http://www.itpub.net/250581.Html(Oracle 10gas安裝攻略) 里面的安裝方式
J2EE andWeb Cache installation type ,這個安裝方式缺省就是采用 filebased-Repository .當然也可以
遷移到 databased-Repository。
所以本文主要講如何創(chuàng)建 filebased-Repository 的cluster。對于基于 databased-Repository 的方式的集群,以后再深入講。
先講一下創(chuàng)建集群的要求
1.所有的 application server instance 必須再同一個farm ,也就是要用同一個 Repository來存放治理信息。
2.所有的參與集群的 application server instance 都必須安裝同樣的os。
3.每個參與集群的 application server instance 只能由一個ohs server.
4.每一個 application server instance 可以有多個 oc4j instance. 每個oc4j instance可以有多個 oc4j process.
5.當然要求所有的application server instance 版本一樣了。
涉及的 application server instance 有兩個
ip 都是 10.1.18.1 ,在同一 物理server 用兩個用戶安裝兩個 application server instance ,
每個 application server instance 用不同的端口。
操作系統(tǒng)是 redhat 3.0 update 2.
用戶 ias10g 啟用 ohs ,端口 7778 ,用戶 ias10g2只啟用oc4j.
其中 ias10g用戶 作為 filebased-Repository host.
1.測試該 application server instance 是否已經屬于某個 farm .
檢查 instance 1
su - ias10g
[ias10g@finproduction home]$ dcmctl whichFarm
Standalone instance
顯示 該 instance還沒有加入 farm.
假如顯示已經加入farm,請執(zhí)行下面的命令離開farm
dcmctl leaveFarm
檢查 instance 2
su - ias10g2
[ias10g2@finproduction ias10g2]$ dcmctl whichFarm
Standalone instance
[ias10g2@finproduction ias10g2]$
2.初始化 Repository
su - ias10g
獲得當前的 id 號碼
[ias10g@finproduction home]$ dcmctl getRepositoryid
finproduction.tplife.com:7101
[ias10g@finproduction home]$
初始化farm
dcmctl joinFarm -r finproduction.tplife.com:7101
其中 finproduction.tplife.com:7101 就是前面通過 getRepositoryid 獲得信息。
現在在來看看 是否已經加入 farm
[ias10g@finproduction home]$ dcmctl whichFarm
Farm Name: .tpdata.ias10g.OraHome1.dcm.repository
Host Instance: iastest.finproduction.tplife.com
Host Name: finproduction.tplife.com
Repository Type: Distributed File Based (host)
SSL In Use: false
可以看到 已經加入 File Based farm .而且這個 instance是 host.
3.加入 instance2
su - ias10g2
dcmctl joinFarm -r finproduction.tplife.com:7101
加入成功,看看 現在的 farm 信息。
[ias10g2@finproduction ias10g2]$ dcmctl whichFarm
Farm Name: .tpdata.ias10g.OraHome1.dcm.repository
Host Instance: iastest.finproduction.tplife.com
Host Name: finproduction.tplife.com
Repository Type: Distributed File Based
SSL In Use: false
[ias10g2@finproduction ias10g2]$
可以看到,已經加入成功 file-based Repository .
4.創(chuàng)建集群
創(chuàng)建集群有兩種方式,
一:通過 em 治理界面創(chuàng)建
二:通過dcmctl手工創(chuàng)建
由于通過 em 創(chuàng)建比較簡單,且創(chuàng)建集群屬于比較高階的內容,我這里主要講如何手工創(chuàng)建。
su - ias10g
看看是否已經創(chuàng)建集群
dcmctl listclusters
沒有輸出,說明還沒有創(chuàng)建。
創(chuàng)建一個集群
[ias10g@finproduction home]$ dcmctl createcluster -cl mycluster
1 mycluster
-cl 指定 集群的名字,可以隨便取。
[ias10g@finproduction home]$ dcmctl listclusters
1 mycluster
可以看到已經創(chuàng)建一個cluster。
先把 instance1 加入集群
[ias10g@finproduction home]$ dcmctl joincluster -cl mycluster
1 iastest.finproduction.tplife.com
接著把 instance2加入集群
su - ias10g2
[ias10g2@finproduction ias10g2]$ dcmctl joincluster -cl mycluster
1 iastest2.finproduction.tplife.com
2 iastest.finproduction.tplife.com
可以看到已經再集群 mycluster 中已經有兩個 instance 了。