WebLogic Server 12c (12.2.1): Configuring Oracle HTTP Server as a Cluster Proxy


Options



Before You Begin

Purpose

In this OBE tutorial, you will configure the WLS proxy plug-in for an Oracle HTTP Server. This proxy is configured to load balance incoming requests to your existing cluster. Finally, you verify proper load balancing and failover by using a supplied JavaEE Web application.

Time to Complete

Approximately 30 minutes

Background

Plug-ins enable WebLogic Server to integrate with applications deployed on Oracle HTTP Server. This includes load balancing HTTP requests across a WebLogic cluster, and automatically failing over failed requests due to a server not being available. These plug-ins also integrate with the HTTP session replication features of WebLogic.

The plug-in for the Oracle HTTP Server proxies requests based on the URL of the request (or a portion of the URL). This is called proxying by path. You can also proxy requests based on the Multipurpose Internet Mail Extensions (MIME) type of the requested file. Alternatively, you can use a combination of the two methods.

What Do You Need? (Optional)

Operating System and Software Requirements
  • A Linux machine with version 6 or greater of Oracle Linux or Red Hat Linux
  • JDK 1.8 update 51 and above
  • Oracle WebLogic Server 12c (12.2.1) software
Prerequisites

You should have completed the HTTP Server 12c (12.2.1): Using the Configuration Wizard tutorial.

Setting the WebLogic Plug-In Enabled Parameter

You must set the WebLogic Plug-In Enabled parameter if the version of the Oracle WebLogic Server instances in the back end is 10.3.4 (or later) release.

Perform the following steps to enable the WebLogic Plug-In Enabled parameter:

  1. Enter http://host01.example.com:7001/console in the browser Location bar and click on the Go to the address in the Location Bar arrow Arrow to access the Oracle WebLogic Server administration console. Log in to the Oracle WebLogic Server administration console using username weblogic and password welcome1.

  2. In the Domain Structure pane, expand the Environment node and click Clusters.

  3. Click on the cluster cluster1 to which you want to proxy requests from Oracle HTTP Server.

    Cluster1
    Description of this image
  4. In the Change Center, click Lock & Edit.

  5. On the Settings for cluster1 page, scroll down to the Advanced section, expand it, select Yes from the WebLogic Plug-In Enabled drop-down list and click Save.

    Specifies if this cluster will receive requests from a proxy plug-in or HttpClusterServlet.
    Description of this image
  6. Click Activate Changes in the Change Center to activate the changes.

  7. Restart the cluster for the change to take effect:

    1. On the Settings for cluster1 page, click Control in the first row of tabs.
    2. On the Settings for cluster1 > Control > Start/Stop tabbed page, multi-select server1 and server2 in the Managed Server Instances in this Cluster table and select Force Shutdown Now in the Shutdown button menu.
    3. Click Yes on the Cluster Life Cycle Assistant page.
    4. "A request has been sent to immediately shut down the selected servers." message gets displayed. Refresh the page to verify the status of the servers.
    5. Once the state of both the servers change to SHUTDOWN, select both the servers again and click Start button in the Managed Server Instances in this Cluster table.
    6. Click Yes on the Cluster Life Cycle Assistant page.
    7. "A request has been sent to the Node Manager to start the selected servers." message gets displayed. Refresh the page until you see that both the servers have their respective state as RUNNING.

Deploying a Web Application to a Cluster

To deploy a web application to the cluster, in order to test the proxy plug-in, perform the following steps:

  1. Download the browsestore.war web application. Place it in a location that is accessible to your WebLogic domain. For example, /home/oracle/Downloads

  2. Enter http://host01.example.com:7001/em in the browser Location bar and click on the Go to the address in the Location Bar arrow Arrow to access the FMW Control. Log in to the FMW Control using username weblogic and password welcome1.

  3. Click on the Deployments tile to navigate to the Deployments page.

  4. In the Change Center, click the Lock & Edit.

  5. Open the Deployment menu and click Deploy.

  6. On the Deploy Java EE Application: Select Archive page, select Archive is on the machine where this Web browser is running. radio button in the Archive or Exploded Directory section and then click Browse to select the application war file from the /home/oracle/Downloads directory. Click Next.

  7. On the Deploy Java EE Application: Select Target page, select the check box corresponding to cluster1 and click Next.

  8. On the Deploy Java EE Application: Application Attributes page, click Next.

  9. On the Deploy Java EE Application: Deployment Settings page, click Deploy.

  10. Click Close in the Deployment Succeeded window.

  11. In the Change Center, click Activate Changes.

  12. Start the application by selecting the application browsestore in the Deployments table, then clicking Start > Servicing all requests from the Control menu.

  13. On the Confirmation window, click Start.

Creating Oracle HTTP Server instance

To create an Oracle HTTP Server instance, perform the following steps:

  1. Open the WebLogic Server Domain menu and select Administration then Create/Delete OHS.

    WebLogic Domain menu
    Description of this image
  2. Click Lock & Edit in the Change Center.
    Change Center
    Description of this image
  3. Click Create on the the OHS Instances page.
    OHS Instances
    Description of this image
  4. On the Create OHS Instance page, enter/select the following values and click OK:
    1. In Instance Name, enter ohs1, a unique name for the Oracle HTTP Server instance.
    2. In Machine Name, click the drop-down control and selectmachine1
    Create OHS Instance
    Description of this image
  5. Click Activate Changes in the Change Center.
    Change Center
    Description of this image
  6. On the OHS Instances page, select the row corresponding to the newly created instance ohs1 and click Start to start the instance.
    OHS Instances
    Description of this image
  7. A confirmation popup window appears showing the confirmation about the instance start process. Click Close once the start operation is successful.
    Confirmation Window
    Description of this image

Configuring the Oracle WebLogic Server Proxy Plug-In Using Fusion Middleware Control

Use Fusion Middleware Control to configure the mod_wl_ohs module. The mod_wl_ohs configuration page contains the parameters for configuring the Oracle WebLogic Server Proxy Plug-In. To configure the mod_wl_ohs module, complete the following tasks:

  1. On the OHS Instances page, click ohs1 link to navigate to the ohs1 instance home page.
    Description of this image
  2. Open the Oracle HTTP Server menu and select Administration and then mod_wl_ohs Configuration.
    Description of this image
  3. Click Lock & Edit in the Change Center.
    Description of this image
  4. On the mod_wl_ohs Configuration page, enter/select the following values and click Apply:
    1. In the General section, select the Provide WebLogic Cluster Details radio button, then click on the magnifying class icon beside the WebLogic Cluster field to search and select the cluster cluster1.
    2. In the Locations section, click Add Row and enter the following values in the newly added row:
      Column Name Value
      Location /browsestore
      WebLogic Cluster host01.example.com:7004,host01.example.com:7003(optional)
      Description of this image
  5. Restart the instance ohs1:

    1. On the ohs1 page, click Shutdown.
      Description of this image
    2. A confirmation window appears, click Shutdown and click Close when the Shutdown operation completes successfully.
      Description of this image
      Description of this image
    3. Back on the ohs1 page, click Start Up.
      Description of this image
    4. A confirmation window appears, click Close when the Start Up operation completes successfully.
      Description of this image
  6. Click Activate Changes in the Change Center.
    Description of this image

Testing a Web Application via Oracle HTTP Server

To validate the plug-in's configuration, perform the following steps:

  1. Direct a browser to the browsestore application, but via the HTTP Server proxy. The default port is 7777:

    http://<host>:7777/browsestore

    In this tutorial, it is:

    http://host01.example.com:7777/browsestore
    browsestore application home page
  2. Locate the Terminal windows from which you started the servers in your WebLogic cluster. Use the output messages to confirm which server the request was directed to:

    serviced request for the welcome page

    If you started these servers with Node Manager instead of from a Terminal window, you will need to view the output log files (<server_name>.out in the server's logs directory).

    For example:

    $ cd /scratch/u01/domains/ohs_domain/servers/server1/logs
    $ ls
    access.log                                owsm
    diagnostic_images                         server1-clickhistory.log
    DMSEventTraceLoggerDestination-event.log  server1-diagnostic.log
    iau                                       server1.log
    metrics                                   server1.out
    oracle.dms.strace-event.log               server1.out00001
    $ vi server1.out
    
  3. Click the Browse Store link in the application. Then select a category check box and click the Retrieve Items button.

    Oracle headquarters buildings
  4. Once again, check which server each of the two prior requests was routed to:

    serviced the request to browse the store
    serviced request to print items
  5. Kill the server that processed the most recent request ("serviced request to print items"). Use either Ctrl + C or the Linux kill command.

    For example:

    $ ps -ef | grep server2
    oracle   16744 16605  0 04:07 pts/7    00:00:00 grep --color=auto server2
    oracle   29473  9363  0 01:04 pts/1    00:00:00 /bin/sh ./startManagedWebLogic.sh server2
    oracle   29520 29474  1 01:04 pts/1    00:02:08 /scratch/jdk1.8.0_60/bin/java -server -Xms256m -Xmx1024m -Dweblogic.Name=server2 -Djava.security.policy=/scratch/u01/app/fmw1221_infra/wlserver/server/lib/weblogic.-javaagent:/scratch/u01/app/fmw1221_infra/wlserver/server/lib/debugpatch-agent.jar -da -Dwls.home=/scratch/u01/app/fmw1221_infra/wlserver/server . . .  
    $ kill -9 29520
    
  6. Return to your Web browser, and use the browsestore application to continue shopping. Select a different category.

    Oracle HTTP Server should avoid the failed server with no interruption to the client.

Want to Learn More?

Credits

  • Lead Curriculum Developers: Tom Eliason, Veerabhadra Rao Putrevu