logo
logo
Leading Independent Middleware Experts

 
Contact Us

+44 08450 539457

info@c2b2.co.uk

 Request a Call Back

C2B2 ARTICLES AND WHITE PAPERS

Below are a number of articles and white papers written by C2B2s staff and associates. To read the full body of one of the articles, click the More link below its synopsis.

 

RSS Feed
Configuring and Testing a WebLogic Cluster

Summary

This article describes how to configure and test a cluster of servers using WebLogic 10.3 and Apache 2.2. The cluster will use in memory HTTP session replication and demonstrate how server failures can be transparent to end users. This article is based on the C2B2 WebLogic 10 System Administrator training please contact us for further information.

1. Introduction

High availability and load balancing underpin most Java Enterprise architectures and deliver the performance, reliability and scalability that businesses require to maintain competiveness and meet customer expectations. Modern application servers such as WebLogic 10 have the capability to automatically migrate services between nodes, monitor their own health and guard against server overload. These advanced features are all underpinned by clusters which we will examine in this article.

 

2. Architecture Overview

A typical WebLogic architecture to deliver web based services is shown below. 

 

Typical Architecture

 

We can see the demilitarized zone (DMZ) employed to add additional perimeter security also containing the Apache load balancing plug-in. The WebLogic cluster is located behind a second firewall typically configured to carefully restrict inbound traffic to certain source and content types.

In this article we will focus on configuring Apache and WebLogic and the diagram below shows the design we will be building.

 

cluster design

 

It comprises:

  • 2 x managed servers called Server1 and Server2
  • 1 x WebLogic machines called VM1
  • 1 x Apache mod_wl plug-in
  • 1 x cluster called example-cluster
  • 1 x domain called base_domain

 The software we will use is:

  • Centos 5.5
  • WebLogic 10.3.3
  • Apache 2.2
  • C2B2 ClusterTest application

If you would like to build this environment yourself see the resources at the end for links to available software.

We assume that you have already:

  1. Installed WebLogic to /home/weblogic on RHEL 5 32bit or similar (e.g. Centos 5)
  2. Installed Apache
  3. Created an administration server on http://wlstrain:7001
  4. Created a managed server called Server1 on machine VM1

In the steps below we will:
  1. Configure Apache to proxy requests to the WebLogic cluster
  2. Create a managed server called Server2 and assign it to machine VM2
  3. Create a cluster called examples-cluster
  4. Configuring Apache

3. Configuration Procedure

3.1 Install the WebLogic Apache Plug-in and configure basic proxying


Before getting into the configuration you might find the following directory locations useful.

 Directory Description
 /etc/httpd/modules Apache Modules
 /var/log/httpd/ Root of log files
 /etc/httpd Root of configuration files

1. Log in as root

2. Install the Apache HTTP Server Plug-In module by copying the mod_wl_22.so file to the Apache modules directory

cd /home/weblogic/Oracle/Middleware/wlserver_10.3/server/plugin/linux/i686

cp mod_wl_22.so /etc/httpd/modules

cd /etc/httpd/modules

chmod 755 mod_wl_22.so

ls –al (check all the permissions on mod_wl_22.so match the other .so files)

 

3. Edit the httpd.conf file

Add at the end of the other module definitions:

LoadModule weblogic_module modules/mod_wl_22.so
 
apache config 1
   

4. Test the configuration

[root@localhost ~]# /usr/sbin/apachectl -t
Syntax OK

 

You should see no errors reported.

5. Start Apache and check you can access the home page

 

/usr/sbin/apachectl start

 Go to http://wlstrain (or localhost if you are accessing locally). You should see the page below.

apache home page

 

6. Check that basic proxying works

Make sure the WebLogic administration server is running and point a browser at http://wlstrain/console.

You should see the administration console because Apache is proxying requests from the standard HTTP port of 80 (not shown) to the default WebLogic administration port of 7001.

admin console

 

3.2. Configure WebLogic and Create a Cluster

Now let's configure WebLogic and create a cluster with two servers: the existing Server1 and a new one called Server2 which we will create.

1. Login to the Administration console at http://wlstrain:7001/console/

 

2. Create a new managed server and cluster

 

Go to Environment --> Servers --> Click New and create a new server using:

 

  • Server Name=Server2
  • Listen Port=8002
  • Cluster Name=examples-cluster

 

Make sure you select 'Yes, create a new cluster for this server'

 

create server 2 first step

Name the cluster example-cluster.

 create server 2 second step

 

Click Finish and view the newly created Server2 as part of example-cluster.

 

 create server 2 third step

To finish off the cluster we need to add Server2 to machine VM1 and Server1 to example-cluster. Let's update the machine first.

 

4.  Updated Machine VM1 configuration and add Server2.

 

Go to Environment --> Machines

 add server to machine

 

Select machine VM1 then the Servers tab.

 add server to machine 2

 Click on Add and select Server2 as below.

 add server to machine 3

Click Next.

 add server to machine 4

 

3. Add Server1 to example-cluster.

 

Go to  Environment --> Clusters 

 

create cluster 1

Click on example-cluster then on the Servers tab. You should see the page below.

 

 create cluster 2

 

 Click Add and select Server1 as below.

 

create cluster 3

 Click Next to complete and view the configuration.

 create cluster 4

Go to Environment --> Clusters to check.

 

 create cluster 5

3.2. Configure Apache to Proxy all JSP Requests and Test

We have proved that the proxy configuration can pass through requests to a single IP address or a all requests we now need to update this to proxy all JSP requests to our newly created cluster.

 

1. Update the httpd.conf

Edit httpd.conf and remove (or comment out) the previous configuration. Add the configuration below. It must be placed below the modules definition.

 

apache config 2


     

 

 2. Start both managed servers : Server1 and Server2. You can either use Node Manager or startup scripts.

 

 3. Install ClusterTest.war and target example-cluster as below.

 

install cluster test

 

 4. Testing

We now have two servers in a cluster proxied through Apache. Let's test and see what happens when one of the servers fails.

First directly to the ClusterTest application on Server 1 at http://wlstrain:8001/ClusterTest/Session.jsp.

 server test 1

 Then we can try Server2 at http://wlstrain:8002/ClusterTest/Session.jsp

 

server test 2

Now we can try the Apache proxy address at http://wlstrain/ClusterTest/Session.jsp.

 cluster test

 

We can now add values into the HTTP Session using the Cluster Test application and watch them being replicated to all servers in the cluster.We can also stop servers and see how that simulated failure is completely transparent to the user.

 

5. Conclusion

In this article we stepped through the configuration of WebLogic and Apache to create a basic cluster which demonstrated how a service can transparently failover from one server to another. However, we have only scratched the surface of the configuration required to build a fast and reliable application infrastructure.

Understanding how clusters operate for EJB clients, how to a configure JDBC multi data source, the pros and cons of in memory versus JDBC state replication and cluster tuning best practices are all aspects which shoudl be considered.

 

6. Further Information

 This article is based on the C2B2 WebLogic 10 Administrator course and if you would like more information please contact us .

 

 

 

 

 

 

Transactions in SOA

This short article looks at options available for implementing transactional behaviour in service oriented systems.

Integrating JBoss with Open DS
A quick "How To" Article describing how to secure the JBoss JMX console using the open source OpenDS LDAP server from Sun.
Introduction to APM

This article from C2B2 consultant Alan Fryer gives you a brief introduction into Application Performance Management and why you should consider it for your future development and production systems.

 

Performance testing open source JMS part 1
This first article in our series on the performance of open source JMS implementations looks at the performance of OpenMQ, JBoss MQ and JBoss Messaging when sending JMS messages to a queue. All three imlpementations have their default configurations tested with a variety of loads, and the performance profiles are examined.
Clustering iPoint with Terracotta
Terracotta provides a method of sharing memory between different JVMs, which makes it great for implementing clustering. The theory is good, and it works well on new applications, but C2B2 wanted to look at how well it would work on an existing, complex application, so we took iPoint portal and deployed it in a cluster using Terracotta.
Next Generation Portlets

Our Director Steve Millidge recently presented at the CMF 2007 conference on Next Generation portals with JSR 286.

You can download the slides here.