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:
-
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 to access the Oracle WebLogic Server administration console. Log in to the Oracle WebLogic Server administration console using usernameweblogic
and passwordwelcome1
. -
In the Domain Structure pane, expand the Environment node and click Clusters.
-
Click on the cluster cluster1 to which you want to proxy requests from Oracle HTTP Server.
-
In the Change Center, click Lock & Edit.
-
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.
-
Click Activate Changes in the Change Center to activate the changes.
-
Restart the cluster for the change to take effect:
- On the Settings for cluster1 page, click Control in the first row of tabs.
- 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.
- Click Yes on the Cluster Life Cycle Assistant page.
- "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.
- 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.
- Click Yes on the Cluster Life Cycle Assistant page.
- "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:
-
Download the browsestore.war web application. Place it in a location that is accessible to your WebLogic domain. For example,
/home/oracle/Downloads
-
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 to access the FMW Control. Log in to the FMW Control using usernameweblogic
and passwordwelcome1
. -
Click on the Deployments tile to navigate to the Deployments page.
-
In the Change Center, click the Lock & Edit.
-
Open the Deployment menu and click Deploy.
-
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. -
On the Deploy Java EE Application: Select Target page, select the check box corresponding to cluster1 and click Next.
-
On the Deploy Java EE Application: Application Attributes page, click Next.
-
On the Deploy Java EE Application: Deployment Settings page, click Deploy.
-
Click Close in the Deployment Succeeded window.
-
In the Change Center, click Activate Changes.
-
Start the application by selecting the application browsestore in the Deployments table, then clicking Start > Servicing all requests from the Control menu.
-
On the Confirmation window, click Start.
Creating Oracle HTTP Server instance
To create an Oracle HTTP Server instance, perform the following steps:
-
Open the WebLogic Server Domain menu and select Administration then Create/Delete OHS.
- Click Lock & Edit in the Change Center.
- Click Create on the the OHS Instances page.
- On the Create OHS Instance
page, enter/select the following values and click
OK:
- In Instance Name, enter
ohs1
, a unique name for the Oracle HTTP Server instance. - In Machine Name, click the
drop-down control and select
machine1
- In Instance Name, enter
- Click Activate Changes in the Change Center.
- On the OHS Instances page, select the row corresponding to the newly created instance ohs1 and click Start to start the instance.
- A confirmation popup window appears showing the confirmation about the instance start process. Click Close once the start operation is successful.
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:
- On the OHS Instances page, click ohs1 link to navigate to the ohs1 instance home page.
- Open the Oracle HTTP Server menu and select Administration and then mod_wl_ohs Configuration.
- Click Lock & Edit in the Change Center.
- On the mod_wl_ohs Configuration
page, enter/select the following values and click
Apply:
- 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
. - 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)
- 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
-
Restart the instance
ohs1
:- On the ohs1 page, click Shutdown.
- A confirmation window appears, click Shutdown and click Close when the Shutdown operation completes successfully.
- Back on the ohs1 page, click Start Up.
- A confirmation window appears, click Close when the Start Up operation completes successfully.
- Click Activate Changes in the Change Center.
Testing a Web Application via Oracle HTTP Server
To validate the plug-in's configuration, perform the following steps:
-
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
-
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
-
Click the Browse Store link in the application. Then select a category check box and click the Retrieve Items button.
-
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
-
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
-
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?
-
For documentation on Oracle WebLogic Server 12c (12.2.1), visit the Oracle WebLogic Server Documentation Library.
-
For more information about Oracle HTTP Server, see the Oracle® Fusion Middleware Administering Oracle HTTP Server
-
To learn more about Oracle WebLogic Server, refer to additional OBEs in the Oracle Learning Library
Credits
- Lead Curriculum Developers: Tom Eliason, Veerabhadra Rao Putrevu