Obsolete Pages{{Obsolete}}
The official documentation is at: http://docs.alfresco.com
*** JGroups functionality was introduced in Enterprise V3.1 ***
*** Cache communication using JGroups is an Enterprise specific feature not available on Alfresco Community ***
Alfresco requires servers to discover each other on a network in order to set up cluster communications. Before V3.1, this discovery process was done using a UDP multicast message (provided by EHCache); servers in the cluster picked the message up and used the information to set up inter-server communication for inter-cache communication.
Alfresco limited some installations by not providing a more flexible cluster discovery process, which is why JGroups was integrated into the repository. JGroups is a toolkit for multicast communication between servers. It allows inter-server communication using a highly configurable transport stack, which includes UDP and TCP protocols. Additionally, JGroups manages the underlying communication channels and cluster entry and exit.
This page covers the options available for configuring JGroups and other Alfresco-specific cluster options for V3.1.
JGroups is supported in both the Open and Enterprise code lines, but is only used for cache communication in Enterprise. The core setup of JGroups is therefore common to both code streams.
NB: The JGroups cluster will only initialize if the following property is defined:
alfresco.cluster.name=<CLUSTERNAME>
Once the cluster name is specified, JGroups uses that name to uniquely distinguish inter-server communication. This allows machines to use the same protocol stacks, but to ignore broadcasts from different clusters.
The default JGroups configuration files are located at <configRoot>/alfresco/jgroups/alfresco-jgroups-XYZ.xml, where XYZ is the name of the protocol being used. There is a separate configuration file for each stack. Switch between the default TCP and UDP stacks using:
alfresco.jgroups.defaultProtocol=<STACKNAME>
By default the UDP stack is used. You must explicitly configure JGroups to use TCP.
You can also point to a completely new configuration file of your own making using:
alfresco.jgroups.configLocation=classpath:some-classpath.xml
alfresco.jgroups.configLocation=file:some-file-path.xml
Within the JGroups configuration files, there are parameters that can be passed, for example, see <configRoot>/alfresco/jgroups/alfresco-jgroups-TCP.xml:
<config>
<TCPPING timeout='3000'
initial_hosts='${alfresco.tcp.initial_hosts:localhost[7800]}'
port_range='${alfresco.tcp.port_range:3}'
num_initial_members='2'/>
</config>
The variable substitution if provided natively by JGroups; properties are taken from the JVM's system properties. In order to support setting JGroups properties in either the system properties or directly on the command line - and not only the latter - Alfresco has a bean that pushes the JGroups properties from the system properties into the JVM properties:
<configRoot>/alfresco/core-services-context.xml:
<bean id='jgroupsPropertySetter' class='org.alfresco.config.SystemPropertiesSetterBean' init-method='init'>
<property name='propertyMap'>
<map>
<entry key='jgroups.bind_addr'>
<value>${alfresco.jgroups.bind_address}</value>
</entry>
<entry key='jgroups.bind_interface'>
<value>${alfresco.jgroups.bind_interface}</value>
</entry>
<entry key='alfresco.tcp.start_port'>
<value>${alfresco.tcp.start_port}</value>
</entry>
<entry key='alfresco.tcp.initial_hosts'>
<value>${alfresco.tcp.initial_hosts}</value>
</entry>
<entry key='alfresco.tcp.port_range'>
<value>${alfresco.tcp.port_range}</value>
</entry>
<entry key='alfresco.udp.mcast_addr'>
<value>${alfresco.udp.mcast_addr}</value>
</entry>
<entry key='alfresco.udp.mcast_port'>
<value>${alfresco.udp.mcast_port}</value>
</entry>
</map>
</property>
</bean>
If the JGroups config is changed or extended and the preferred means of setting properties is NOT via the system (-D options) properties, then override the bean or add a new bean in your extension location. Values set directly on the VM using the -D options are always taken in preference in this case.
It is still possible to use the EHCache multicast discovery. Replace the cacheManagerPeerProviderFactory in your EHCache custom config file as follows:
<extensionRoot>/alfresco/extension/ehcache-custom.xml:
<cacheManagerPeerProviderFactory
class='net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory'
properties='peerDiscovery=automatic,
multicastGroupAddress=230.0.0.1,
multicastGroupPort=4446'/>
You will still need to set the alfresco.cluster.name property in order to activate index tracking.
The cluster checks have not changed: Testing the Cluster
When IP multicasting is not enabled, or cannot be used for other reasons, one has to use the TCP stack config file.
this stack config defaults to using TCPPING, which lists nodes statically in the config, through the use of the alfresco.tcp.initial_hosts property.
However, this is a bit cumbersome when you want to add new nodes, with regard to configuration, restarting nodes, etc...
JGroups provides alternatives for node discovery when IP multicasting cannot be used, such as :
When using the FILE_PING mechanism, each node on startup will add/remove its information in the shared directory when joining/leaving the cluster.
New node membership will still be printed out in the logfile as usual, and you can monitor the directory for node membership, per channel.
To use FILE_PING instead of TCPPING when using the TCP config :
...
<FILE_PING location='/mnt/jgroups' />
...
alfresco.jgroups.defaultProtocol=TCP
alfresco.jgroups.configLocation=classpath:alfresco/extension/jgroups/custom-alfresco-jgroups-${alfresco.jgroups.defaultProtocol}.xml
In 3.4.11+ and 4.1.1+, this mode is now included as an option out of the box. You no longer need to copy / modify the jgroups XML config.
You can simply configure it in alfresco-global.properties, with, for example :
alfresco.jgroups.defaultProtocol=TCP-FPING
alfresco.fping.shared.dir=${dir.root}/jgroups
See :
For more information.