5.0

22 vFabric Web Server
22
Configuring vFabric Web Server
Instances
4. Optional. If you want to enable the balancer manager Web application to watch the load balancing activity and control the
behavior, add the following to the httpd.conf configuration file of your vFabric Web Server instance:
<Location /balancer-manager>
SetHandler balancer-manager
Order Deny,Allow
Deny from all
# BE VERY RESTRICTIVE with YOUR ALLOW STATEMENT
Allow from 127.0.0.1
</Location>
5. Optional. If you want to enable sticky sessions, follow these steps:
a. In the httpd.conf file of the vFabric Web Server instance, update the ProxySet directive of the <Proxy>
element you configured in a preceding step by adding the stickysession=JSESSIONID|jsessionid
parameter. This parameter configures the cookie/path that will be used for stickiness. For example (update shown in
bold):
<Proxy balancer://my-balancer>
BalancerMember http://192.168.0.203:8081 route=instanceOne loadfactor=1
BalancerMember http://192.168.0.203:8082 route=instanceTwo loadfactor=1
ProxySet lbmethod=byrequests stickysession=JSESSIONID|jsessionid
</Proxy>
b. Go to the computer on which vFabric tc Server is running and update the server.xml configuration file of
both tc Runtime instances by adding the jvmRoute=value attribute to the Catalina <Engine> element. Set
the value of this attribute equal to the value you specified (in a preceding step) for the route parameter of the
BalancerMember directive in the vFabric Web Server httpd.conf file that describes the tc Runtime instance.
Following our example, the updated <Engine> entry for the instanceOne tc Runtime instance (that uses port
8081) would be as follows (new attribute in bold):
<Engine name="Catalina" defaultHost="localhost" jvmRoute="instanceOne">
If you configure sticky sessions, VMware recommends that you also configure session replication for the tc Runtime
instances. For details, see the section titled Enabling Clustering for High Availability in the vFabric tc Server
documentation.
6. Start the vFabric Web Server instance. Following our example:
prompt# cd /opt/vmware/vfabric-web-server/lb-server
prompt# bin/httpdctl.sh start
7. Start (or restart) the two tc Runtime instances for the configuration changes to take effect. Following our example:
prompt$ cd /home/tcserver/vfabric-tc-server-standard
prompt$ ./tcruntime-ctl.sh instanceOne restart
prompt$ ./tcruntime-ctl.sh instanceTwo restart
You have now configured load balancing for the two tc Runtime instance using the front-end vFabric Web Server.
What to do next
For full reference documentation on the directives described in step 3, along with additional parameters you can use, see
Apache Module mod_proxy on the Apache Software Foundation Web site.
Ensure that you can access your application through the vFabric Web Server instance, which in turn routes the request to
one of the tc Runtime instances. Do this by invoking your application in a browser, but specify the vFabric Web Server
instance rather than the tc Runtime instance. For example, if the URL to access the vFabric Web Server is http://
www.myhost.com, invoke the /my-app application using the following URL in your browser: