JBoss.orgCommunity Documentation
You need to load the modules that are needed for mod_cluster for example:
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_ajp_module modules/mod_proxy_ajp.so LoadModule slotmem_module modules/mod_slotmem.so LoadModule manager_module modules/mod_manager.so LoadModule proxy_cluster_module modules/mod_proxy_cluster.so LoadModule advertise_module modules/mod_advertise.so
mod_proxy and mod_proxy_ajp are standard httpd modules. mod_slotmem is a shared slotmem memory provider. mod_manager is the module that reads information from JBoss AS/JBossWeb/Tomcat and updates the shared memory information. mod_proxy_cluster is the module that contains the balancer for mod_proxy. mod_advertise is an additional module that allows httpd to advertise via multicast packets the IP and port where the mod_cluster is listening. This multi-module architecture allows the modules to easily be changed depending on what the customer wants to do. For example when using http instead of AJP, only
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
needs to be changed to:
LoadModule proxy_http_module modules/mod_proxy_http.so
mod_proxy directives like ProxyIOBufferSize could be used to configure mod_cluster. There is no need to use ProxyPass directives because mod_cluster automatically configures which URLs have to be forwarded to JBossWEB.
CreateBalancers: Define how the balancer are created in the httpd VirtualHosts, this is to allow directives like:
ProxyPass / balancer://mycluster1/
0: Create in all VirtualHosts defined in httpd.
1: Don't create balancers (requires at least one ProxyPass/ProxyPassMatch to define the balancer names).
2: Create only the main server.
Default: 2
Note: When using 1 don't forget to configure the balancer in the ProxyPass directive, because the default is empty stickysession and nofailover=Off and the values received via the MCMP CONFIG message are ignored.
UseAlias: Check that the Alias corresponds to the ServerName (See Host Name Aliases)
Off: Don't check (ignore Aliases)
On: Check aliases
Default: Off Ignore the Alias information from the nodes.
Versions older than 1.3.1.Final only accept values 0 and 1 respectively.
LBstatusRecalTime: Time interval in seconds for loadbalancing logic to recalculate the status of a node
Default: 5 seconds
The actual formula to recalculate the status of a node is:
status = lbstatus + (elected - oldelected) * 1000)/lbfactor;
lbfactor is received for the node via STATUS messages.lbstatus is recalculated every LBstatusRecalTime seconds using the formula:
lbstatus = (elected - oldelected) * 1000)/lbfactor;
elected is the number of time the worker was elected.oldelected is elected last time the lbstatus was recalculated.The node with the lowest status is selected. Nodes with lbfactor ≤ 0 are skipped by the both calculation logic.
WaitForRemove: Time in seconds before a removed node is forgotten by httpd
Default: 10 seconds
ProxyPassMatch/ProxyPass: ProxyPassMatch and ProxyPass are mod_proxy directives that when using ! (instead the back-end url) prevent to reverse-proxy in the path. This could be used allow httpd to serve static information like images.
ProxyPassMatch ^(/.*\.gif)$ !
The above for example will allow httpd to server directly the .gif files.
The Context of a mod_manger directive is VirtualHost except mentioned otherwise.
server config
means that it must be outside a VirtualHost configuration.
If not an error message will be displayed and httpd won't start.
EnableMCPMReceive - Allow the VirtualHost to receive MCPM. Allow the VirtualHost to receive the MCPM from the nodes. You need one EnableMCPMReceive in your httpd configuration to allow mod_cluster to work, put it in the VirtualHost where you configure advertise.
MemManagerFile: That is the base name for the names mod_manager will use to store configuration, generate keys for shared memory or lock files. That must be an absolute path name; the directories will created if needed. It is highly recommended that those files are placed on a local drive and not an NFS share. (Context: server config)
Default: $server_root/logs/
Maxcontext: That is the number max of contexts supported by mod_cluster. (Context: server config)
Default: 100
Maxnode: That is the number max nodes supported by mod_cluster. (Context: server config)
Default: 20
Maxhost: That is the number max host (Aliases) supported by mod_cluster. That is also the max number of balancers. (Context: server config)
Default: 20
Maxsessionid: That is the number of active sessionid we store to give number of active sessions in the mod_cluster-manager handler. A session is unactive when mod_cluster doesn't receive any information from the session in 5 minutes. (Context: server config)
Default: 0 (the logic is not activated).
MaxMCMPMaxMessSize: Maximum size of MCMP messages. from other Max directives.
Default: calculated from other Max directives. Min: 1024
ManagerBalancerName: That is the name of balancer to use when the JBoss AS/JBossWeb/Tomcat doesn't provide a balancer name.
Default: mycluster
PersistSlots: Tell mod_slotmem to persist the nodes, Alias and Context in files. (Context: server config)
Default: Off
CheckNonce: Switch check of nonce when using mod_cluster-manager handler on | off Since 1.1.0.CR1
Default: on Nonce checked
AllowDisplay: Switch additional display on mod_cluster-manager main page on | off Since 1.1.0.GA
Default: off Only version displayed
AllowCmd: Allow commands using mod_cluster-manager URL on | off Since 1.1.0.GA
Default: on Commmands allowed
ReduceDisplay - Reduce the information the main mod_cluster-manager page to allow more nodes in the page. on | off
Default: off Full information displayed
SetHandler mod_cluster-manager: That is the handler to display the node mod_cluster sees from the cluster. It displays the information about the nodes like INFO and additionaly counts the number of active sessions.
<Location /mod_cluster_manager> SetHandler mod_cluster-manager Order deny,allow Deny from all Allow from 127.0.0.1 </Location>
When accessing the location you define in httpd.conf you get something like:
Note that:
Transferred: Corresponds to the POST data send to the back-end server.
Connected: Corresponds to the number of requests been processed when the mod_cluster status page was requested.
sessions: Corresponds to the number of sessions mod_cluster report as active (on which there was a request during the past 5 minutes). That field is not present when Maxsessionid is zero.
mod_advertise uses multicast packets to advertise the VirtualHost where it is configured that must be the same VirtualHost where mod_manager is defined. Of course at least one mod_advertise must be in the VirtualHost to allow mod_cluster to find the right IP and port to give to the ClusterListener.
ServerAdvertise On: Use the advertise mechanism to tell the JBoss AS/JBossWeb/Tomcat to whom it should send the cluster information.
ServerAdvertise On http://hostname:port: Tell the hostname and port to use. Only needed if the VirtualHost is not defined correctly, if the VirtualHost is a Name-based Virtual Host or when VirtualHost is not used.
ServerAdvertise Off: Don't use the advertise mechanism.
Default: Off. (Any Advertise directive in a VirtualHost sets it to On in the VirtualHost)
AdvertiseGroup IP:port: That is the multicast address to use (something like 232.0.0.2:8888 for example). IP should correspond to AdvertiseGroupAddress and port to AdvertisePort in the JBoss AS/JBossWeb/Tomcat configuration. Note that if JBoss AS is used and the -u startup switch is included in the AS startup command, the default AdvertiseGroupAddress is the value passed via the -u. If port is missing the default port will be used: 23364.
Default: 224.0.1.105:23364.
AdvertiseFrequency seconds[.miliseconds]: Time between the multicast messages advertising the IP and port.
Default: 10 Ten seconds.
AdvertiseSecurityKey value: key string used to verify advertisements checksums. If configured on either side the verification is required. Both sides must use the same security key.
Default: No default value.
AdvertiseManagerUrl value: Not used in this version (It is sent in the X-Manager-Url: value header). That is the URL that JBoss AS/JBossWeb/Tomcat should use to send information to mod_cluster
Default: No default value. Information not sent.
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_ajp_module modules/mod_proxy_ajp.so LoadModule slotmem_module modules/mod_slotmem.so LoadModule manager_module modules/mod_manager.so LoadModule proxy_cluster_module modules/mod_proxy_cluster.so LoadModule advertise_module modules/mod_advertise.so Listen 10.33.144.3:6666 <VirtualHost 10.33.144.3:6666> <Location /> Order deny,allow Deny from all Allow from 10.33.144. </Location> KeepAliveTimeout 60 MaxKeepAliveRequests 0 ManagerBalancerName mycluster ServerAdvertise On EnableMCPMReceive </VirtualHost>