Linux下配置WebLogic Server集群

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

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

/c pQ4KL5}#^0目的51Testing软件测试网5t MTU+gKZoL$x*Sl

f:Gu"b"yLQC o0本文讲述如何在WebLogic Server 8.1上配置集群,以及通过Proxy Server来访问集群,可以参照这个文档进行linux下weblogic群集的配置,群集启动和节点启动,发布应用,同步应用,session的复制共享,测试应用的自动分发功能,自动接管功能。51Testing软件测试网{#g2c6j$KxGq(|
预备知识
EwY7^i\d*Z?l0什么是Domain和Server51Testing软件测试网Qj`;X*]W"EH^8lx
Domain51Testing软件测试网,i2K_ `]%W
Domain是WebLogic Server实例的基本管理单元。所谓Domain就是,由配置为Administrator Server的WebLogic Server实例管理的逻辑单元,这个单元是有所有相关资源的集合。
U2_ pPU8Z$y0Server51Testing软件测试网]\o0KM7D~
Server是一个相对独立的,为实现某些特定功能而结合在一起的单元。51Testing软件测试网&JKm G/?D y"^Sz
Domain and Server的关系
{LM)i:r2EA|2D0一个Domain 可以包含一个或多个WebLogic Server实例,甚至是Server集群。一个Domain中有一个且只能有一个Server 担任管理Server的功能,其它的Server具体实现一个特定的逻辑功能。
xo"w d O0本文环境51Testing软件测试网a1R?8Te{^
? 平台:Linux as 4
X)Od B d5~,BY0? 软件:Bea WebLogic Server 8.1 SP5
"`8v)? N1X] s0配置WebLogic Server集群
[,x P3zB@P!eu7b5P0WebLogic集群的体系结构51Testing软件测试网-^K'xCG+];V
单层混合型的集群架构(Cluster)
[%`8vIG2|S[m0这种架构将所有的Web应用以及相关的服务应用全部置于集群中的单一WLS实例中,这种架构的优势在于:
Ji'ni4X7B^6b:`0? 易于管理51Testing软件测试网9?a?R$J6G _ r v;T
? 灵活的负载平衡机制51Testing软件测试网P|{N`ED/U|L
? 更强的安全控制51Testing软件测试网)i)jK [/x-C:H

'q~4v)i9b0多层结构的集群架构(Cluster)
1[Md5P3r.b!B!e6{B/] A0这种架构使用两个WLS集群,一个放置表静态内容和集群Servlet,另一个放置集群EJB。一般应用于下面这些情况:51Testing软件测试网1qfzd7J @F$V-n
? 在负载平衡机制需要调用集群EJB中的方法时;
g)k(@2QV)F a0? 在提供内容与提供对象的服务之间需要更大的机动性时;
s o:W-V3FV_#z a o3]9O0? 在需要更高的系统稳定性时;51Testing软件测试网P0d a^.}gy{

51Testing软件测试网!R6M"Vz\)L$v4A5Y

51Testing软件测试网/|.u5N+mhkU
配置集群应用的必要条件51Testing软件测试网9e.lMF/k9H {
? 集群中的所有Server必须位于同一网段,并且必须是IP广播(UDP)可到达的
,\1U8c#I(qp"^0? 集群中的所有Server必须使用相同的版本,包括Service Pack
.}/cG'n_%P*L0? 集群中的Server必须使用永久的静态IP地址。动态IP地址分配不能用于集群环境。如果服务器位于防火墙后面,而客户机位于防火墙外面,那么服务器必须有公共的静态IP地址,只有这样,客户端才能访问服务器51Testing软件测试网?YR z?#Ij
? 要以CLUSTER方式运行,必须有包含CLUSTER许可的LICENSE才行(从Bea网站上下载的试用版本就可以进行Cluster配置)51Testing软件测试网*O8lRS6w }H

51Testing软件测试网FxO4hS

配置前的准备工作
urGM1bX^0在配置集群应用前要对集群的配置信息有一个良好的设计,下面就是我们这次配置的集群信息:
,G_8RTK m v b0在同一网段内的不同机器上配置集群,以下是以2台机器做群集,
2N)F X^6RY{i0机器类型 操作系统 硬件配置 角色 备注51Testing软件测试网FN"y3AeK
普通 PC Linux as 4 IP:10.3.15.85 PORT:7001 Administrator Server Pc1
Hlgzt"L0普通 PC Linux as 4 IP: 10.3.15.85 PORT:80 Proxy Server Pc1
-V t%v i Db,X2HUP0普通 PC Linux as 4 IP: 10.3.15.85 PORT:7080 Managed Server Pc1
f6pz9H)m2`J"i0普通 PC Linux as 4 IP: 10.3.15.84 PORT:7080 Managed Server Pc2

u4}H9\ V;T?/u%O]Cq0

~'\2}P-? z0使用Domain Configuration Wizard进行配置
Me!w H]0创建新的Domain
,n[U5mj h6a0第一步:51Testing软件测试网BkF k w(P
进入到weblogic安装目下的 /usr/local/wblogic/webloic81/common/bin下面执行 ./config.sh 启动域配置程序51Testing软件测试网&y+Q;Q!j|{,B/^

0?6k*gmpQn(D9p0Tym0<----------------------------------------------- BEA WebLogic Configuration Wizard ----------------------------------------------->

|p$p T3WK2Y[0

.wJ:~z*w%g6[`0Create or Extend a Configuration:51Testing软件测试网T-E laOf:G
---------------------------------

(x}^#yL051Testing软件测试网,A7d PSL#S#dD$O

Choose between creating and extending a configuration. Based on your selection, the Configuration Wizard guides you through the
O N}C,UIFq [K0steps to generate a new or extend an existing configuration.

AJ ]E2X2l2\3^051Testing软件测试网(`C6sx:d5S%D+I3O

->1|Create a new WebLogic configuration51Testing软件测试网z9DErT)vP
    |    Start here to create a WebLogic configuration in your projects directory.51Testing软件测试网4MDZZ7woB.z9H7f

51Testing软件测试网%KY7jZ!U0x`]H

   2|Extend an existing WebLogic configuration51Testing软件测试网N:Pd;L| bA
    |    Start here to extend an existing WebLogic configuration.  Use this option to add applications and services, including51Testing软件测试网O i({t JP i
    |Database access (JDBC) and Messaging (JMS). This option also enables you to extend functionality by enabling WebLogic
_v%lfAr+MT0    |Workshop.51Testing软件测试网)g,P2h:a;f VS

51Testing软件测试网 c1Z:Qu"`?

Enter index number to select OR [Exit][Next]> [root@localhost bin]# 151Testing软件测试网l3G?\mjE*h

51Testing软件测试网1G$]UbQl$TV1Z+VM

第二步:选择模版51Testing软件测试网 Yo"o/q/N,_5o
系统提示选择一个建立域的模版,资料上讲配置向导的配置过程可以另存为模版,以便下次配置的时候使用,没试过下次回去试试。
1k D!}2HI0<----------------------------------------------- BEA WebLogic Configuration Wizard ----------------------------------------------->51Testing软件测试网+F6uH d6?$R

51Testing软件测试网.}F0LZL)O

Select a Domain Template:51Testing软件测试网K.qs m b%]1`C q6Z
-------------------------51Testing软件测试网g o*lB ^~4mAj`

51Testing软件测试网-h.SiQ!Wb y!p]

Please select a template from the list or select another directory of templates.51Testing软件测试网 r%H Of\iY X

6f}UP(P0    * [/usr/local/weblogic/weblogic81/common/templates/domains]

2PTJ0N'bj0P0

NMx I$A9He0   1|WebLogic Server Examples Domain 8.1.5.051Testing软件测试网[6w&jfN
    |  BEA Systems, Inc.
h @h"`M1q6a+~$b0    |  Create the WebLogic Server Examples domain in a directory outside of the installed kit.  The Examples domain contains a
n;DR&e3[+]"z0    |collection of examples to show best practices for coding individual J2EE APIs.

n${1E8OrJ6v051Testing软件测试网;HuMm}h,a'z%D

   2|Basic WebLogic Workshop Domain 8.1.5.051Testing软件测试网8[Q.FC @@ugfY%[-D
    |  BEA Systems, Inc.51Testing软件测试网oD9A^P~O
    |  Create a basic WebLogic Workshop domain, without installing sample applications.   Domains created from this template will
|_j:E)Y+z,WT4_np0    |support the WebLogic Server and WebLogic Workshop runtime functionality, including support for J2EE applications, Web
a}R5FM V0    |applications, Web Services and custom controls.  Use domains created from this template for development of WebLogic Workshop51Testing软件测试网lNjVT8Z(NE TZ!X
    |applications.51Testing软件测试网3cE"u}#O VD

+aC3fAoxu [0->3|Basic WebLogic Server Domain 8.1.5.0
V9~A;]7xa&h0    |  BEA Systems, Inc.51Testing软件测试网JP)V0k"e'`C
    |  Create a basic WebLogic Server domain without installing sample applications.

/A_ o VW051Testing软件测试网MYy#HTbu

   4|Avitek Medical Records Sample Domain 8.1.5.051Testing软件测试网m6E)Gh.^ P7b
    |  BEA Systems, Inc.51Testing软件测试网 ^W;X6h#[?r$C
    |  Create the Avitek Medical Records domain in a directory outside of the installed kit.  The Avitek Medical Records is a
T!N } `o1r&C0    |WebLogic Server sample application suite that concisely demonstrates all aspects of the J2EE platform.51Testing软件测试网L[u]_ qH@9gK

5GPiK?,W0   5|Select another directory location

W w FsPz|051Testing软件测试网pK!s!DKaO"RQ*r;h

Enter index number to select OR [Exit][Previous][Next]> 3
P6@(zz4RW0这里我们选择3,使用基础的模版

:f xt.\-K%A051Testing软件测试网1s\.x p3l_T

第三步:是否以快速模式进行

0vOIE*J)cNa0

_ y QJ];n I8_0第三步系统提示是否以快速模式进行配置,这里选择2。51Testing软件测试网 I(~/z4bz5HbA#bS#U d

J2J pb/S(c$v6Bz0<----------------------------------------------- BEA WebLogic Configuration Wizard ----------------------------------------------->
?*cH+q.R0Choose Configuration Option:51Testing软件测试网 {.J @g"^`%SY0e"j3D%n
----------------------------51Testing软件测试网[,j1gDq VB:J
    *Do you want to run the wizard in express mode?51Testing软件测试网oA H/XSq F+a
->1|Yes51Testing软件测试网 c&]u&Y;YXHcF UO
   2|No
9Q*@Bd~8L \0Enter index number to select OR [Exit][Previous][Next]> 2

J/HW^([A0

S yT x*p2op0第四步:配置管理服务器51Testing软件测试网7a&rlt2~+Y3E5h

(J i$wV rf sDV0现在系统提示我们配置管理服务器,把管理服务器的名字改一下,改成adminServer就可以了。

0ijuaRa v A051Testing软件测试网B.r,@*z^'k6rU

<------- BEA WebLogic Configuration Wizard -------->
tx`(D!I0u(G0Configure the Administration Server:
k(Y*~6QT C,o!c?0------------------------------------
-E'HN/W5}*W0Enter adminstration server configurations. Each WebLogic Server domain must have one Administration Server. The51Testing软件测试网b3} | i1k*\
Administration Server hosts the Administration Console which is used to perform administrative tasks.51Testing软件测试网^2ZbK+XeRb
    |       Name       |        Value        |51Testing软件测试网M2V+V6g-T|
   _|__________________|_____________________|
kk;[CB2F(H FrJv0   1|      *Name:      |      myserver       |51Testing软件测试网!@X j?3E&`e
   2| Listen address:  | All Local Addresses |
6]4\ZLY#w)gx&s"IZ0   3|   Listen port:   |        7001         |
L \#QP4sz$~0   4| SSL listen port: |         N/A         |51Testing软件测试网 A2cF b3}
   5|   SSL enabled:   |        false        |51Testing软件测试网(K([-n1do?k:cDi
Select Option:51Testing软件测试网x0O3]\^
    1 - Modify "Name"
0HW*k-w3?K nw0    2 - Modify "Listen address"
O1D@ |:p3QVf$y0    3 - Modify "Listen port"
/r!@ wJ%_c0    4 - Modify "SSL enabled"51Testing软件测试网R(Pklmkr8_^2F
Enter option number to select OR [Exit][Previous][Next]> 1
)U ],[;Tswn0输入1之后,根据系统提示输入新的管理服务器的名称adminServer51Testing软件测试网P~8h"BS-[2V

X O.g'Vl)t.F0第五步:配置被管服务器51Testing软件测试网~s1mt8C J/s

51Testing软件测试网V p7M8VdFJ0CB)r.i&H

根据下面系统的提示,配置被管服务器51Testing软件测试网4T](@P%A[I D5S

9rkLiYT4{r!@0<----------------------------------------------- BEA WebLogic Configuration Wizard ----------------------------------------------->
'IBWp;n5B0Choose Configuration Option:
H#kFd:kDCvO*z0----------------------------
1t F-}6S:l0    *Do you want to configure Managed Servers, Clusters and Machines?
7ca6[t1?&DO*U#s{0->1|Yes51Testing软件测试网 m(bj8I)?:y&I1n:A@
   2|No
h@;oAk0Enter index number to select OR [Exit][Previous][Next]> 151Testing软件测试网0Fbl Jv/_"cV

51Testing软件测试网A@#@$nz1S:j(Wj/O

根据提示配置如下信息:51Testing软件测试网3x1{,i*?"@!kx\M
<----------------------------------------------- BEA WebLogic Configuration Wizard ----------------------------------------------->51Testing软件测试网8A[p5ga@&sU1E
Configure Managed Servers:51Testing软件测试网0q+sU[*| y-Q;C
--------------------------51Testing软件测试网+He I9_Meg7]
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.51Testing软件测试网?.~$e#y/X|X

4EAZ4RWy0    |  Name*   | Listen address | Listen port | SSL listen port | SSL enabled |
nEPr.GB0   _|__________|________________|_____________|_________________|_____________|
hou2}%[Y)U5Y5z0   1| mServer1 |   10.3.15.85   |    7080     |       N/A       |    false    |51Testing软件测试网 h2Czq)QI*]r AI
->2| mServer2 |   10.3.15.84   |    7080     |       N/A       |    false    |51Testing软件测试网"T,w'PY7W`.l

%W,v&fR&A0然后执行下一步51Testing软件测试网1q7^I#^9C6o&GWW#{ S

51Testing软件测试网:Z%LV4}9u*O8v#o

第六步:配置集群

U~-st(V0

vX.H#i;x5q-J0<----BEA WebLogic Configuration Wizard ------>51Testing软件测试网tL:^-jM+pT
Configure Clusters:51Testing软件测试网0b4q,Y2E"XX
-------------------51Testing软件测试网:\fw%gN
A cluster contains multiple WebLogic Server instances (servers) that run simultaneously and work together to provide51Testing软件测试网gx9[t1A%Q!y,m4T
increased scalability and reliability.  A cluster appears to be a single WebLogic Server instance to clients.51Testing软件测试网v[\*w(r9S.}u7Px!u
    | Name* | Multicast address | Multicast port | Cluster address |
m AA;?7yB0   _|_______|___________________|________________|_________________|
_q/?6~0z9?K2i0Enter name for a new Cluster OR [Exit][Previous][Next]> testCluster51Testing软件测试网2k!_.a7GaPyy
输入集群的名字testCluster,其他的默认就行了,配置完成后如下:
2n)Yg[v&h0    |    Name*    | Multicast address | Multicast port | Cluster address |
8Q4W,u^R3}M0   _|_____________|___________________|________________|_________________|
n:NV,r \~Uh0->1| testCluster |     237.0.0.1     |      7777      |                 |

\1]*DJAcUu051Testing软件测试网 FcV"Bm^ b*K1}

第七步:将服务器组织到集群中51Testing软件测试网#Lk?^)f1~ J

{S;iJ*iMa0vQ;\0根据系统的提示,将mServer1和mServer2放入集群testCluster中去,配置完成后如下:51Testing软件测试网5vA5[b9o
    Cluster
NCL?x0    |_____testCluster [1]51Testing软件测试网v^ }t7c
         |_____mServer151Testing软件测试网$W c9y V~2eq
         |_____mServer2

K DO_:o0

,Q B5m#L+D~0T T(I0第八步:配置机器、jdbc、jms、安全等51Testing软件测试网 ?#p7t$A7qT8h

51Testing软件测试网 p*f!t;^1L S Wy

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

%R0O$xcv'A1yb*H'~0

n Q(h]mP0第九步:输入管理服务器的用户名和密码51Testing软件测试网+c @Bj{-n.TV

51Testing软件测试网M5n lM'cB

系统提示如下画面,可以配置管理服务器的用户名和密码:51Testing软件测试网-Kx |;mY9xh0t%[
    |          Name           |              Value              |51Testing软件测试网$ruEFS%@G9D6]`
   _|_________________________|_________________________________|51Testing软件测试网aJ,h/vzq1N
   1|       *User name:       |            weblogic             |
/_%\m(T Xy(}*D.G ZpR0   2|     *User password:     |            ********             |
(bKN/?'D/Kt0   3| *Confirm user password: |            ********             |
#` l3g9g aJ"Xn&\"s V0   4|      Descrīption:       | The default administration user |51Testing软件测试网w k9S3S:SU

51Testing软件测试网 E-TY{2O!}7h.NbV

第十步:选择启动模式,jdk和存放目录

_2[\kO&X051Testing软件测试网X~M%Unb

启动模式,jdk和域文件存放目录的设置比较简单,根据大家的爱好设置就行了。
;zy%s0k}$v.s5u o0这里启动模式选择生产开发模式,jdk使用jRockit,存放目录默认。51Testing软件测试网O-@~"yN-DV

W!n?nF [}9|"m0十一步:配置域名称51Testing软件测试网.t)F*P`%w.Ibur

I3F)ly C!aN/l7r0Edit Domain Information:51Testing软件测试网vAI7U4Z
------------------------
Equ"b,bP+ta&V0    |  Name  |  Value   |51Testing软件测试网l Swa0s&G
   _|________|__________|51Testing软件测试网 A$[_'J-Bd
   1| *Name: | mydomain |51Testing软件测试网1p^m.@C[J+S+{eN
Enter value for "Name" OR [Exit][Previous][Next]> testClusterDomain51Testing软件测试网'Y/wvQ9t$`i dJ
设置域的名称为testClusterDomain。

{)R??2Dy Nl G*j;c,m m051Testing软件测试网7MiK6A y0z@

十二步:域建立结束51Testing软件测试网%bk,?%z.f[K

*qKR!V a f kGTV,`0以上步骤都完成后,系统会自动建立这个域,并会生成一些文件等等,完成的界面如下:
z)b"IS(V? c8MT0<----- BEA WebLogic Configuration Wizard --------->
}{)zF!VT0Creating Domain...51Testing软件测试网:AP u-RI2u4C*jap
0%          25%          50%          75%          100%
-?+P1c7eJ?Hb0[------------|------------|------------|------------]
3R~pKG,Ee&] @0[***************************************************]
Zi4H0Ue&f$V\Q-H0**** Domain Created Successfully! ****51Testing软件测试网J*S W_CF@

51Testing软件测试网uX/l~\b%o ABQ/u

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

51Testing软件测试网!I8F5^9aD

十四步: 启动管理服务器51Testing软件测试网t$HEu7p%{-X ^(F

4r F,S#^NRU_0进入/usr/local/weblogic/weblogic81/user_projects/domains/testClusterDomain/目录51Testing软件测试网NS,X4x1^"n
键入./startWebLogic.sh51Testing软件测试网I*_z3gL?n
启动managed server用如下命令:51Testing软件测试网]R8|xu-}E-G
在10.3.15.85上启动mServer1
N Q Oy'w _s"`t(M0./startManagedServer  mServer1  10.3.15.85:7001
%Ep0o EK|Kh0在10.3.15.84上启动mServer251Testing软件测试网7X.v!o)?m(?k5c8v3L%W
./startManagedServer  mServer2  10.3.15.85:7001

2IJeW-xIE051Testing软件测试网 u8\Hx:i+Jh

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

.GQ4l o?n_*g3D0

7G uoYxM,H9xY0启动Administrator Server,然后进入Console控制台(http://10.3.15.85:7001/console/),在此我们将代理Server与Administrator Server置于同一台主机之上。
A&fB2P2O4U)|6p0进入console控制台后,在“Server”结点上单击右键,在弹出菜单上选择“Configure a New Server”,然后配置代理Server的相关信息。(在这里只要指定名称,监听地址,监听端口就可以了)51Testing软件测试网^]:C^[{ zf1k }

51Testing软件测试网1fE[o?q

代理服务器的名字是 proxyServer  监听地址: 10.3.15.85  监听端口 8051Testing软件测试网k\1g#UY7O

mb/B.A E dSE2g)j^s0通过HttpClusterServlet实现请求的自动分发处理
x"m-Yf"H(CY0HttpClusterServlet通过一个WebLogic服务器代理对WebLogic集群中的其他服务器成员的HTTP请求, 同时HttpClusterServlet还为代理的HTTP请求提供负载平衡与容错处理。
#An4KON*_$I2mI5Hp0实际上实现是很简单的,遵循下面几个步骤就可以轻松实现请求的自动分发功能:
\Bc'Zu3M0O+@!a+W5_0? 创建一个代理Server(在此我们称这proxyServer)
Ix(G$Q1H R0? 生成配置文件web.xml51Testing软件测试网;MsE*V&u
? 生成配置文件weblogic.xml51Testing软件测试网 u{a#Sc:s7J2T
? 打包生成Web应用
ok)vx5h/f]n0? 在proxyServer上部署应用,并将该应用作为缺省的Web应用
BYP dh!m0创建代理Server
&O8lb1U$p9a0启动Administrator Server,然后进入Console控制台(http://10.3.15.85:7001/console/),在此我们将代理Server与Administrator Server置于同一台主机之上。51Testing软件测试网I8] vKm2m#b9|Kx'B
进入console控制台后,在“Server”结点上单击右键,在弹出菜单上选择“Configure a New Server”,然后配置代理Server的相关信息。(在这里只要指定名称,监听地址,监听端口就可以了)51Testing软件测试网0t'^:{l|_ q

51Testing软件测试网,fy({+mYpN8d5d

HttpClusterServlet的部署,主要是Servlet的声明和映射,并设置初始化参数,可以创建一个Web App,然后直接在web.xml中添加或在管理控制台上设置HttpClusterServlet的部署信息。最后将它发布给用来做代理的Server,并将这个Web App设置为这个Server的缺省WEB应用。51Testing软件测试网m5{ l6F Q db0Q(e8~
web.xml文件示例

$Q`*P+b)YQ0

EEp!^'y#SQc;d@0weblogic.xml文件示例51Testing软件测试网;^?DUzZiDM

51Testing软件测试网,N-H+H;w O3o} M,N] m

打包WEB应用51Testing软件测试网` t/Bc-Z
可以使用jar命令将proxy应用打包成war文件,我们建一个临时目录temp,然后在其中建立如下目录结构:

rMS0x8uh051Testing软件测试网 ZXCg;Rb)H` Ul

使用如下的命令操作,就可完成web应用的打包操作:51Testing软件测试网} NWtU4PKCXy
JAR –参数 WEB应用名称 要打包的目录51Testing软件测试网+]fc4]M@'k!W2@2L

3X }3h;A(x C9uNs3A9e!M0当然我们也可以直接部署该目录,而无需打包,这在项目的开发阶段是很有帮助的,便于修改。51Testing软件测试网1rEv-[$K!J9@3`
部署proxy应用51Testing软件测试网mrhVt#v)O V
启动Administrator Server,然后进入Console控制台(http://10.3.15.85:7001/console/),在此我们将代理Server与Administrator Server置于同一台主机之上。
-M/DjtX cE0进入console控制台后,在“Web Application Modules”结点上单击右键,在弹出菜单上选择“Deploy a new Web Application Module”,然后选择要部署的文件或目录,单击“Target Module”按钮,然后选择“proxyServer”,单击“Continue”按钮,到了下一步,单击“Deploy”按钮,完成部署工作。
5d$m.DsVE O0部署完成后,查看WEB应用的状态是“FAILS”,造成这种情况的原因是“proxyServer”还没有启动,我们可以通过下面的命令启动“proxyServer”:
[2\ ['Yx0./startManagedServer  proxyServer
aa k~3Ya;G0然后点击“ReDeploy”,重新部署应用,状态值将变为“Success”。
j"v S/u6]6k-D2g@0将WEB应用配置成缺省的WEB应用,weblogic8.1与weblogic6.1有很大的不同,8.1不再支持从console控制台完成配置的工作,而是在weblogic.xml中通过下面的结点,完成配置的工作。
`.f:VY$IR1Q$hp'j0<context-root> / </context-root>51Testing软件测试网-i Em?$u/DZ(w:Y

db"] i3m6M0测试proxy应用
$z{Y-y'J~"}Lg0修改web.xml文件,加入下面的结点,然后重启服务。
,{6cA/`p'm0<init-param>
*Pk:v7`u-l.q0<param-name>DebugConfigInfo</param-name> 
[qu(m4U0<param-value>ON</param-value>
Sca:{#gJ"E4ahA"Z'm0</init-param>51Testing软件测试网3L#g5ze"I?+tT5hy
打开浏览器,访问下面的地址,会得到下图所示的结果,这就说明你的配置是成功的。
l h4u!qK0http://10.3.15.85:8080/placeholder.jsp?__WebLogicBridgeConfig51Testing软件测试网'g Rj[3S+Zr1v
myserver为服务地址(在这里是10.3.15.85)
B0NL5N-x0port为proxy服务的端口(在这里是8080)
[w;v b/Q0placeholder.jsp(这是一个不存在的JSP文件,您也可以随意指定文件名)
2~~xrAu(A;UQ0__WebLogicBridgeConfig(这个可千万不能写错呦!)

NX0P0t vO7`0

3}#?,kA.U)r4]0测试集群的分发功能
)?z!Gft{.r0编写测试WEB应用并部署
!e f\q(bi6p0我们来编写一个简单的WEB应用,它会在控制台和浏览器上同时打印出“OK”字样,然后将这个WEB应用部署到集群中所有Managed Server上面。(代码见附件)51Testing软件测试网? p R;c[2K$v8or
在这里我们将通过Apache中所带的ab包来进行并发访问的模拟测试,使用如下的命令就可以完成压力测试。51Testing软件测试网;\+?}@/@f*Z
ab –n 100 –c 10http://10.3.15.85:8080/index.jsp51Testing软件测试网A&u/BT8c"f0F Q J
ab是测试程序的名称51Testing软件测试网5~Fha_&@J n
参数n代表请求的总数量
2o"OK,W TG9@0参数c代表并发的请求数
\hN6BC rE:V!n }0url为要测试压力的页面
tamHlu&J0注:使用这个命令时,一定要在系统路径中能够找到该程序,否则不能执行。
l1Nl,~-|I[%K0压力测试完成后,我们从Managed Server的控制台上可以看到,mServer1,mServer2都打印出了“OK”字样,这说明,在并发请求的情况下,集群能够将请求进行分发,以达到负载平衡的目的。
7HaD7uM*FbR0测试应用的目录结构如下,部署与proxy应用的部署一样,要注意的是要将它部署在Managed Server上面。51Testing软件测试网1N ^ Zv:p/D[t

"][,G?6}6A]!W4S1nW$Z0可以通过关闭其中的任意一个节点服务器,然后继续发送请求,就会发现虽然有一个节点关闭,但还是很快的得到响应。可以反复的关闭其中的任意一台节点服务器,会发现是同样的效果。这就是一个节点失败后其他节点自动接管服务请求。51Testing软件测试网$@$[IA },`6va

OS5@w*lz/R0同一网段内不同机器部署集群51Testing软件测试网+Gyg7Elp

51Testing软件测试网v(tp:e0K4Z{

在另外一台机器上配置“Managed Server”时,要指定“Admin Server”的名称,监听地址,监听端口。

U'?1I8`|?0

sH3n2d#dLC&p~0另外要注意的是,“Managed Server”上的配置信息要与“Admin Server”中Cluster所指定的配置信息一致。
EL$a*]:Is+Y/I"ps8d&H0启动“Managed Server”的命令与上面的一样,如下所示:
Ft.]'?W7j,z0./startManagedServer  mServer2  10.3.15.85:7001
Ps&r*E6~LI#[aZn0     
!D/f4]\}L+?"^z([0集群配置中要注意的问题
"fTTs5i}-q2Bn/Z0 Admin Server只用于集群的管理,而不能参与集群事务。
1Tz/L(L%W2Q*V:B}0 Web应用应该部署到集群上,文件的同步是由WebLogic来完成的。

4U-m~\|+b,h!i0

TAG: Weblogic

 

评分:0

我来说两句

Open Toolbar