Linux下配置WebLogic Server集群

上一篇 / 下一篇  2009-01-20 23:03:51 / 个人分类:Weblogic

  • 文件版本: V1.0
  • 开发商: 本站原创
  • 文件来源: 本地
  • 界面语言: 简体中文
  • 授权方式: 免费
  • 运行平台: Win9X/Win2000/WinXP

X/m7Bkp0目的51Testing软件测试网 } k]7i` c{-pU

51Testing软件测试网$eS(B#CEf-Y'R V4hZ

本文讲述如何在WebLogic Server 8.1上配置集群,以及通过Proxy Server来访问集群,可以参照这个文档进行linux下weblogic群集的配置,群集启动和节点启动,发布应用,同步应用,session的复制共享,测试应用的自动分发功能,自动接管功能。51Testing软件测试网1lG"z*sS$Z ]N
预备知识
8L;D'?f9K0什么是Domain和Server
:|;T5}_(o0Domain
%^ ZC7?2AQm:F0Domain是WebLogic Server实例的基本管理单元。所谓Domain就是,由配置为Administrator Server的WebLogic Server实例管理的逻辑单元,这个单元是有所有相关资源的集合。51Testing软件测试网 t7u9l,bC/NU&`'? F/X
Server51Testing软件测试网+j:s/M['z"zz
Server是一个相对独立的,为实现某些特定功能而结合在一起的单元。51Testing软件测试网v%JcFV(\ v
Domain and Server的关系51Testing软件测试网"l'_(_ m l6r2QPa
一个Domain 可以包含一个或多个WebLogic Server实例,甚至是Server集群。一个Domain中有一个且只能有一个Server 担任管理Server的功能,其它的Server具体实现一个特定的逻辑功能。51Testing软件测试网LHwbb,z*\
本文环境51Testing软件测试网4Q]^0N M*ve K x3s
? 平台:Linux as 451Testing软件测试网i.vP,m IR"L
? 软件:Bea WebLogic Server 8.1 SP5
yW!F5j?/D7NU%t#m N0配置WebLogic Server集群
|%g.wqa}0`t e0WebLogic集群的体系结构51Testing软件测试网f:l(H:rCi
单层混合型的集群架构(Cluster)51Testing软件测试网4N$xQD]{+m
这种架构将所有的Web应用以及相关的服务应用全部置于集群中的单一WLS实例中,这种架构的优势在于:
d1j+|#PW`z0? 易于管理51Testing软件测试网JU#S i"i
? 灵活的负载平衡机制
?jb&b tW0? 更强的安全控制

7IVgR(X a^b051Testing软件测试网"ZXGcW IaB

多层结构的集群架构(Cluster)
v}w2L4o%Qy0这种架构使用两个WLS集群,一个放置表静态内容和集群Servlet,另一个放置集群EJB。一般应用于下面这些情况:51Testing软件测试网m"N4\j6J)fBU6x
? 在负载平衡机制需要调用集群EJB中的方法时;51Testing软件测试网/z.~7_TH#N+l
? 在提供内容与提供对象的服务之间需要更大的机动性时;51Testing软件测试网*xVIqW4^`rJ
? 在需要更高的系统稳定性时;51Testing软件测试网9DB,OL:e)oF[

51Testing软件测试网Qx'?~f&s5aU9b

51Testing软件测试网Wz(uV9m'u+v_Z`
配置集群应用的必要条件
%l&Kr-W]S\0? 集群中的所有Server必须位于同一网段,并且必须是IP广播(UDP)可到达的51Testing软件测试网6sl.tVT$ehgL
? 集群中的所有Server必须使用相同的版本,包括Service Pack51Testing软件测试网@ki0L/Fl_Z{;p!i
? 集群中的Server必须使用永久的静态IP地址。动态IP地址分配不能用于集群环境。如果服务器位于防火墙后面,而客户机位于防火墙外面,那么服务器必须有公共的静态IP地址,只有这样,客户端才能访问服务器
6J!\,YB(MLu3U.SI0? 要以CLUSTER方式运行,必须有包含CLUSTER许可的LICENSE才行(从Bea网站上下载的试用版本就可以进行Cluster配置)

SPt!@4y-T;S0

r6S:MH4K6Ix5b0配置前的准备工作
G~s].kf%e0在配置集群应用前要对集群的配置信息有一个良好的设计,下面就是我们这次配置的集群信息:
6k},\,X}Lv2z[J0在同一网段内的不同机器上配置集群,以下是以2台机器做群集,
.aQGy I&`9w9{py0机器类型 操作系统 硬件配置 角色 备注
!y~s Ekn:I ~0普通 PC Linux as 4 IP:10.3.15.85 PORT:7001 Administrator Server Pc1
xs's zx*rL0普通 PC Linux as 4 IP: 10.3.15.85 PORT:80 Proxy Server Pc1
7gC6|W"C2wzK)[|0普通 PC Linux as 4 IP: 10.3.15.85 PORT:7080 Managed Server Pc1
%F(S }'D qK0普通 PC Linux as 4 IP: 10.3.15.84 PORT:7080 Managed Server Pc2

8zY8x2ar5l[0

~I j&\1h*t0使用Domain Configuration Wizard进行配置51Testing软件测试网RQ9GSet
创建新的Domain51Testing软件测试网0O"h2^T4E)]B d
第一步:51Testing软件测试网zhQMs(A![8tF
进入到weblogic安装目下的 /usr/local/wblogic/webloic81/common/bin下面执行 ./config.sh 启动域配置程序51Testing软件测试网{4]`m;RcS-i0f4o*B&]

51Testing软件测试网2H%A/`Fa5B[

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

l.L#`b!v VE e051Testing软件测试网)FRiR]3J

Create or Extend a Configuration:51Testing软件测试网8fwr:}y \n&`9\np
---------------------------------51Testing软件测试网2\2~*aUV!N u

51Testing软件测试网i;B+NnN!f

Choose between creating and extending a configuration. Based on your selection, the Configuration Wizard guides you through the
*QD#|#Y#Y1r T0steps to generate a new or extend an existing configuration.51Testing软件测试网q\1?aiGJ

,ex/G8?V7c ~xw0->1|Create a new WebLogic configuration51Testing软件测试网1p5Hp0a/QbvH
    |    Start here to create a WebLogic configuration in your projects directory.

5G.D4e a]w&s!W0

!Woj"jKj}%R3[5l K6e0   2|Extend an existing WebLogic configuration
1` R4Z1dZ l1cT7RDj0    |    Start here to extend an existing WebLogic configuration.  Use this option to add applications and services, including
6OoE q+|4k+d0    |Database access (JDBC) and Messaging (JMS). This option also enables you to extend functionality by enabling WebLogic51Testing软件测试网(fx$d)h,a"b
    |Workshop.

#u+Mdn z;F Gk;nF051Testing软件测试网_&Q4P7og? UR*\

Enter index number to select OR [Exit][Next]> [root@localhost bin]# 1

/z F-kUD,Mbb3i051Testing软件测试网r4F4QY7^^` g6L*hx

第二步:选择模版
'm/L"r _Tx!jB0系统提示选择一个建立域的模版,资料上讲配置向导的配置过程可以另存为模版,以便下次配置的时候使用,没试过下次回去试试。51Testing软件测试网f/crg:_/@HW E!n
<----------------------------------------------- BEA WebLogic Configuration Wizard ----------------------------------------------->

_q,?GS `R0

$i-BY {M[d#n0Select a Domain Template:51Testing软件测试网*`Zno){nV;KH E4S
-------------------------51Testing软件测试网;s3]E:@!V$L

51Testing软件测试网}!l0]e;q-Yo

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

Ru/v*Y[|P X@051Testing软件测试网{c1UO*j I%C~\p/B

    * [/usr/local/weblogic/weblogic81/common/templates/domains]

4bs \T'Z1F,f2g7[7N0

t+op7I!B!Zx0   1|WebLogic Server Examples Domain 8.1.5.0
E TO#R9KNB5w0    |  BEA Systems, Inc.
~8K+F;b$@G'c'x0    |  Create the WebLogic Server Examples domain in a directory outside of the installed kit.  The Examples domain contains a51Testing软件测试网yq:WEz%A:M o_
    |collection of examples to show best practices for coding individual J2EE APIs.51Testing软件测试网y0[/C#gJ5Q0I2S

0\'x5sl @4q?B0   2|Basic WebLogic Workshop Domain 8.1.5.051Testing软件测试网1r.p9VvTJj6J
    |  BEA Systems, Inc.51Testing软件测试网.V,ii.^^]z C
    |  Create a basic WebLogic Workshop domain, without installing sample applications.   Domains created from this template will
3P*Sbpl _3?@%VQT1@F:L0    |support the WebLogic Server and WebLogic Workshop runtime functionality, including support for J2EE applications, Web
"vZ2S F7@ a0    |applications, Web Services and custom controls.  Use domains created from this template for development of WebLogic Workshop51Testing软件测试网K{t_'LM5x Nf8Y
    |applications.

C9I E%m1w[7\.rv%Yl0

#D&APYp:I3B#c)` P0->3|Basic WebLogic Server Domain 8.1.5.0
BH`EpI0    |  BEA Systems, Inc.
6~sw3}V'j0    |  Create a basic WebLogic Server domain without installing sample applications.51Testing软件测试网pUD}sP |q

6\0UK8P#hGUK.{U0   4|Avitek Medical Records Sample Domain 8.1.5.0
~&Pb:x3f#orL0    |  BEA Systems, Inc.51Testing软件测试网7q-r xk Zu
    |  Create the Avitek Medical Records domain in a directory outside of the installed kit.  The Avitek Medical Records is a51Testing软件测试网lZoX+txpah?}
    |WebLogic Server sample application suite that concisely demonstrates all aspects of the J2EE platform.

5G E6jt't3Z051Testing软件测试网5Gi/nfq b

   5|Select another directory location51Testing软件测试网Fc'xWk

:a_6U#Nh!a6p;h!p K0Enter index number to select OR [Exit][Previous][Next]> 3
!H U+t so:W p0这里我们选择3,使用基础的模版

(Q&XyJ8H3G0

i`&ZcU)j0第三步:是否以快速模式进行51Testing软件测试网5nA kT-w4i1D

&| V;Q8{lD8F0第三步系统提示是否以快速模式进行配置,这里选择2。51Testing软件测试网q9ALU"[p4~M

51Testing软件测试网0n K*u.hSr TY5F

<----------------------------------------------- BEA WebLogic Configuration Wizard ----------------------------------------------->51Testing软件测试网2H5vi#C ~;`.t8n"JT.?D
Choose Configuration Option:
T7g:Sv:B/z![;C0----------------------------
8n Fn%l"h'i1U8[] v"yu0    *Do you want to run the wizard in express mode?
4kD2@ l w5y0->1|Yes51Testing软件测试网LGU^ kCN2h ^
   2|No51Testing软件测试网YT%T ri
Enter index number to select OR [Exit][Previous][Next]> 2

\z)LX9F ~ SX0

0`C8O%RIW$["tZ5Dn0第四步:配置管理服务器51Testing软件测试网rG1zz p:Fm/lg

i f-Qdox].A0现在系统提示我们配置管理服务器,把管理服务器的名字改一下,改成adminServer就可以了。51Testing软件测试网~g$dE"d!J

)cI#jJ'r:_.z!l7|h%n0<------- BEA WebLogic Configuration Wizard -------->51Testing软件测试网'Rn7}$]h&X m
Configure the Administration Server:
T6E1Y8ep%{!F0------------------------------------51Testing软件测试网'k^6Pm vR)X
Enter adminstration server configurations. Each WebLogic Server domain must have one Administration Server. The
b(ITV KU&k4L:]i0Administration Server hosts the Administration Console which is used to perform administrative tasks.51Testing软件测试网1t%qf6?k4I
    |       Name       |        Value        |
M ll9uk J;Sj!e2i0   _|__________________|_____________________|51Testing软件测试网.aB.U3Y'oz
   1|      *Name:      |      myserver       |
ez)~i QF"k}0   2| Listen address:  | All Local Addresses |51Testing软件测试网'hOL_4p_`$|4k7^dIx+B
   3|   Listen port:   |        7001         |
rl;be*G)l(v;C0   4| SSL listen port: |         N/A         |
| eu"i'I(@{0   5|   SSL enabled:   |        false        |
6fr? NIa0Select Option:51Testing软件测试网#|;vRl ZSfxC&J w
    1 - Modify "Name"51Testing软件测试网y0t H6Y&}/Q2p Q2K3v
    2 - Modify "Listen address"51Testing软件测试网0K'~.B h[Se
    3 - Modify "Listen port"
:ure @`s0    4 - Modify "SSL enabled"
,su%|#sT&WG-t"l p c0Enter option number to select OR [Exit][Previous][Next]> 1
Gk&z9ct)K ] E0输入1之后,根据系统提示输入新的管理服务器的名称adminServer51Testing软件测试网(z4ergC"rR

q*I.J+[ n @5L0第五步:配置被管服务器

'x/j3@CC+M+a![051Testing软件测试网 ]`*y t%i w

根据下面系统的提示,配置被管服务器51Testing软件测试网S3J;qS9L?~$c&A

4lk`RC*By#Y0<----------------------------------------------- BEA WebLogic Configuration Wizard ----------------------------------------------->
\ l3N,pX4b3@ S0Choose Configuration Option:51Testing软件测试网/_h Fz HDU
----------------------------51Testing软件测试网ZLp,K$rv I
    *Do you want to configure Managed Servers, Clusters and Machines?51Testing软件测试网y)P+s,|j
->1|Yes51Testing软件测试网 ?5lsf!_-k
   2|No51Testing软件测试网,L9]&VXx}
Enter index number to select OR [Exit][Previous][Next]> 1

m\)WI7i)h QDv0

a0C"SA+O7u m"hU0根据提示配置如下信息:
Z$n3oPQ%f0<----------------------------------------------- BEA WebLogic Configuration Wizard ----------------------------------------------->
B:Rjn/d#w{k0Configure Managed Servers:
8C&h+b&rmLy1]0--------------------------
~ D1j6feK-IO/i0Add 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.51Testing软件测试网8z0? P~8j+E#Z"K4}g

H7XN]3g[(uE0    |  Name*   | Listen address | Listen port | SSL listen port | SSL enabled |51Testing软件测试网L.E5U)M(i|*~/[
   _|__________|________________|_____________|_________________|_____________|
"Zq;Yv l d6x0   1| mServer1 |   10.3.15.85   |    7080     |       N/A       |    false    |
AYy\WO ^0->2| mServer2 |   10.3.15.84   |    7080     |       N/A       |    false    |

.Q7S&Cu5EzbjC051Testing软件测试网0eyIJp }$At Q)f6?

然后执行下一步51Testing软件测试网l8o*U~4g6p

5ha S%oCD4z6[g0第六步:配置集群51Testing软件测试网]3LW&H4gc

51Testing软件测试网%I&Tz&F^vDH

<----BEA WebLogic Configuration Wizard ------>51Testing软件测试网0n3G8Q~ s6L%r Q!v
Configure Clusters:51Testing软件测试网GkWb'z!\
-------------------
^ zV5~/[0A cluster contains multiple WebLogic Server instances (servers) that run simultaneously and work together to provide
u y7S1` LF5{0increased scalability and reliability.  A cluster appears to be a single WebLogic Server instance to clients.51Testing软件测试网&[;|9qjh-L
    | Name* | Multicast address | Multicast port | Cluster address |51Testing软件测试网Q"~}&D%Bh[
   _|_______|___________________|________________|_________________|51Testing软件测试网$|JG k)|%V
Enter name for a new Cluster OR [Exit][Previous][Next]> testCluster
dj jD:T2DU,k0输入集群的名字testCluster,其他的默认就行了,配置完成后如下:
~9YM S$?#VZ@0    |    Name*    | Multicast address | Multicast port | Cluster address |
H U4?]l0P0   _|_____________|___________________|________________|_________________|
p;\F9no\hCm!o0->1| testCluster |     237.0.0.1     |      7777      |                 |

Y+gq1bM0

)]$NR3OhP.P6{2u*_ q0第七步:将服务器组织到集群中51Testing软件测试网+r"gAkRtE

&d4xN\y2oV0根据系统的提示,将mServer1和mServer2放入集群testCluster中去,配置完成后如下:51Testing软件测试网@wbG0@+PwL5@
    Cluster51Testing软件测试网 n hB8qlH-G.i
    |_____testCluster [1]
5r:na0j^qq0         |_____mServer1
Hq|8T"`.F0         |_____mServer2

O7M!t"k$r5H.D3vM0

|[F Q$k$aB9T!D*Gw0第八步:配置机器、jdbc、jms、安全等51Testing软件测试网.K)h]QG

9q|5eLH3GgY LE0接下来几步系统提示配置Machines,jdbc,jms,安全,这里都不用配置,全部回车就行了。

2bm D@ ri8f6v-y051Testing软件测试网E"v]KU q#Nc)Z.g)?

第九步:输入管理服务器的用户名和密码51Testing软件测试网%L&c5D1]y'cz

$p!` Y\ ~8B0系统提示如下画面,可以配置管理服务器的用户名和密码:
H-w%Z-^!T0    |          Name           |              Value              |
4^R9G/e W1Z'?0   _|_________________________|_________________________________|51Testing软件测试网c_R2D9KC.]
   1|       *User name:       |            weblogic             |
$SB6}Z:~ v0hV'De0   2|     *User password:     |            ********             |51Testing软件测试网 I xn:@Y?)mg#v&m
   3| *Confirm user password: |            ********             |
~,V@_s A3aC0   4|      Descrīption:       | The default administration user |51Testing软件测试网:B3qS}kem3U

51Testing软件测试网hX0MW6[/o

第十步:选择启动模式,jdk和存放目录51Testing软件测试网V"YBp&N L%W"rN

51Testing软件测试网"T PJ:V"`D

启动模式,jdk和域文件存放目录的设置比较简单,根据大家的爱好设置就行了。51Testing软件测试网*|+{.{K4n0~
这里启动模式选择生产开发模式,jdk使用jRockit,存放目录默认。51Testing软件测试网2b9aR{)}7Q5j

~+i5_2d!WGrtt)] L0十一步:配置域名称51Testing软件测试网7@U"SGT!Q1p

bsm#S Toj0Edit Domain Information:51Testing软件测试网7F.?-e6o2l6A
------------------------
2f4m-j-eRK4?&eg&L0    |  Name  |  Value   |51Testing软件测试网wZ~zQ6g-ygHl
   _|________|__________|51Testing软件测试网3I0|,M D'i$Z3|
   1| *Name: | mydomain |51Testing软件测试网#X4j3U2@P je
Enter value for "Name" OR [Exit][Previous][Next]> testClusterDomain
Yy4P Oh4I0KWe0设置域的名称为testClusterDomain。51Testing软件测试网~ r_;D3M5@

JS0v2\`F?2G}LPo0十二步:域建立结束51Testing软件测试网 x:xI)J9g;T

51Testing软件测试网:[5Z U!_%x od8V

以上步骤都完成后,系统会自动建立这个域,并会生成一些文件等等,完成的界面如下:51Testing软件测试网(OET3lJZD*]_ w
<----- BEA WebLogic Configuration Wizard --------->
eDic;iG{?#K0Xb0Creating Domain...
w)l2{P{i.B6_00%          25%          50%          75%          100%51Testing软件测试网^XV_rAcpN
[------------|------------|------------|------------]
O;C8D$K @O@}0[***************************************************]
)G BKY#F'{0**** Domain Created Successfully! ****

8v#xRL1vC051Testing软件测试网 Yq%BccH-Z'A&Hx

十三步:在另一台机器上配置节点服务器managed server,配置过程和上面的一样,一定要保证参数和上面所设定的参数是一样的,包括 域名,mServer2的ip 、port ,还有名字一定要和配置第一台机器时保持一致。否则会导致节点服务器不能启动51Testing软件测试网 t1a1NO+\1D,z6|

51Testing软件测试网8r5Z1UW9~(e*u

十四步: 启动管理服务器51Testing软件测试网 bdka M6P(q[

51Testing软件测试网qT i z}g

进入/usr/local/weblogic/weblogic81/user_projects/domains/testClusterDomain/目录51Testing软件测试网\#L!p{zN Pm
键入./startWebLogic.sh51Testing软件测试网3xxv'PVT
启动managed server用如下命令:51Testing软件测试网's%Q YC]"i1~
在10.3.15.85上启动mServer151Testing软件测试网a1gwe9\7zx
./startManagedServer  mServer1  10.3.15.85:7001
x/x%xO:a.Gc Gm@0在10.3.15.84上启动mServer251Testing软件测试网8F(u)w3i.M,F#I"tw h
./startManagedServer  mServer2  10.3.15.85:7001

VLS,Qu VO5N051Testing软件测试网F-r'`S;xb

十五步: 添加代理服务器proxyServer

+q4r B5ts9fXx c)L0

Y9Fj'w@.sd d0启动Administrator Server,然后进入Console控制台(http://10.3.15.85:7001/console/),在此我们将代理Server与Administrator Server置于同一台主机之上。51Testing软件测试网_8a S?!U!f{*?
进入console控制台后,在“Server”结点上单击右键,在弹出菜单上选择“Configure a New Server”,然后配置代理Server的相关信息。(在这里只要指定名称,监听地址,监听端口就可以了)51Testing软件测试网Oa6q3W X[-O

51Testing软件测试网?P!K9^W9PQ

代理服务器的名字是 proxyServer  监听地址: 10.3.15.85  监听端口 8051Testing软件测试网g eC uq6t5V

Z-Rc qMPMK;]0通过HttpClusterServlet实现请求的自动分发处理
|F-^q5ju'Vh0HttpClusterServlet通过一个WebLogic服务器代理对WebLogic集群中的其他服务器成员的HTTP请求, 同时HttpClusterServlet还为代理的HTTP请求提供负载平衡与容错处理。51Testing软件测试网(t'T"B.e-d zQ
实际上实现是很简单的,遵循下面几个步骤就可以轻松实现请求的自动分发功能:
Z8Rm"o6Aw ^6oD#_0? 创建一个代理Server(在此我们称这proxyServer)
nI3UEAh0? 生成配置文件web.xml51Testing软件测试网.yK)VI Cc)Wf
? 生成配置文件weblogic.xml
9e%R,q+R eR#s0? 打包生成Web应用
:]3]8v&QH&xR#]6l0? 在proxyServer上部署应用,并将该应用作为缺省的Web应用51Testing软件测试网+OuE1@:op/i:W
创建代理Server51Testing软件测试网*N y3_.r"l
启动Administrator Server,然后进入Console控制台(http://10.3.15.85:7001/console/),在此我们将代理Server与Administrator Server置于同一台主机之上。51Testing软件测试网%S3Md*RT/E&|B/W
进入console控制台后,在“Server”结点上单击右键,在弹出菜单上选择“Configure a New Server”,然后配置代理Server的相关信息。(在这里只要指定名称,监听地址,监听端口就可以了)51Testing软件测试网2p }4[4k4H2~

*[S:qI$Fb'j,v w0HttpClusterServlet的部署,主要是Servlet的声明和映射,并设置初始化参数,可以创建一个Web App,然后直接在web.xml中添加或在管理控制台上设置HttpClusterServlet的部署信息。最后将它发布给用来做代理的Server,并将这个Web App设置为这个Server的缺省WEB应用。
e0\:s5Rw3_5yl0web.xml文件示例

YS9] }{n0n)y1Z"@!s051Testing软件测试网Ol|.HS

weblogic.xml文件示例51Testing软件测试网$BJ l0]5Ac

#jc6RUm:bl0打包WEB应用51Testing软件测试网`q%E-W&e8Yre
可以使用jar命令将proxy应用打包成war文件,我们建一个临时目录temp,然后在其中建立如下目录结构:

)OF6C6d9d A2A051Testing软件测试网8a3uv#c&i"J.j

使用如下的命令操作,就可完成web应用的打包操作:
4OD'AI0cl)pR0JAR –参数 WEB应用名称 要打包的目录

(oL"rA Dy0

\1d0CHj'}5}GW0当然我们也可以直接部署该目录,而无需打包,这在项目的开发阶段是很有帮助的,便于修改。
M'].Xv-X s0部署proxy应用
+{r-o\a0启动Administrator Server,然后进入Console控制台(http://10.3.15.85:7001/console/),在此我们将代理Server与Administrator Server置于同一台主机之上。51Testing软件测试网JS7A!p9LK9XvXi
进入console控制台后,在“Web Application Modules”结点上单击右键,在弹出菜单上选择“Deploy a new Web Application Module”,然后选择要部署的文件或目录,单击“Target Module”按钮,然后选择“proxyServer”,单击“Continue”按钮,到了下一步,单击“Deploy”按钮,完成部署工作。
D[] Z7H_ i/b0I1A0部署完成后,查看WEB应用的状态是“FAILS”,造成这种情况的原因是“proxyServer”还没有启动,我们可以通过下面的命令启动“proxyServer”:51Testing软件测试网(Bn:^7n8a
./startManagedServer  proxyServer51Testing软件测试网8^/C&E O2s:?j;R&UE
然后点击“ReDeploy”,重新部署应用,状态值将变为“Success”。51Testing软件测试网0[2@TZ(D_0k:^2V
将WEB应用配置成缺省的WEB应用,weblogic8.1与weblogic6.1有很大的不同,8.1不再支持从console控制台完成配置的工作,而是在weblogic.xml中通过下面的结点,完成配置的工作。51Testing软件测试网5I6Gz"B(S([Y
<context-root> / </context-root>

.eFK`-[0

Dj L sFP0测试proxy应用
$I`d4|[0修改web.xml文件,加入下面的结点,然后重启服务。51Testing软件测试网7J\4C;I~u _
<init-param>
ir/j h;I$T0<param-name>DebugConfigInfo</param-name> 
"Gq5r N'V*~_!])w g D0<param-value>ON</param-value>51Testing软件测试网aTAZSqou
</init-param>51Testing软件测试网$@P i:f2yL
打开浏览器,访问下面的地址,会得到下图所示的结果,这就说明你的配置是成功的。51Testing软件测试网2\|2Jku:_^
http://10.3.15.85:8080/placeholder.jsp?__WebLogicBridgeConfig51Testing软件测试网^!B3sm%tt5Z T
myserver为服务地址(在这里是10.3.15.85)51Testing软件测试网a;^2aA(K,Xg J
port为proxy服务的端口(在这里是8080)
2DL*@6L LyE"T:L#q5[0placeholder.jsp(这是一个不存在的JSP文件,您也可以随意指定文件名)
c9] ?4_.P&v+nR0__WebLogicBridgeConfig(这个可千万不能写错呦!)51Testing软件测试网9p bT'm@J

3uM!B?'sq*h:n*S0测试集群的分发功能
q\g nR)DE2~0编写测试WEB应用并部署51Testing软件测试网wW9AFV
我们来编写一个简单的WEB应用,它会在控制台和浏览器上同时打印出“OK”字样,然后将这个WEB应用部署到集群中所有Managed Server上面。(代码见附件)51Testing软件测试网*UCHU3NzS(|5g
在这里我们将通过Apache中所带的ab包来进行并发访问的模拟测试,使用如下的命令就可以完成压力测试。
-]K$Wjm!r0ab –n 100 –c 10http://10.3.15.85:8080/index.jsp51Testing软件测试网)l uU|~s4V
ab是测试程序的名称51Testing软件测试网hy@,c B'uSst
参数n代表请求的总数量51Testing软件测试网\s oH)j-|
参数c代表并发的请求数
@O*Po"w'P`]i0url为要测试压力的页面
:UqLq\5G Cd J0注:使用这个命令时,一定要在系统路径中能够找到该程序,否则不能执行。
m4t+\/H0D0压力测试完成后,我们从Managed Server的控制台上可以看到,mServer1,mServer2都打印出了“OK”字样,这说明,在并发请求的情况下,集群能够将请求进行分发,以达到负载平衡的目的。51Testing软件测试网ha n;t.p[#k
测试应用的目录结构如下,部署与proxy应用的部署一样,要注意的是要将它部署在Managed Server上面。51Testing软件测试网X'y(GA9RU2B7Z/h#z

3T'g`~T7g*|#G#\0可以通过关闭其中的任意一个节点服务器,然后继续发送请求,就会发现虽然有一个节点关闭,但还是很快的得到响应。可以反复的关闭其中的任意一台节点服务器,会发现是同样的效果。这就是一个节点失败后其他节点自动接管服务请求。51Testing软件测试网 ds)S!ws4K|n

8|?2K3s3E9e{{R0同一网段内不同机器部署集群51Testing软件测试网1y$]#K'K}*B#zq-C

Pq^*f:z^*x1J B0在另外一台机器上配置“Managed Server”时,要指定“Admin Server”的名称,监听地址,监听端口。51Testing软件测试网)o^vV2Z$],vn U.Lh

51Testing软件测试网0S%aUM2m6k\

另外要注意的是,“Managed Server”上的配置信息要与“Admin Server”中Cluster所指定的配置信息一致。51Testing软件测试网i"[)I5b!P/elg#seD(i
启动“Managed Server”的命令与上面的一样,如下所示:51Testing软件测试网g2_,\h;T`U/F/d
./startManagedServer  mServer2  10.3.15.85:700151Testing软件测试网 @8ij#KD,~J
     
&tZ5DG*C$Wf0集群配置中要注意的问题
)o#m4`*t;F0 Admin Server只用于集群的管理,而不能参与集群事务。
%m` M1v2SP n)U+d]0 Web应用应该部署到集群上,文件的同步是由WebLogic来完成的。51Testing软件测试网4M oV8Jf2G]z

TAG: Weblogic

 

评分:0

我来说两句

Open Toolbar