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]> 1
录入 1 回车,建立一个新的域。
第二步:选择模版
系统提示选择一个建立域的模版,资料上讲配置向导的配置过程可以另存为模版,以便下次配置的时候使用,没试过下次回去试试。
<-------- BEA WebLogic Configuration Wizard -------->
Select a Domain Template:
-------------------------
Please select a template from the list or select another directory of templates.
* [/usr/local/bea/weblogic81/common/templates/domains]
->1|Basic WebLogic Server Domain 8.1.4.0
| BEA Systems, Inc.
| Create a basic WebLogic Server domain without installing sample applications.
2|WebLogic Server Examples Domain 8.1.4.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.
3|Avitek Medical Records Sample Domain 8.1.4.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.
4|Select another directory location
Enter index number to select OR [Exit][Previous][Next]> 1
这里我们选择 1 ,使用基础的模版
第三步:是否以快速模式进行
第三步系统提示是否以快速模式进行配置,这里选择 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 ---------->
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 |
_|_______|________________|_____________|_________________|_____________|
Enter name for a new Server OR [Exit][Previous][Next]> mServer1
被管服务器我们设置两个: mServer1 和 mServer2 , mServer1 和管理服务器在一台机器上,所以端口设置为 7003 避免和管理服务器冲突。
mServer2 的监听地址一定要设置成 ip ,否则在启动被管服务器 2 的时候会得到这样一个错误: using the same address as the admin server (这个错挺傻的我觉得),如果是实际的集群配置的话,这里建议都写成 ip 的形式。
配置完成的画面如下:
| Name* | Listen address | Listen port | SSL listen port | SSL enabled |
_|_________|___________________|_____________|_________________|_____________|
1| mServer1| 10.21.18.41 | 7003 | N/A | false |
->2|mServer2|10.21.18.41 | 7001 | 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 | 7001 | |
第七步:将服务器组织到集群中
根据系统的提示,将 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]> testDomain
设置域的名称为 testDomain 。
十二步:域建立结束
以上步骤都完成后,系统会自动建立这个域,并会生成一些文件等等,完成的界面如下:
<----- BEA WebLogic Configuration Wizard --------->
Creating Domain...
0% 25% 50% 75% 100%
[------------|------------|------------|------------]
[***************************************************]
**** Domain Created Successfully! ****
启动管理服务器
进入 bea/user_projects/domains/testDomain/ 目录
键入 ./startWebLogic.sh
建立被管服务器 1
这里的被管服务器 1 也就是 mServer1 是和管理服务器在同一台机器上的,这里我试过了,我们不需要再进行什么配置,只需要启动它就行了,启动被管服务器 1 的命令如下:
进入 bea/user_projects/domains/testDomain/ 目录
键入 ./startManagedWebLogic.sh mServer1 http://10.21.18.40:7001
这样的写法保证了被管服务器在启动的时候向管理服务器报告,后面的这个地址就是管理服务器的地址了
当然,由于是在同一台机器上,所以你完全可以这样写: ./startManagedWebLogic.sh mServer1 就可以了。
建立被管服务器 2
被管服务器 2 和管理服务器在不同的机器上,所以你还需要在这台机器上配置一个域,域的名字要和刚才建立的域名字一致(不一致会怎么样我也没试过,谁有时间试一下: > )
建立域的过程前三步和上面讲的一样
第四步,配置管理服务器的时候,请把这个域的管理服务器的名字设置为 mServer2 。
这里需要解释一下,在每台机器上建立域的时候都需要有一个管理服务器,以确保整个域的管理服务器当掉的时候,每台机器自己都是还可以运行的,这里我们是把 mServer2 作为了 41 这台机器的管理服务器,同时它也是 adminServer 的被管理服务器。
从第五步开始,都不需要配置,直接回车就可以了。
配置完成后,用下面的命令启动 mServer2 :
./startManagedWebLogic.sh mServer2 http://10.21.18.40:7001
小结
到目前为止,一个包含一个管理服务器和 2 个被管服务器以及一个 cluster 的域就配置完成了,你可以简单试验一下它提供的功能,打开管理服务器的管理控制台:
http://10.21.18.40:7001/console
首先,在这个管理控制台上你可以监控和管理 mServer1 和 mServer2 ,选择 mServer2
进入 Monitoring 页面 General 子页面,如果显示如下,就说明配置是正确的了:
进入 Monitoring 页面的 Performance 子页面,就可以看到 mServer2 的运行情况了。
将一个 web 应用上传上去,将其部署在 testCluster 这个集群上
部署成功后,分别在 mServer1 和 mServer2 上访问刚才部署的 web 应用,应该都是可以访问的。
建立代理服务器
建立了集群以后,集群的负载平衡功能还需要代理( proxy )来实现。目前我所知道的 Weblogic 支持几种类型的代理:
Ø HttpClusterServlet 的代理,这个代理是 weblogic 公司编写的一个 servlet ,把它部署在一个 weblogic 服务实例上,就可以实现负载平衡和容错了。
Ø IIS 代理,用 IIS 作为前段的 http 的代理,需要往 IIS 中装一个插件
Ø Netscape/iPlanet 代理,需要装插件
Ø Apache 代理,用 Apache 作为 http 代理,需要装插件。推荐使用
当然,实际应用中可能更加复杂,可能会这样:
使用 HttpClusterServlet 作为代理
建立代理服务器实例
代理服务器 proxyServer 实例实际上和 mServer1 一样,都是属于 testDomain 域的一个被管服务器,回头看建立管理服务器的第五步,在那个时候配置被管服务器的时候如果也把 proxyServer 加上的话,现在直接启动就可以了。
当然也可以在管理服务器的管理控制台上新建这个 server 。
在管理服务器的控制台上,左边的菜单中 Server 上单击左键,选择“新建一个 Server ”
然后,在出现的页面中设置这个 server 的名字为 proxyServer ,监听端口为 7004 ,如图: