I got chance to work on weblogic clustering last week. I would like to share my experience of creating weblogic cluster with all of you
Environment:
version 9.2.0 should be installed in all managed servers and admin server in the same structure. [That means if bea is installed in c:\bea then bea should installed in all servers in c:\bea. Althoguh it is optional it will useful when enrolling managed servers with admin server]
example illustrates of creating clustered environment with one admin server and two managed servers in windows boxes
weblogic default proxy “HttpClusterServlet” is used as proxy.
CREATING DOMAIN IN ADMIN SERVER
a) Go to Start -- All Programs -- Bea Products -- Tools -- Configuration wizard.
b) Select the option “Create new weblogic domain.” Click “Next” Button.
c) In that window select the option “Generate a domain configured automatically to support the following BEA product” then click next.
d) Setting up administrator user name and password
provide user name and password of your own. In this example let's say user name as “weblogic” and password as “weblogic”. Then click next.
e) Configuring server start mode and JDK
Select “production mode” for “weblogic domain startup mode” and “Bea JRockit” for JDK selection as shown in the below image. [Note: It is recommend by bea to use “Bea JRockit” JDK in production mode for better performance”] . Then click Next
f) Customizing environment and services settings.
This step is to create cluster environment, JDBC,JMS and other services. Select the option “YES” to configure the above mentioned services. [ Note: While creating domains for managed servers, “NO” option should be selected.] Then click next
g) Configure Admin Server
This is to configure the admin server properties such as name, listen address, listen port and enable SSL if required. Provide server name, listen address and port of your own as given in the below image. Then click next.
h) Configuring managed servers
click “add” in the new window to add a new managed server.
Provide managed server name listen address, and port number.
If you want to add more managed servers follow step 1 and 2 to create multiple managed server as required . Then ck
i)Configure cluster
Click “add “ button in the new window and provide cluster name, multi-cast address and multi-cast port values as shown in the below picture. Lets say Cluster name as “base_cluster".Then Click Next.
Note: The multi-cast address is used by cluster members to communicate with each other.
The valid range is from 224.0.0.0 to 239.255.255.255. The default value used by WebLogic Server is 239.192.0.0. You should avoid using multi-cast addresses in the range x.0.0.1.This address should be unique to this cluster and should not be shared by other applications.
j) Assigning Servers to clusters
Select all the Managed server from left panel , and click “Right arrow” to move the managed server to cluster. Then click Next.
k)Configuring Machines
Click "add" button to add new machine and provide the machine name, nodemanager listen address and port number of your own. (Node Manager listen port should same for all the machines. So don't change the port value. let it be 5556). Then click next
l)Assigning servers to machines
Select servers from left panel and corresponding machines on right panel , click right arrow button to asign the server to corresponding machines.
m) Review all configuration
Now verify the configuration done so far in the new window then click next button.
Provide domain_name as "base_domain" then click create button
Once the domain successfully created click on "Done" Button.
Now we have successfully created domain with cluster in admin server.
STEP 2:
CREATING DOMAINS IN ALL MANAGED SERVER
a) Follow the points from “a to f” of step 1 in all manged server to create a domain[with out cluster and other services settings] . The “NO” option should be selected in point "f" of STEP 1.
b) After selecting “No” option, in new window we have to provide “same domain name” as mentioned in Admin Server Domin creation. In our case, domain name is “base_domain”. Then click create.
STEP 3:
STARTING ADMIN SERVER
a) To start admin server,(in admin server machine) go to start → all programs → bea products → userprojects → base_domain → start admin server for weblogic server domin.
b) Give username and password when it asks. In our case it is "Weblogic" and "Weblogic" respectively.
STEP 4:
ENROLLING MACHINES WITH ADMIN SERVER
a) In a managed server , go to Start → All Programs → Bea products → Tools → web logic scripting tool. This state is known as “offline mode” of WLST
b) Run connect() command, it will asks for username, password and admin server URL.
c) The message “ sucessfully connected with admin server “your admin server name” that belongs to domain 'base_domain' ” shows that managed server is connected with admin server.
d) Now run following command to enroll.nmEnroll('C:/bea/user_projects/domains/css_lms_domain','C:/bea/weblogic92/common/nodemanager')
Note: The path should be changed according to local installation of weblogic.
This step should be done in all managed servers.
STEP 5
INSTALLING AND CONFIGURING NODE MANAGER
Node Manager acts as a agent to communicate between admin and all managed servers in a cluster.
Node Manager can be started in a couple of ways.
Running node manager as a windows service
Use WLST tool to start and stop the node manager manually.
But it is recommend to run node manager as a windows services. Do install node manager in all machines including admin server and managed server from the following location. “BEA_HOME\weblogic92\server\bin\installNodeMgrSvc.cmd”
After successful installation of node manager,
These steps should be done in all managed servers and admin server to install node manager to install node manager .
STEP 6:
STARTING MANAGED SERVERS THROGH ADMIN CONSOLE.
Manged servers can be started in several ways. The simplest way is to use the admin server web console .
htpp://adminserver-ip:portno/console will start the admin server console.
Provide username and password to log in to console.
In Admin console do the following,
a) click environment → servers on the left pane. It will show all the managed server and admin server in the domain.
b) To verify node mangers are active in all managed servers, select environment → machines. Then click corresponding machine name. After that click on “monitoring tab”. The status should be “reachable” . Check this one for all the available machines.
c) To start managed servers select managed server → control → start. The server will be started with in couple of minutes. This should be followed for all managed server.
d)
The State for all the servers should be "Running"
STEP 7:
CREATING “HttpClusterServlet” PROXY
creating web-application structure
i) Create folder “ HttpClusterServlet”. With in the folder create sub-folder “WEB-INF”.
ii) In WEB-INF folder create followings
web.xml,
weblogic.xml
lib folder
classes folders.
the ip address in “WebLogicCluster init-param” in the below given “sample web.xml” and paste in your web.xml
Sample web.xml
===========
//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
weblogic.servlet.proxy.HttpClusterServlet
Copy and paste the following in your weblogic.xml
810-web-jar.dtd">
b) Copy weblogic.jar from your BEA_HOME\\weblogic92\server\lib toWEB-INF\lib folder.
c) Create a .war file using following command from location of 'HttpClusterServlet' folder
jar -cvf HttpClusterProxy.war *
STEP 9:
IV) CREATING PROXY SERVER TO DEPLOY HTTPPROXYSERVLET:
1) Click lock and edit button on left pane
a) Go to environment – servers --- and then click new button to create new server
b) Provide server name, server listen port and select the option “No this is a stand-alone server”. Click next and then finish.
You can use admin server address for proxy server also. Lets say server name as "proxy_server", listen port as 8001.
Click the newly added server in our case, “Proxy_Server”, and select the machine as “Admin_Machine” from “General” tab.
Now Click “Save” Button and then click “Activate Changes”.
To start newly added Proxy_Server click on Proxy_Server --- control -- start. Now Proxy_Server will start.
2) Deploying HttpClusterProxy.war file in "Proxy_Server"
a) Click “Deployment” option on left panel.
b) Click on lock and edit
c) Click on install button.
d) Click on upload your file(s) link.
e) Select the HttpClusterProxy.war by click browse button then click next
f) Select the option “HttpClusterProxy.war” from the list of available application and then click next
h) Select the option “Install this deployment as an application”
i) Select the option “Proxy_Server” for deployment target. Then click next
j) In next window select the option “DD Only: Use only roles and policies that are defined in the deployment descriptors.” for “Security” and “Use the defaults defined by the deployment's targets” for “Source Accessibility”then click “next” and then “finish”
k) Click on “Save” Button and then “Activate changes” button.
3) Starting HttpClusterProxy.war application
a) Click on “lock & edit” button
b) Select “Deploymnets” option from left pane.
c) Select the check box corresponding to “ HttpClusterProxy” then click “Install” Button
d) Now application state will be changed to “active” from “Prepared”.
Now we have successfully created Proxy_Server and deployed the “HttpClusterServlet” using “HttpClusterProxy.war”.
Now configure JDBC,JMS or any other configuration required for your application then deploy the application in “Adminserver and Manged Servers” alone not in “Proxy_Server”.
Test your application in browser using “http://proxyserver:port/your_application
Testing fail-over:
You can test the fail-over by randomly starting and stopping managed servers through admin console while running the application.
No comments:
Post a Comment