`
阅读更多

weblogic集群测试

1. 集群原理
针对现有资源,采用如下图所示的体系结构

2. 集群规划
在规划集群配置时,应该牢记以下关于网络环境与集群配置的限制。

1.首先,集群中的WebLogic主机必须使用永久的静态IP地址。动态IP地址分配不能用于集群环境。如果服务器位于防火墙后面,而客户机位于防火墙外面,那么服务器必须有公共的静态IP地址,只有这样,客户端才能访问服务器。
2.集群中的所有WebLogic服务器必须位于同一个局域网,并且必须是IP广播可到达的。
3.集群中的所有WebLogic服务器必须使用相同的版本。配置集群中的服务器,使它们支持所提供的服务。对于使用了JDBC连接的EJB,所有部署了某EJB的服务器必须具有相同的部署与持久化配置。也就是说所有服务器都应该有相同的JDBC配置。所有部署了servlet的主机必须维护一组具有相同ACL的servlet

3. 主要实现功能
3.1. 负载均衡
Load balancing(负载均衡):集群的一项关键技术,将客户端请求分配给不同的服务器来获得高可靠性和更好的性能。
3.2. Failover
Failover:集群的另外一项关键技术,用于实现Fault Tolerance。当集群中一个节点崩溃时,底层平台可以把处理过程转移到集群中另外一个节点上,这个操作可以是自动或手动的。

4. 配置WebLogic Server集群
4.1. 现有情况说明
现有2台IBM PC,一台安装的是Linux RedHat 9.0,一台安装的是linux AS 3,两台机器在同一网段。

机器类型
操作系统
硬件配置
角色

IBM PC
Linux RedHat 9.0
IP:127.0.0.1 PORT:7001
Administrator Server

IBM PC
Linux RedHat 9.0
IP:127.0.0.1 PORT:8888
Apache Server

IBM PC
Linux RedHat 9.0
IP:127.0.0.1 PORT:7002
Managed Server Node_A

IBM PC
Linux AS 3
IP:10.116.5.55 PORT:7004
Managed Server Node_B

4.2. 所需软件
Apache 2.0:httpd-2.0.48.tar.gz
SUN JDK1.4:j2sdk-1_4_2_10-linux-i586.bin
BEA WebLogic Sever 8.1 SP4:pj_server814_generic.jar
BSS系统应用程序包:applications.tar.gz

4.3. 创建用户
为方便管理,创建安装weblogic软件的用户以及运行weblogic实例的用户
4.4. 安装Apache并与weblogic集成
以root用户解压httpd-2.0.48.tar.gz并安装:
#cd /data
#tar –zxvf httpd-2.0.48.tar.gz
#cd httpd-2.0.48
#./configure ――enable-module=so ――enable-rule=SHARED_CORE
#make
#make INSTALL
Apache已安装到/usr/local/apache2。
4.5. 安装JDK
安装文件j2sdk-1_4_2_10-linux-i586.bin
$chmod a+x j2sdk-1_4_2_10-linux-i586.bin
$./ j2sdk-1_4_2_10-linux-i586.bin
安装完成。

4.6. 安装weblogic
安装文件pj_server814_generic.jar
$ java -jar pj_server814_generic.jar -mode=console
安装过程中创建安装路径为/data/weblogic814
其他按照提示安装即可。

4.7. apache与weblogic的集成
下面开始进行apache与weblogic的集成:
查看apache是否可以与weblogic集成
$cd /usr/local/apache2/bin
$./httpd –l
Compiled in modules:
core.c
mod_access.c
mod_auth.c
mod_include.c
mod_log_config.c
mod_env.c
mod_setenvif.c
prefork.c
http_core.c
mod_mime.c
mod_status.c
mod_autoindex.c
mod_asis.c
mod_cgi.c
mod_negotiation.c
mod_dir.c
mod_imap.c
mod_actions.c
mod_userdir.c
mod_alias.c
mod_so.c
mod_so.c表明当前的Apache HTTP Server是动态加载的模式,可以和WebLogic进行集成。然后将/data/weblogic814/server/lib/linux/i686目录下的mod_wl_20.so文件拷贝到/usr/local/apache2/modules/目录下面:
$cp /data/weblogic814/server/lib/linux/i686/mod_wl_20.so /usr/local/apache2/modules/

修改/usr/local/apache2/conf/httpd.conf:
$cd /usr/local/apache2/conf/
$vi httpd.conf
添加LoadModule weblogic_module modules/mod_wl_20.so

<VirtualHost 127.0.0.1:8888>
ServerName 127.0.0.1
<IfModule mod_weblogic.c>
WebLogicCluster 127.0.0.1:7002,10.116.5.55:7004
MatchExpression *.*
</IfModule>
</VirtualHost>

然后重启apache
$/usr/local/apache2/bin/httpd –k restart

4.8. 配置weblogic集群
$cd /data/weblogic814/common/bin
$./config.sh
Unable to instantiate GUI, defaulting to console mode.

<-------- 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]>1 #选择1

<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->

Select a Domain Template:
-------------------------

Please select a template from the list or select another directory of templates.

* [/data/weblogic814/common/templates/domains]

1|Basic WebLogic Workshop Domain 8.1.4.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.

->2|Basic WebLogic Server Domain 8.1.4.0
| BEA Systems, Inc.
| Create a basic WebLogic Server domain without installing sample applications.

3|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.

4|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.

5|Select another directory location


Enter index number to select OR [Exit][Previous][Next]>2 #选择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 #选择2

<-------------------------------------------- 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

<-------------------------------------------- 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 |


Enter value for "Name" OR [Exit][Previous][Next]>adminserver #配置管理服务名为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: | adminserver |
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"
5 - Discard Changes

Enter option number to select OR [Exit][Previous][Next]>2 #选择2设置监听地址

<-------------------------------------------- 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: | adminserver |
2| Listen address: | All Local Addresses |
3| Listen port: | 7001 |
4| SSL listen port: | N/A |
5| SSL enabled: | false |


Enter value for "Listen address" OR [Exit][Previous][Next]> 127.0.0.1 #输入监听地址

<-------------------------------------------- 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: | adminserver |
2| Listen address: | 127.0.0.1 |
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"
5 - Discard Changes

Enter option number to select OR [Exit][Previous][Next]>Next #下一步


<-------------------------------------------- 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 |
_|_______|________________|_____________|_________________|_____________|

Enter name for a new Server OR [Exit][Previous][Next]>node_A #设置被管服务器node_A

<-------------------------------------------- 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| node_A | All Local Addresses | 7001 | N/A | false |

Select Option:
1 - Modify "Name"
2 - Modify "Listen address"
3 - Modify "Listen port"
4 - Modify "SSL enabled"
5 - Done


Enter option number to select OR [Exit][Previous][Next]>2 #设置监听地址

<-------------------------------------------- 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| node_A | 127.0.0.1 | 7001 | N/A | false |

Select Option:
1 - Modify "Name"
2 - Modify "Listen address"
3 - Modify "Listen port"
4 - Modify "SSL enabled"
5 - Done


Enter option number to select OR [Exit][Previous][Next]>3 #设置监听端口为7002

<-------------------------------------------- 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| node_A | 127.0.0.1 | 7002 | N/A | false |

Select Option:
1 - Modify "Name"
2 - Modify "Listen address"
3 - Modify "Listen port"
4 - Modify "SSL enabled"
5 - Done


Enter option number to select OR [Exit][Previous][Next]>5 #完成设置node_A

<-------------------------------------------- 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| node_A | 127.0.0.1 | 7002 | N/A | false |

Select Option:
1 - Add Server
2 - Modify Server
3 - Delete Server
4 - Discard Changes

Enter option number to select OR [Exit][Previous][Next]>1 #设置被管服务器node_B
按照node_A的设置方法完成node_B的创建,监听地址设为10.116.5.55,监听端口7004。
<-------------------------------------------- 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| node_A | 127.0.0.1 | 7002 | N/A | false |
->2| node_B | 10.116.5.55 | 7004 | N/A | false |

Select Option:
1 - Add Server
2 - Modify Server
3 - Delete Server
4 - Discard Changes


Enter option number to select OR [Exit][Previous][Next]>Next #下一步

<-------------------------------------------- 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

<-------------------------------------------- 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 |
_|_____________|___________________|________________|_________________|
->1| testcluster | 237.0.0.1 | 7001 | |

Select Option:
1 - Modify "Name"
2 - Modify "Multicast address"
3 - Modify "Multicast port"
4 - Modify "Cluster address"
5 - Done


Enter option number to select OR [Exit][Previous][Next]> 5 #组播地址和端口设为默认值。

<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->

Assign Servers to Clusters:
---------------------------

Assign managed servers to a cluster in the domain.
Cluster
|_____testcluster [1]


Enter number exactly as it appears in brackets to toggle selection OR [Exit][Previous][Next]>1 #添加被管服务器到集群testcluster中

<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->

Assign Servers to Clusters:
---------------------------

Assign managed servers to a cluster in the domain.
*Select WebLogic Servers and assign them to a cluster. testcluster

1|node_A
2|node_B

Select Option:
1 - Select
2 - Select All


Enter option number to select OR [Exit][Discard][Accept]> 2 #选择所有被管服务器

接下来的几步是创建machines、JDBC、JMS,在此不创建,直接回车。

<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->

Configure Administrative Username and Password:
-----------------------------------------------

Create a user automatically assigned to the Administrative Role. This user is the default administrator used to start
development mode servers.

| Name | Value |
_|_________________________|_________________________________|
1| *User name: | weblogic |
2| *User password: | |
3| *Confirm user password: | |
4| Description: | The default administration user |

Select Option:
1 - Modify "User name"
2 - Modify "User password"
3 - Modify "Confirm user password"
4 - Modify "Description"


Enter option number to select OR [Exit][Previous][Next]>2 #创建管理员密码

<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->

Domain Mode Configuration:
--------------------------

Enable Development or Production Mode for this domain.
->1|Development Mode

2|Production Mode


Enter index number to select OR [Exit][Previous][Next]>1 #配置实例为开发模式

<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->

Java SDK Selection:
-------------------

->1|Other Java SDK

Enter index number to select OR [Exit][Previous][Next]> 1 #选用SUN JDK

<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->

Java SDK Selection:
-------------------

"JVM Directory" = []

Input new JVM Directory OR [Exit][Previous][Next]>/data/j2sdk1.4.2_10

<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->

Select the target domain directory for this configuration:
----------------------------------------------------------

"Target Location" = [/data/weblogic814/user_projects/domains]


Input new Target Location OR [Exit][Previous][Next]>/data/test #输入域目录

<-------------------------------------------- BEA WebLogic Configuration Wizard ------------------------------------------->

Edit Domain Information:
------------------------

| Name | Value |
_|________|__________|
1| *Name: | mydomain |


Enter value for "Name" OR [Exit][Previous][Next]>bsstest #输入域名

按照以上步骤在10.116.5.55上创建域mydomain以及被管服务器node_B。

至此weblogic域创建成功。

5. 测试环境搭建
5.1. 上载BSS系统程序
为方便管理,将管理服务器和被管服务器放置在不同目录:
在127.0.0.1上将weblogic实例/data/test/bsstest copy至/data/test/ 并重命名为node_A,在10.116.5.55上将weblogic实例/data/test/bsstest重命名为node_B。
对应目录如下:
127.0.0.1 /data/test/adminserver #管理服务器
/data/test/node_A #被管服务器A
10.116.5.55 /data/test/node_B #被管服务器B
将applications.tar.gz解压在/tmp,生成/tmp/applications及/tmp/lib目录。
将/tmp/lib拷贝至adminserver、node_A、node_B对应的目录下面。
将/tmp/applications/目录下所有文件中copy至adminserver对应目录下的applications目录中。

5.2. 配置环境变量
lib目录下面存放的是基础类库文件,在BSS系统运行时需要调用到,因此需要添加至weblogic classpath变量中。
修改adminserver下的startWebLogic.sh
$vi startWebLogic.sh
添加如下语句:
LIB_PATH="/data/test/bsstest/lib"
CLASSPATHSEP=:

CLASSPATH=${LIB_PATH}/aciiToString.jar${CLASSPATHSEP}${LIB_PATH}/aiobs_interface.jar${CLASSPATHSEP}${LIB_PATH}/classes12.jar${CLASSPATHSEP}${LIB_PATH}/cnc_bus.jar${CLASSPATHSEP}${LIB_PATH}/cncEx.jar${CLASSPATHSEP}${LIB_PATH}/cnc.jar${CLASSPATHSEP}${LIB_PATH}/cncweb.jar${CLASSPATHSEP}${LIB_PATH}/CommHandle.jar${CLASSPATHSEP}${LIB_PATH}/common.jar${CLASSPATHSEP}${LIB_PATH}/commons-beanutils-bean-collections.jar${CLASSPATHSEP}${LIB_PATH}/commons-beanutils-core.jar${CLASSPATHSEP}${LIB_PATH}/commons-beanutils.jar${CLASSPATHSEP}${LIB_PATH}/commons-lang-2.0.jar${CLASSPATHSEP}${LIB_PATH}/commons-logging-api.jar${CLASSPATHSEP}${LIB_PATH}/commons-logging.jar${CLASSPATHSEP}${LIB_PATH}/crypt.jar${CLASSPATHSEP}${LIB_PATH}/log4j.jar${CLASSPATHSEP}${LIB_PATH}/nls_charset12.jar${CLASSPATHSEP}${LIB_PATH}/ojdbc14.jar${CLASSPATHSEP}${LIB_PATH}/poi-2_5_1.jar

用相同方法修改node_A、node_B的startManagedWebLogic.sh中的classpath。
5.3. 服务器启停
启动管理服务器:
$nohup /data/test/bsstest/startWebLogic.sh >log &
停止管理服务器:
$/data/test/bsstest/stopWeblogic.sh或kill掉相应进程。

启动被管服务器:
$nohup /data/test/node_A/startManagedWebLogic.sh node_A http://127.0.0.1:7001 >log &
$nohup /data/test/node_B/startManagedWebLogic.sh node_B http://127.0.0.1:7001 >log &
停止被管服务器:
将node_A、node_B中的stopWebLogic.sh中的SERVER_NAME分别设为node_A,node_B
直接运行stopWebLogic.sh或kill掉相应进程即停止。

查看进程:
$ps –ef|grep java

若启动过程无任何报错,直到log提示<Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>则启动成功。

5.4. 发布应用程序
启动adminserver,进入控制台http://127.0.0.1:7001/console

5.4.1 发布EJB:
在树型目录中,进入bsstest>Deployment>EJB Modules> Deploy a new EJB Module... ,选择applications目录下的jar文件,然后点击Target Module

如上图示将jar文件target至cluster上,点击Continue

选择将EJB模块发布至集群中每一台服务器上,然后点击Deploy,

发布成功后,状态如上图示。

按照相同方法发布其他EJB模块。

5.4.2 发布WEB应用程序模块
在树型目录中,进入bsstest>Deployment>Web Application Modules>Deploy a new Web Application Module…

选择DefaultWebApp,点击Target Module
将应用程序target至cluster上的所有服务器,点击Depoly,发布成功后如下图所示:


5.5. 配置JDBC连接
启动adminserver,进入控制台http://127.0.0.1:7001/console
5.5.1 配置连接池:
配置测试用数据库连接池,连接到132.96.80.114数据库,方法如下:
在树型目录中,进入bsstest>Services>JDBC>Connection Pools> Configure a new JDBC Connection Pool...

选择数据库类型和驱动,然后点击Continue

如上图示配置连接池属性,点击Continue
点击Apply将连接池应用到testcluster上的所有服务器。

5.5.2 配置数据源:
在树型目录中,进入bsstest>Services>JDBC>Data Sources> Configure a new JDBC Data Source

设置数据源名称为netcomDs,JNDI名称netcomDs,然后点击Continue

点击Apply,将数据源应用到testcluster上所有服务器。

5.6. 配置JNDI属性
更改/applications/DefaultWebApp/WEB-INF/classes/cncJndi.properties中的java.naming.provider.url=t3://localhost:7001改为:
java.naming.provider.url=t3://127.0.0.1:7002,t3://10.116.5.55:7004
5.7. 编辑weblogic.xml及web.xml
设置web应用程序的context-root为“/”,这样直接输入http://127.0.0.1:8888/login.jsp就可以进入BSS系统登录页面。
$ cat weblogic.xml
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd">

<weblogic-web-app>
<session-descriptor>
<session-param>
<param-name>PersistentStoreType</param-name>
<param-value>replicated</param-value>
</session-param>
</session-descriptor>
<context-root>/</context-root>
</weblogic-web-app>

5.8. 外部资源的处理
由于外部资源不能够被集群,所以涉及到文件上传下载等要实现集群服务器之间的同步,需要进行特殊处理。解决的办法主要有:
1.在应用服务器之间做目录共享,写入文件的时候指定目录名称,不管是那台服务器来响应SERVLET都写入这个共享目录;
2.把文件通过存储过程写入DB的文件系统内,DB资源是可以统一访问的资源,文件也一样。
3.在PROXYSERVER中拦截上传附件的请求,所有该请求都指定一个固定的SERVER为其服务,文件固定的存放到一个SERVER中,而不是由LOADBALANCE的策略决定该请求由哪个服务来提供服务

目前BSS上一些业务需要上传或生成临时文件,如果不采用上面的方法,则需要取消生成临时文件的机制,改变为应用程序直接处理。
6. 测试功能
启动管理服务器adminserver,启动被管服务器node_A,node_B,当对应log都出现<Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>则服务器启动成功。
链接http://127.0.0.1:8888/login.jsphttp://127.0.0.1:7002/login.jsphttp://10.116.5.55:7004/login.jsp应均能访问。
下面来测试集群功能:
6.1. 测试负载均衡
用apache自带的压力测试软件测试负载均衡。
$cd /usr/local/apache2/bin/
$./ab –c 100 -n 100 http://127.0.0.1:8888/test.jsp #表示连接100次,并发100次,n表示请求的基准测试数目,c表示并发。

压力测试完成后,我们从Managed Server的控制台上可以看到,nodeA,nodeB都打印出了“OK”字样,这说明,在并发请求的情况下,集群能够将请求进行分发,以达到负载平衡的目的。
6.2. 测试Failover(失败转移)
登录http://127.0.0.1:8888/login.jsp;通过查看log得知登录到node_A上,在node_A上做业务,这时Kill掉node_A的实例进程,如果这时操作能继续进行(有可能操作失败,但重操作可以成功),可确认失败转移成功。
编辑weblogic.xml,插入如下语句:
<session-descriptor>
<session-param>
<param-name>
PersistentStoreType
</param-name>
<param-value>
replicated
</param-value>
</session-param>
</session-descriptor>

注明:在方法调用之间可实现failover,但在方法调用时却不能failover。

分享到:
评论

相关推荐

    weblogic集群测试.pdf

    【WebLogic集群测试详解】 WebLogic集群是一种高可用性、高性能的解决方案,它通过将多个独立的WebLogic服务器实例组织在一起,共同提供服务,从而实现负载均衡、故障转移等功能。以下是对WebLogic集群的深入理解和...

    WebLogic集群部署资料

    WebLogic集群部署是Oracle公司提供的企业级Java应用服务器在高可用性、可伸缩性和负载均衡方面的重要特性。本文将详细解析WebLogic集群的概念、优势、配置步骤以及单服务器和多服务器部署的区别。 首先,WebLogic...

    weblogic集群部署文档.docx

    本文档主要介绍了如何在Windows和Linux操作系统上搭建WebLogic集群,包括WebLogic Server的安装、Domain的配置以及集群的创建和节点的添加。 首先,安装WebLogic Server的过程大致如下: 1. 在命令行中,定位到...

    Linux环境WebLogic集群简单配置

    【Linux环境WebLogic集群配置详解】 在Linux操作系统中配置WebLogic集群是一项关键任务,它涉及到分布式系统的高可用性和性能优化。WebLogic Server是一款由Oracle公司提供的企业级Java应用服务器,常用于部署和...

    WebLogic集群部署详细步骤.docx

    WebLogic集群部署是一个关键的任务,尤其对于运行大型企业级应用的企业来说,它提供了高可用性、负载均衡和可扩展性。以下是一个详细的WebLogic集群部署步骤,基于标题和描述中的内容: 1. **前置准备**: 在开始...

    weblogic集群配置方法-具体实施步骤

    WebLogic集群是Oracle WebLogic Server的一种高级特性,它允许你将多个服务器实例组合在一起,以提供高可用性、可伸缩性和故障转移能力。在本文中,我们将详细探讨WebLogic集群的配置方法,包括关键步骤和注意事项。...

    WebLogic集群与分布式

    【标题】"WebLogic集群与分布式" WebLogic集群是一种高可用性和可伸缩性的解决方案,由Oracle公司开发,用于在Java EE应用服务器环境中部署和管理应用程序。它通过将多个独立的WebLogic Server实例(称为节点)组织...

    weblogic集群步骤

    ### WebLogic集群部署详细步骤 #### 一、WebLogic集群简介 在介绍具体的部署步骤之前,我们先来了解一下WebLogic集群的基本概念。WebLogic Server是由Oracle公司提供的一个应用服务器,主要用于构建和部署企业级...

    Linux环境Weblogic集群配置,Weblogic JMS集群配置

    本教程将深入探讨如何在Linux环境下配置Weblogic集群以及Weblogic JMS集群,这对于提高应用程序的可用性和可扩展性至关重要。 首先,让我们了解一下Weblogic集群的基本概念。Weblogic集群是指一组独立的Weblogic...

    apahce 和 weblogic 集群(基于域名)

    Apache 和 WebLogic 集群基于域名的集成是一种常见的企业级解决方案,用于部署和管理多个应用程序在一个物理服务器或集群上。这种集成允许你利用Apache HTTP Server的域名解析能力,为多个运行在不同WebLogic Server...

    weblogic 集群,session 复制测试

    测试weblogic 集群环境(session replication)

    aix下weblogic的集群配置

    在AIX操作系统上配置WebLogic集群是一项复杂但关键的任务,因为WebLogic Server是Oracle公司提供的一个强大、可扩展的企业级Java应用服务器,而集群技术能够提高应用的可用性和可伸缩性。以下将详细介绍在AIX环境下...

    oracle RAC 和 weblogic集群安装配置和部署文档

    在本文档中,我们将深入探讨Oracle RAC(Real Application Clusters)和WebLogic集群的安装、配置与部署过程。Oracle RAC是一种高可用性解决方案,可使多台服务器共享同一数据库,提供故障切换和负载均衡能力。...

    WebLogic集群配置V20181114.docx

    WebLogic集群配置是大型企业级应用中间件服务的关键步骤,特别是在处理高并发、大数据量的业务场景时。本文将详细阐述WebLogic服务器集群部署的过程,包括环境配置、JDK安装、WebLogic安装以及集群配置等多个环节。 ...

    Weblogic集群部署及代理配置步骤文档+源程序

    5. 测试代理配置:通过访问代理服务器的URL,验证请求是否正确路由到WebLogic集群。 四、源程序实践 压缩包中的源程序例子可以帮助你理解如何将应用程序打包为适合WebLogic部署的格式。这可能包括以下部分: 1. ...

    Weblogic 10.3集群配置指南与Session持久化

    1. **Weblogic集群名词解释** - **Domain**:在Weblogic中,Domain是一个逻辑管理单元,包含了Weblogic Server实例、应用程序、网络配置、安全策略等资源。它是一个自包含的运行环境,由一个或多个服务器实例组成。...

Global site tag (gtag.js) - Google Analytics