From 82467d78244ba3253ad3ad30213942e98da2d1bb Mon Sep 17 00:00:00 2001 From: fhanik Date: Fri, 29 Sep 2006 22:38:04 +0000 Subject: [PATCH] Started documenting the cluster configuration. On to the sub components git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@451480 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/catalina/ha/tcp/SimpleTcpCluster.java | 33 +++--- webapps/docs/config/cluster.xml | 117 ++++++++++++++++++--- 2 files changed, 119 insertions(+), 31 deletions(-) diff --git a/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java b/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java index 4f9f8806f..b32013c25 100644 --- a/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java +++ b/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java @@ -391,24 +391,26 @@ public class SimpleTcpCluster */ public void setProperty(String name, Object value) { if (log.isTraceEnabled()) - log.trace(sm.getString("SimpleTcpCluster.setProperty", name, value, - properties.get(name))); - + log.trace(sm.getString("SimpleTcpCluster.setProperty", name, value,properties.get(name))); properties.put(name, value); + //using a dynamic way of setting properties is nice, but a security risk + //if exposed through JMX. This way you can sit and try to guess property names, + //we will only allow explicit property names + log.warn("Dynamic setProperty("+name+",value) has been disabled, please use explicit properties for the element you are trying to identify"); if(started) { // FIXME Hmm, is that correct when some DeltaManagers are direct configured inside Context? // Why we not support it for other elements, like sender, receiver or membership? // Must we restart element after change? - if (name.startsWith("manager")) { - String key = name.substring("manager".length() + 1); - String pvalue = value.toString(); - for (Iterator iter = managers.values().iterator(); iter.hasNext();) { - Manager manager = (Manager) iter.next(); - if(manager instanceof DeltaManager && ((ClusterManager) manager).isDefaultMode()) { - IntrospectionUtils.setProperty(manager, key, pvalue ); - } - } - } +// if (name.startsWith("manager")) { +// String key = name.substring("manager".length() + 1); +// String pvalue = value.toString(); +// for (Iterator iter = managers.values().iterator(); iter.hasNext();) { +// Manager manager = (Manager) iter.next(); +// if(manager instanceof DeltaManager && ((ClusterManager) manager).isDefaultMode()) { +// IntrospectionUtils.setProperty(manager, key, pvalue ); +// } +// } +// } } } @@ -504,7 +506,7 @@ public class SimpleTcpCluster manager.setDistributable(true); if (manager instanceof ClusterManager) { ClusterManager cmanager = (ClusterManager) manager ; - cmanager.setDefaultMode(true); + cmanager.setDefaultMode(false); cmanager.setName(getManagerName(((ClusterManager)manager).getName(),manager)); cmanager.setCluster(this); } @@ -548,7 +550,8 @@ public class SimpleTcpCluster ClusterManager cmanager = (ClusterManager) manager ; cmanager.setName(clusterName); cmanager.setCluster(this); - if(cmanager.isDefaultMode()) transferProperty("manager",cmanager); + //not needed anymore, we have an explicit Manager element + //if(cmanager.isDefaultMode()) transferProperty("manager",cmanager); } managers.put(clusterName, manager); // Notify our interested LifecycleListeners diff --git a/webapps/docs/config/cluster.xml b/webapps/docs/config/cluster.xml index b597393c4..7c66ca1df 100644 --- a/webapps/docs/config/cluster.xml +++ b/webapps/docs/config/cluster.xml @@ -15,32 +15,117 @@
- - - +

+ The tomcat cluster implementation provides session replication, context attribute replication and + cluster wide WAR file deployment. + While the Cluster configuration is fairly complex, the default configuration will work + for most people out of the box.

+ The Tomcat Cluster implementation is very extensible, and hence we have exposed a myriad of options, + making the configuration seem like a lot, but don't lose faith, instead you have a tremendous control + over what is going on.

+
+
+

To configure context attribute replication, simply do this by swapping out the context implementation + used for your application context. + <Context className="org.apache.catalina.ha.context.ReplicatedContext"/> + This context extends the Tomcat StandardContext + so all the options from the base implementation are valid. +

+
+
+

Manager:
+ The manager element identifies what kind of session manager is used in this cluster implementation. + This manager configuration is identical to the one you would use in a regular <Context> configuration. +
The default value is the org.apache.catalina.ha.session.DeltaManager that is closely coupled with + the SimpleTcpCluster implementation. Other managers like the org.apache.catalina.ha.session.BackupManager + are/could be loosely coupled and don't rely on the SimpleTcpCluster for its data replication. +

+

Channel:
+ The Channel and its sub components are all part of the IO layer + for the cluster group, and is a module in it's own that we have nick named "Tribes" +
Any configuring and tuning of the network layer will be done in the channel and its nested components. + You can always find out more about Apache Tribes + +

+

Channel/Membership:
+ The Membership component is responsible for auto discovering new nodes in the cluster + and also to provide for notifications for any nodes that have not responded with a heartbeat. + The default implementation uses multicast.
+ You can always find out more about Apache Tribes +

+

Channel/Sender:
+ The Sender component manages all outbound connections and data messages that are sent + over the network from one node to another. + This component allows messages to be sent in parallel. + The default implementation uses TCP client sockets.
+ You can always find out more about Apache Tribes +

+

Channel/Sender/Transport:
+ The Transport component is the bottom IO layer for the sender component. + The default implementation uses non-blocking TCP client sockets.
+ You can always find out more about Apache Tribes +

+

Channel/Receiver:
+ The receiver component listens for messages from other nodes. + Here you will configure the cluster thread pool, as it will dispatch incoming + messages to a thread pool for faster processing. + The default implementation uses non-blocking TCP server sockets.
+ You can always find out more about Apache Tribes +

+

Channel/Interceptor:
+ The channel will send messages through an interceptor stack. Because of this, you have the ability to + customize the way messages are sent and received, and even how membership is handled.
+ You can always find out more about Apache Tribes +

+

Valve:
+ The Tomcat Cluster implementation uses Tomcat Valves to + track when requests enter and exit the servlet container. It uses these valves to be able to make + intelligent decisions on when to replicate data, which is always at the end of a request. +

+

Deployer:
+ The Deployer component is the Tomcat Farm Deployer. It allows you to deploy and undeploy applications + cluster wide. +

+

ClusterListener:
+ ClusterListener's are used to track messages sent and received using the SimpleTcpCluster. + If you wish to track messages, you can add a listener here, or you can add a valve to the channel object. +

+
+

+ Deprecated settings: In the previous version of Tomcat you were able to control session + manager settings using manager.<property>=value. + This has been discontinued, as the way it was written interfers with + the ability to support multiple different manager classes under one cluster implementation, + as the same properties might have the different effect on different managers. +

+
- - - - +

The main cluster class, currently only one is available, + org.apache.catalina.ha.tcp.SimpleTcpCluster +

+
+ +

Deprecated since 6.0.0

+

Possible values are true or false
+ Value is inherited from Tomcat 5.5 and has no official meaning. + to configure logging, use the standard tomcat logging configuration. +

+
+ +

Deprecated since 6.0.0

+

+ Value is inherited from Tomcat 5.5 and has no official meaning. + to configure logging, use the standard tomcat logging configuration. +

- -
- -
- -
- - - -- 2.11.0