十年網(wǎng)站開發(fā)經(jīng)驗(yàn) + 多家企業(yè)客戶 + 靠譜的建站團(tuán)隊(duì)
量身定制 + 運(yùn)營維護(hù)+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決
WebSphere(簡稱WAS)集群一般由一組應(yīng)用服務(wù)器組成,每個服務(wù)器上部署了同樣的應(yīng)用程序。通過集群可以實(shí)現(xiàn)可擴(kuò)展性、負(fù)載均衡、高可用性(提供故障恢復(fù)和補(bǔ)償機(jī)制,在關(guān)鍵性業(yè)務(wù)中提供容錯功能)。WAS提供水平集群和垂直集群兩種形式,垂直集群是指同一機(jī)器上部署多個服務(wù)器,充分利用硬件資源,而水平集群利用多臺機(jī)器資源,每臺機(jī)器部署相同的應(yīng)用。本案例主要側(cè)重水平集群,但是其中的很多概念對于垂直集群也是適用的。
一、安裝環(huán)境和文件版本
操作系統(tǒng):SUSE LINUX 10 SP3 企業(yè)版
Websphere版本:WAS7.0
安裝部署環(huán)境:一臺DM+APP 另一臺APP 還有兩個IHS服務(wù)器(或者也可裝在兩個APP上)
二、集群部署方案圖
如圖所示
中間件平臺主要包括兩大部分:
?負(fù)載分發(fā)層:
?包括兩臺服務(wù)器,通過Heartbeat實(shí)現(xiàn)HA,提供浮動IP給客戶端,保證了系統(tǒng)不存在單點(diǎn)故障問題
?負(fù)載分發(fā)軟件采用IBM HTTP Server實(shí)現(xiàn)
?通過IBM HTTP Server配置虛擬主機(jī),實(shí)現(xiàn)對不同應(yīng)用的請求分發(fā)到不同的后臺WAS中間件集群。
?WAS中間件集群:
?包括兩臺服務(wù)器,每個服務(wù)器上通過水平擴(kuò)展可以啟動多個WAS服務(wù)器。
?基于應(yīng)用部署要求,為每個應(yīng)用建立一個集群,邏輯上實(shí)現(xiàn)應(yīng)用之間的隔離。
?保證一個集群至少包括2個WAS實(shí)現(xiàn),并且這兩個實(shí)例分別在不同的物理服務(wù)器上,這樣才能保證不出現(xiàn)單點(diǎn)故障。
三、WebSphere7集群安裝
1、安裝前的檢查
集群安裝時,確認(rèn)所有機(jī)子的時間日期要一致
確認(rèn)磁盤空間足夠
安裝目錄都是安裝于默認(rèn)的/opt目錄下
確認(rèn)管理域之內(nèi)的所有的服務(wù)器主機(jī)名和ip地址相互能夠ping通
在安裝前,要確保四臺機(jī)的/etc/hosts文件里面增加四臺機(jī)的ip與主機(jī)名,修改如下
**.**.**.1 app1
**.**.**.2 app2
**.**.**.3 server1
**.**.**.4 server2
(對于初次安裝系統(tǒng)后的主機(jī),因?yàn)闆]有在HOSTS文件中增加此類記錄,會導(dǎo)致安裝失敗,現(xiàn)象是安裝后生成的profiles不完整,并且startManager.sh執(zhí)行失敗,啟動不了管理服務(wù)。另外,安裝完WAS后,不能隨意修改主機(jī)名,否則WAS的服務(wù)啟動不了,需要重新安裝)
2、開始安裝
上傳安裝的軟件介質(zhì)到指定的服務(wù)器,配置服務(wù)器能夠用xmanager或VNC進(jìn)行圖形化安裝。如不能進(jìn)行圖形化安裝,則需要修改was或his下的responsefile.txt文件中的各參數(shù),工作量大而且易出錯。
進(jìn)入suse linux環(huán)境,打開終端,打開文件系統(tǒng),在was安裝目錄下找到launchpad.sh腳本 ,./launchpad.sh運(yùn)行
安裝成功完成后,在app1主機(jī)下的/opt/IBM/WebServer/AppServer/profiles目錄下可看到DMGR01,APPSRV01兩個目錄。其中DMGR01是管理臺概要文件,只在app1主機(jī)上有。
同樣,在主機(jī)app2機(jī)上安裝was后,在app2下的/opt/IBM/WebServer/AppServer/profiles目錄下可看到APPSRV01一個目錄。
在app1主機(jī)下的profilesDMGR01FIRSTSTEPS目錄下,
運(yùn)行firststeps.sh,可進(jìn)行安裝后檢測
檢測結(jié)果如果正常,則DMGR服務(wù)可正常啟動,訪問端口是9060
此時到IE,可打開WAS控制臺
http://**.**.**.**:9060/ibm/console
輸入用戶名和密碼,進(jìn)入主控畫面
此時在服務(wù)器可以看到一個SERVER1,但沒有啟動代理服務(wù)前,前臺是不能啟動的。
需到服務(wù)器下運(yùn)行。
# cd Profiles/AppSrv01/bin
# ./startNode.sh
節(jié)點(diǎn)代理啟動
ADMU0116I: Tool information is being logged in file
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/nodeagent/startServer.log
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: nodeagent
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server nodeagent open for e-business; process id is 330
此時再到前控制臺,可正常啟動server1了
(或者在服務(wù)器下運(yùn)行命令./startServer.sh Server1 ,同樣可以啟動服務(wù))
至此,主機(jī)APP1安裝并驗(yàn)證完畢。
在APP2上:
過程同app1機(jī),不同處只是在概要文件創(chuàng)建里不選擇cell,只選擇一個application server就行了。
安裝執(zhí)行完成后,檢查profiles下,已有appsrv01
至其下的bin執(zhí)行如下腳本,關(guān)聯(lián)節(jié)點(diǎn)NODE2到主機(jī)app1(server1)的DMGR服務(wù)節(jié)點(diǎn)
cd /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin
./addNode.sh **.**.**.** 8879
其中IP地址是主機(jī)app1的IP,后面的8879是SOP端口。
輸入app1上DMGR01管理用戶wasadmin,口令******
執(zhí)行成功
# ./addNode.sh **.**.**.** 8879
ADMU0116I: Tool information is being logged in file
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/addNode.log
ADMU0128I: Starting tool with the AppSrv01 profile
CWPKI0308I: Adding signer alias "CN=APP1, OU=Root Cer" to local
keystore "ClientDefaultTrustStore" with the following SHA digest:
B5:37:07:88:00:A4:78:10:95:B0:56:17:3C:8D:A9:A7:C0:BD:76:3F
Realm/Cell Name:
Username: admin
Password:
CWPKI0308I: Adding signer alias "datapower" to local keystore
"ClientDefaultTrustStore" with the following SHA digest:
A9:BA:A4:B5:BC:26:2F:5D:2A:80:93:CA:BA:F4:31:05:F2:54:14:17
ADMU0001I: Begin federation of node AAAAAPP2-******Node01 with Deployment
Manager at **.**.**.36:8879.
ADMU0009I: Successfully connected to Deployment Manager Server:
**.**.**.36:8879
ADMU0505I: Servers found in configuration:
ADMU0506I: Server name: server1
ADMU2010I: Stopping all server processes for node AAAAAPP2-******Node01
ADMU0512I: Server server1 cannot be reached. It appears to be stopped.
ADMU0024I: Deleting the old backup directory.
ADMU0015I: Backing up the original cell repository.
ADMU0012I: Creating Node Agent configuration for node: AAAAAPP2-******Node01
ADMU0014I: Adding node AAAAAPP2-******Node01 configuration to cell:
APP1Cell01
ADMU0016I: Synchronizing configuration between node and cell.
ADMU0018I: Launching Node Agent process for node: AAAAAPP2-******Node01
ADMU0020I: Reading configuration for Node Agent process: nodeagent
ADMU0022I: Node Agent launched. Waiting for initialization status.
ADMU0030I: Node Agent initialization completed successfully. Process id is:
6848
ADMU0300I: The node AAAAAPP2-******Node01 was successfully added to the
APP1Cell01 cell.
ADMU0306I: Note:
ADMU0302I: Any cell-level documents from the standalone APP1Cell01
configuration have not been migrated to the new cell.
ADMU0307I: You might want to:
ADMU0303I: Update the configuration on the APP1Cell01 Deployment
Manager with values from the old cell-level documents.
ADMU0306I: Note:
ADMU0304I: Because -includeapps was not specified, applications installed on
the standalone node were not installed on the new cell.
ADMU0307I: You might want to:
ADMU0305I: Install applications onto the APP1Cell01 cell using
wsadmin $AdminApp or the Administrative Console.
ADMU0003I: Node AAAAAPP2-******Node01 has been successfully federated.
此時再到app1主機(jī)的DMGR控制臺可以看到節(jié)點(diǎn)app2主機(jī)的SERVR1
可以啟動app2機(jī)上的SERVER1。(在app2機(jī)上的profiles/appsvr01/bin下執(zhí)行./startServer.sh server1也可)
四、WebSphere7集群配置
把a(bǔ)pp1與app2的應(yīng)用服務(wù)放在集群中
1、刪除兩個應(yīng)用服務(wù)器下的單個SERVER。
停止兩個服務(wù)后,刪除,保存設(shè)置。
把單個服務(wù)器刪除
2、建集群,起名HR_cluster
注意:把配置HTTP會話內(nèi)存到內(nèi)存的復(fù)制勾上
下一步分別對應(yīng)兩應(yīng)用服務(wù)主機(jī),各一個SERVER,分別名稱為
app1
app2
集群建完后如下
進(jìn)入系統(tǒng)管理->節(jié)點(diǎn)中同步各節(jié)點(diǎn)
然后啟動集群,集群可正常啟動
至此,兩臺應(yīng)用服務(wù)器的集群安裝完畢!
五、安裝IHS HTTP WEB服務(wù)器
安裝IHS HTTP SERVER與PLUGINS插件
解壓程序安裝包后,執(zhí)行http_ins/ihs/目錄下的install.sh文件,用xmanager來執(zhí)行該文件進(jìn)行安裝。
安裝畫面如下:
第一步設(shè)置端口,選擇默認(rèn)的
Web1機(jī)的http port 80
http administration port 8008
后面一步,在設(shè)置插件安裝目錄與應(yīng)用服務(wù)器主機(jī)名稱那里,
app1對應(yīng)的插件安裝目錄是默認(rèn)的/opt/IBM/HTTPServer/plugins
對應(yīng)的應(yīng)用服務(wù)主機(jī)名設(shè)為 app1
(注意:app2那臺機(jī)安裝httpserver時,選擇對應(yīng)的應(yīng)用服務(wù)主機(jī)設(shè)為app2,其他過程都相同)
注意在管理用戶與口令那里設(shè)置為admin,******
注意:因?yàn)檫@兩個web服務(wù)器要通過另外一臺應(yīng)用服務(wù)器的dmgr來管理,所以這里的安全管理用戶與口令要設(shè)。否則dmgr上無法管理啟停。
下面這一步,設(shè)置用戶與組分別為nobody,nobody
(注意:這個用戶與組在etc/group,passwd,shadow中要有)
兩臺IHS HTTP WEB服務(wù)器的啟動過程
正常過程:
在兩臺WEB服務(wù)器下,HTTPServer/bin目錄下,執(zhí)行如下腳本,啟停apache服務(wù)
./apachectl start
提示./adminctl start: admin http started
回到app1的DMGR主控制臺,建立WEB服務(wù)節(jié)點(diǎn)與啟動管理。
選擇系統(tǒng)管理->節(jié)點(diǎn),增加非受管制的兩個WEB節(jié)點(diǎn)(前面兩個app節(jié)點(diǎn)是受管制節(jié)點(diǎn))
點(diǎn)添加,選擇非受管節(jié)點(diǎn)
為WEB1機(jī)上的節(jié)點(diǎn)命名并設(shè)置主機(jī)名稱
非受管節(jié)點(diǎn)名稱:servernode01
主機(jī)名:server1
第一個節(jié)點(diǎn)添加成功
再同樣操作繼續(xù)添加第二個非受管節(jié)點(diǎn)
非受管節(jié)點(diǎn)名稱:servernode02
主機(jī)名:server2
然后回到服務(wù)器類型下,選擇WEB服務(wù)器,選擇兩個非受管節(jié)點(diǎn),分別去創(chuàng)建WEBSERVER
下一步后,增加設(shè)置屬性,管理用戶與口令 .用戶與口令是在WEB機(jī)上安裝IHS HTTP SERVER時的設(shè)置admin,admin
完成第一個WEB節(jié)點(diǎn)上WEBSERVER的創(chuàng)建
同上操作再去完成第二個web服務(wù)節(jié)點(diǎn)的webserver創(chuàng)建。
兩個都創(chuàng)建完畢后。選擇生成插件(Generate plug-in)和傳播插件(Propagate Plug-in)
生成插件成功,提示如下:
PLGC0005I: Plug-in configuration file =
/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/config/cells/APP1Cell01/nodes/webnode1/servers/webserver1/plugin-cfg.xml
PLGC0052I: Plug-in configuration file generation is complete for the Web server. APP1Cell01.webnode1.webserver1.
PLGC0005I: Plug-in configuration file =
/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/config/cells/APP1Cell01/nodes/webnode2/servers/webserver1/plugin-cfg.xml
PLGC0052I: Plug-in configuration file generation is complete for the Web server. APP1Cell01.webnode2.webserver1.
傳播插件成功,提示如下:
PLGC0062I: The plug-in configuration file is propagated from
/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/config/cells/APP1Cell01/nodes/webnode1/servers/webserver1/plugin-cfg.xml to
/opt/IBM/HTTPServer/Plugins/config/webserver1/plugin-cfg.xml on the Web server computer.
PLGC0048I: The propagation of the plug-in configuration file is complete for the Web server. APP1Cell01.webnode1.webserver1.
PLGC0062I: The plug-in configuration file is propagated from
/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/config/cells/APP1Cell01/nodes/webnode2/servers/webserver1/plugin-cfg.xml to
/opt/IBM/HTTPServer/Plugins/config/webserver1/plugin-cfg.xml on the Web server computer.
PLGC0048I: The propagation of the plug-in configuration file is complete for the Web server. APP1Cell01.webnode2.webserver1.
兩個WEB服務(wù)已建立,并可通過DMGR 來控制啟停。
最后安裝補(bǔ)丁加強(qiáng)系統(tǒng)的安全性。至此整個部署過程完畢。