Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
17.14. Enabling Clustering in ModeShape
A ModeShape configuration can have a "clustering" fragment that defines the name of the cluster and the JGroups configuration:
<mode:clustering clusterName="modeshape-cluster" configuration="jgroups-modeshape.xml" />
<mode:clustering clusterName="modeshape-cluster" configuration="jgroups-modeshape.xml" />
The "clusterName" is a string that is a logical name of the cluster; all engines connecting to the same name form a cluster. Any messages multicast from one engine in the cluster will be received by all other members of the cluster. Again, the cluster name is independent of the repositories managed by th
The "
If the "
configuration" value is a string that is one of:
- the absolute file system path to the file containing the JGroups XML configuration;
- the relative file system path to the file containing the JGroups XML configuration, relative to the current working directory of the Java process;
- the name of a resource on the classpath containing the JGroups XML configuration;
- the URL that can be resolved to the JGroups XML configuration; or
- the string representation of JGroups configuration, either in XML format or the older string format.
configuration" property is not given, ModeShape will use the default JGroups configuration (as defined by the specific JGroups version).
Note
Note that all engines in the cluster must have the same JGroups configuration. In fact, all engines in the cluster will almost always have exactly the same ModeShape configuration.
Here is an example of a "
clustering" fragment defining a cluster named "modeshape-cluster" using the JGroups configuration defined in the "jgroups-modeshape.xml" file at the supplied URL:
<clustering clusterName="modeshape-cluster" configuration="file://some/path/jgroups-modeshape.xml" />
<clustering clusterName="modeshape-cluster"
configuration="file://some/path/jgroups-modeshape.xml" />
This next example uses the JGroups configuration defined in the "jgroups-modeshape.xml" resource file on the classpath (or as an absolute path on a *nix system):
<clustering clusterName="modeshape-cluster" configuration="/some/path/jgroups-modeshape.xml" />
<clustering clusterName="modeshape-cluster"
configuration="/some/path/jgroups-modeshape.xml" />
Next is an example that specifies the JGroups configuration using the older string representation of the form:
<clustering clusterName="modeshape-cluster" configuration="PROTOCOL(param=value;param=value):PROTOCOL:PROTOCOL" />
<clustering clusterName="modeshape-cluster"
configuration="PROTOCOL(param=value;param=value):PROTOCOL:PROTOCOL" />
Of course, the "
configuration" property can be specified as a child element, too (line breaks added for readability):
<clustering clusterName="modeshape-cluster"> <configuration>UDP(max_bundle_size="60000":max_bundle_timeout="30"): PING(timeout="2000"):...</configuration> </clustering>
<clustering clusterName="modeshape-cluster">
<configuration>UDP(max_bundle_size="60000":max_bundle_timeout="30"):
PING(timeout="2000"):...</configuration>
</clustering>
And finally an example that specifies the JGroups configuration using the newer XML representation (line breaks added for readability):
<clustering clusterName="modeshape-cluster"> <configuration><![CDATA[<config><UDP max_bundle_size="60000" max_bundle_timeout="30".../><PING timeout="2000"/>...</config>]]> </configuration> </clustering>
<clustering clusterName="modeshape-cluster">
<configuration><![CDATA[<config><UDP max_bundle_size="60000"
max_bundle_timeout="30".../><PING timeout="2000"/>...</config>]]>
</configuration>
</clustering>
Note that the this example uses a child XML element for the "
configuration", along with a CDATA section, so that the XML configuration can be nested within the ModeShape configuration.
Warning
Remember to specify the system workspace name for each repository that is clustered.