配置集群应用的必要条件
集群中的所有Server必须位于同一网段,并且必须是IP广播(UDP)可到达的
集群中的所有Server必须使用相同的版本,包括Service Pack
集群中的Server必须使用永久的静态IP地址。动态IP地址分配不能用于集群环境。如果服务器位于防火墙后面,而客户机位于防火墙外面,那么服务器必须有公共的静态IP地址,只有这样,客户端才能访问服务器
要以CLUSTER方式运行,必须有包含CLUSTER许可的LICENSE才行(从Bea网站上下载的试用版本就可以进行Cluster配置)
配置前的准备工作
在配置集群应用前要对集群的配置信息有一个良好的设计,下面就是我们这次配置的集群信息:
在同一网段内的不同机器上配置集群,以下是以2台机器做群集,
机器类型 操作系统 硬件配置 角色 备注
普通 PC Linux as 4 IP:10.3.15.85 PORT:7001 Administrator Server Pc1
普通 PC Linux as 4 IP: 10.3.15.85 PORT:80 Proxy Server Pc1
普通 PC Linux as 4 IP: 10.3.15.85 PORT:7080 Managed Server Pc1
普通 PC Linux as 4 IP: 10.3.15.84 PORT:7080 Managed Server Pc2
使用Domain Configuration Wizard进行配置
创建新的Domain
第一步:
进入到weblogic安装目下的 /usr/local/wblogic/webloic81/common/bin下面执行 ./config.sh 启动域配置程序
<----------------------------------------------- BEA WebLogic Configuration Wizard ----------------------------------------------->
Create or Extend a Configuration:
---------------------------------
Choose between creating and extending a configuration. Based on your selection, the Configuration Wizard guides you through the
steps to generate a new or extend an existing configuration.
->1|Create a new WebLogic configuration
| Start here to create a WebLogic configuration in your projects directory.
2|Extend an existing WebLogic configuration
| Start here to extend an existing WebLogic configuration. Use this option to add applications and services, including
|Database access (JDBC) and Messaging (JMS). This option also enables you to extend functionality by enabling WebLogic
|Workshop.
Enter index number to select OR [Exit][Next]> [iyunv@localhost bin]# 1
第二步:选择模版
系统提示选择一个建立域的模版,资料上讲配置向导的配置过程可以另存为模版,以便下次配置的时候使用,没试过下次回去试试。
<----------------------------------------------- BEA WebLogic Configuration Wizard ----------------------------------------------->
Select a Domain Template:
-------------------------
Please select a template from the list or select another directory of templates.
* [/usr/local/weblogic/weblogic81/common/templates/domains]
1|WebLogic Server Examples Domain 8.1.5.0
| BEA Systems, Inc.
| Create the WebLogic Server Examples domain in a directory outside of the installed kit. The Examples domain contains a
|collection of examples to show best practices for coding individual J2EE APIs.
2|Basic WebLogic Workshop Domain 8.1.5.0
| BEA Systems, Inc.
| Create a basic WebLogic Workshop domain, without installing sample applications. Domains created from this template will
|support the WebLogic Server and WebLogic Workshop runtime functionality, including support for J2EE applications, Web
|applications, Web Services and custom controls. Use domains created from this template for development of WebLogic Workshop
|applications.
->3|Basic WebLogic Server Domain 8.1.5.0
| BEA Systems, Inc.
| Create a basic WebLogic Server domain without installing sample applications.
4|Avitek Medical Records Sample Domain 8.1.5.0
| BEA Systems, Inc.
| Create the Avitek Medical Records domain in a directory outside of the installed kit. The Avitek Medical Records is a
|WebLogic Server sample application suite that concisely demonstrates all aspects of the J2EE platform.
5|Select another directory location
Enter index number to select OR [Exit][Previous][Next]> 3
这里我们选择3,使用基础的模版
第三步:是否以快速模式进行
第三步系统提示是否以快速模式进行配置,这里选择2。
<----------------------------------------------- BEA WebLogic Configuration Wizard ----------------------------------------------->
Choose Configuration Option:
----------------------------
*Do you want to run the wizard in express mode?
->1|Yes
2|No
Enter index number to select OR [Exit][Previous][Next]> 2
第四步:配置管理服务器
现在系统提示我们配置管理服务器,把管理服务器的名字改一下,改成adminServer就可以了。
<------- BEA WebLogic Configuration Wizard -------->
Configure the Administration Server:
------------------------------------
Enter adminstration server configurations. Each WebLogic Server domain must have one Administration Server. The
Administration Server hosts the Administration Console which is used to perform administrative tasks.
| Name | Value |
_|__________________|_____________________|
1| *Name: | myserver |
2| Listen address: | All Local Addresses |
3| Listen port: | 7001 |
4| SSL listen port: | N/A |
5| SSL enabled: | false |
Select Option:
1 - Modify "Name"
2 - Modify "Listen address"
3 - Modify "Listen port"
4 - Modify "SSL enabled"
Enter option number to select OR [Exit][Previous][Next]> 1
输入1之后,根据系统提示输入新的管理服务器的名称adminServer
第五步:配置被管服务器
根据下面系统的提示,配置被管服务器
<----------------------------------------------- BEA WebLogic Configuration Wizard ----------------------------------------------->
Choose Configuration Option:
----------------------------
*Do you want to configure Managed Servers, Clusters and Machines?
->1|Yes
2|No
Enter index number to select OR [Exit][Previous][Next]> 1
根据提示配置如下信息:
<----------------------------------------------- BEA WebLogic Configuration Wizard ----------------------------------------------->
Configure Managed Servers:
--------------------------
Add or delete configuration information for managed servers. A typical production environment has one or more managed servers. Each managed server is an instance of WebLogic Server used to host enterprise applications.
| Name* | Listen address | Listen port | SSL listen port | SSL enabled |
_|__________|________________|_____________|_________________|_____________|
1| mServer1 | 10.3.15.85 | 7080 | N/A | false |
->2| mServer2 | 10.3.15.84 | 7080 | N/A | false |
然后执行下一步
第六步:配置集群
<----BEA WebLogic Configuration Wizard ------>
Configure Clusters:
-------------------
A cluster contains multiple WebLogic Server instances (servers) that run simultaneously and work together to provide
increased scalability and reliability. A cluster appears to be a single WebLogic Server instance to clients.
| Name* | Multicast address | Multicast port | Cluster address |
_|_______|___________________|________________|_________________|
Enter name for a new Cluster OR [Exit][Previous][Next]> testCluster
输入集群的名字testCluster,其他的默认就行了,配置完成后如下:
| Name* | Multicast address | Multicast port | Cluster address |
_|_____________|___________________|________________|_________________|
->1| testCluster | 237.0.0.1 | 7777 | |
第七步:将服务器组织到集群中
根据系统的提示,将mServer1和mServer2放入集群testCluster中去,配置完成后如下:
Cluster
|_____testCluster [1]
|_____mServer1
|_____mServer2
第八步:配置机器、jdbc、jms、安全等
接下来几步系统提示配置Machines,jdbc,jms,安全,这里都不用配置,全部回车就行了。
第九步:输入管理服务器的用户名和密码
系统提示如下画面,可以配置管理服务器的用户名和密码:
| Name | Value |
_|_________________________|_________________________________|
1| *User name: | weblogic |
2| *User password: | ******** |
3| *Confirm user password: | ******** |
4| Description: | The default administration user |
第十步:选择启动模式,jdk和存放目录
启动模式,jdk和域文件存放目录的设置比较简单,根据大家的爱好设置就行了。
这里启动模式选择生产开发模式,jdk使用jRockit,存放目录默认。
十一步:配置域名称
Edit Domain Information:
------------------------
| Name | Value |
_|________|__________|
1| *Name: | mydomain |
Enter value for "Name" OR [Exit][Previous][Next]> testClusterDomain
设置域的名称为testClusterDomain。
十二步:域建立结束
以上步骤都完成后,系统会自动建立这个域,并会生成一些文件等等,完成的界面如下:
<----- BEA WebLogic Configuration Wizard --------->
Creating Domain...
0% 25% 50% 75% 100%
[------------|------------|------------|------------]
[***************************************************]
**** Domain Created Successfully! ****
十三步:在另一台机器上配置节点服务器managed server,配置过程和上面的一样,一定要保证参数和上面所设定的参数是一样的,包括 域名,mServer2的ip 、port ,还有名字一定要和配置第一台机器时保持一致。否则会导致节点服务器不能启动
十四步: 启动管理服务器
进入/usr/local/weblogic/weblogic81/user_projects/domains/testClusterDomain/目录
键入./startWebLogic.sh
启动managed server用如下命令:
在10.3.15.85上启动mServer1
./startManagedServer mServer1 10.3.15.85:7001
在10.3.15.84上启动mServer2
./startManagedServer mServer2 10.3.15.85:7001
十五步: 添加代理服务器proxyServer
启动Administrator Server,然后进入Console控制台(http://10.3.15.85:7001/console/),在此我们将代理Server与Administrator Server置于同一台主机之上。
进入console控制台后,在“Server”结点上单击右键,在弹出菜单上选择“Configure a New Server”,然后配置代理Server的相关信息。(在这里只要指定名称,监听地址,监听端口就可以了)