WebSphere8集群配置

来源:互联网 发布:无限极网络直销 编辑:程序博客网 时间:2024/05/18 02:01

WebSphere中有以下三种类型的应用服务器:

Application Server:应用程序部署和运行的环境,一个应用服务器只能运行在一个Node节点中,但是一个Node节点可以有多个应用服务器。

Node agent:创建节点集群时创建和安装节点代理,节点代理和Deployment manager协同工作,为节点提供管理功能。一个节点只有一个节点代理,一个节点代理可以管理节点中所有的应用服务器。

Deployment manager:为WebSphere管理多个应用服务器提供中央管理,通过节点代理可以控制所有的分布式应用服务器。

以下图为例来讲解WebSphere集群简单配置:


(1).首先创建两个profile(文件视图profile概要对应与运行视图Node节点),假设这两个profile名称分别是:AppSrv01和AppSrv02。

(2).创建DeploymentManager,假设它的profile名称是Dmgr01,Cell名称是SOL。

(3).向Cell中添加Node节点:

有两种方法:

方法1:通过WebSphere的console:SystemAdministration->Nodes->Add Nodes,如下:


方法2:通过命令行:

将Node添加到Cell中时,Node中的应用程序也添加到Cell中:

/opt/IBM/WebSphere/AppServer/bin/addNode.shlocalhost -includeapps -profileName AppSrv01

将Node添加到Cell中时,Node中的应用程序不添加到Cell中:

/opt/IBM/WebSphere/AppServer/bin/addNode.shlocalhost -profileName AppSrv02

Node添加之后,/opt/IBM/WebSphere/AppServer/profiles/ AppSrv01/installedApps/目录(应用程序部署目录)下有一个SOL(创建Deployment Manager时的Cell名称)的目录。

(4).重启Node和DeploymentManager:

打开Deployment Manager的WebSphereconsole,会发现已经可以看到AppSrv01节点中部署的应用程序,但是此时应用程序状态都是未启动,需要重启Node和Deployment Manager使得Cell和Node中应用程序状态同步。

停止Deployment Manager和Node:

/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin/stopManager.sh

/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/stopNode.sh

/opt/IBM/WebSphere/AppServer/profiles/AppSrv02/bin/stopNode.sh

/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/stopServer.shserver1

/opt/IBM/WebSphere/AppServer/profiles/AppSrv02/bin/stopServer.shserver1

 

启动Deployment Manager和Node:

/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin/startManager.sh

/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/startNode.sh

/opt/IBM/WebSphere/AppServer/profiles/AppSrv02/bin/startNode.sh

/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/startServer.shserver1

/opt/IBM/WebSphere/AppServer/profiles/AppSrv02/bin/startServer.shserver1

再次打开Deployment Manager的WebSphereconsole,会发现此时应用程序状态都是已启动。

配置好集群的WebSphere,登录Deployment Manager的console,点击Systemadministration会看到有Cell选项,点击可以查看WebSphere的拓扑结构。

 

集群环境中,WebSphere外部的HTTP Server会进行负载均衡配置,如图:


WebSphere的负载均衡是HTTP Server通过plug-cfg.xml文件实现的,Cell中添加完Node之后,打开HTTP Server的配置文件/opt/IBM/WebSphere/Plugins/config/webserver1/plugin-cfg.xml,会发现如下的负载均衡集群配置:

<ServerCluster CloneSeparatorChange="false" GetDWLMTable="false" IgnoreAffinityRequests="true" LoadBalance="Round Robin" Name="server1_netact1_Cluster" PostBufferSize="64" PostSizeLimit="-1" RemoveSpecialHeaders="true" RetryInterval="60">      <Server ConnectTimeout="0" ExtendedHandshake="false" MaxConnections="-1" Name="netact1_server1" ServerIOTimeout="900" WaitForContinue="false">         <Transport Hostname="localhost" Port="9080" Protocol="http"/>         <Transport Hostname="localhost" Port="9443" Protocol="https">            <Property Name="keyring" Value="/opt/IBM/WebSphere/Plugins/config/webserver1/plugin-key.kdb"/>            <Property Name="stashfile" Value="/opt/IBM/WebSphere/Plugins/config/webserver1/plugin-key.sth"/>         </Transport>      </Server>   </ServerCluster>   <ServerCluster CloneSeparatorChange="false" GetDWLMTable="false" IgnoreAffinityRequests="true"    LoadBalance="Round Robin" Name="server1_netact2_Cluster"    PostBufferSize="64" PostSizeLimit="-1" RemoveSpecialHeaders="true" RetryInterval="60">      <Server ConnectTimeout="0" ExtendedHandshake="false" MaxConnections="-1" Name="netact2_server1" ServerIOTimeout="900" WaitForContinue="false">         <Transport Hostname="localhost" Port="9081" Protocol="http"/>         <Transport Hostname="localhost" Port="9444" Protocol="https">            <Property Name="keyring" Value="/opt/IBM/WebSphere/Plugins/config/webserver1/plugin-key.kdb"/>            <Property Name="stashfile" Value="/opt/IBM/WebSphere/Plugins/config/webserver1/plugin-key.sth"/>         </Transport>      </Server>   </ServerCluster>
原创粉丝点击