Hazelcast Configuration (Post v4.1.x and pre v4.2)

cancel
Showing results for 
Search instead for 
Did you mean: 

Hazelcast Configuration (Post v4.1.x and pre v4.2)

resplin
Intermediate
0 0 3,249

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com




Hazelcast configuration for clustering


This documentation applies to subversion revision 37008 or greater of the HEAD branch - but ceases to be relevant for the new v4.2 clustering functionality.

PLEASE NOTE: this documents an unreleased Work In Progress that formed the initial part of the v4.2 work. In almost all cases this documentation should not be followed.

The Hazelcast library provides support for distributed data structures and communications channels that allow certain components of the Alfresco content repository server to function properly within a clustered environment. An example of this is the WebDAV protocol-level locking that uses an in-memory hashmap as a lock store in a single node environment but uses a Hazelcast supplied distributed-hashmap when running in a cluster.


Enabling Hazelcast


To enable Hazelcast, provide a value for the property alfresco.cluster.name, e.g. in alfresco-global.properties:

alfresco.cluster.name=mycluster


Typical configuration properties


The properties shown below represent a minimal set up that may suffice in many deployment scenarios:


# An arbitrary yet unique name for the cluster exposed on this network.
alfresco.cluster.name=mycluster

# Password to join the cluster
alfresco.hazelcast.password=alfrescocluster

# XML elements to incorporate into Hazelcast config, in particular
# hostnames/IP addresses to use for membership discovery
alfresco.hazelcast.tcp.config=<members>10.244.50.68,10.244.50.70</members>


The configuration allows two servers on IP addresses 10.244.50.68 and 10.244.50.70 to participate in a cluster.

In addition to setting these properties it is necessary to enable the Ehcache for clustering by copying the ehcache-custom.xml sample file into the extension directory of the repository server, for example on tomcat this may be $TOMCAT_HOME/shared/classes/alfresco/extension


Extended configuration properties


Further properties exist that may be adjusted if required (defaults shown at time of writing):


#   An arbitrary yet unique name for the cluster exposed on this network.
alfresco.cluster.name=mycluster
#   Password to join the cluster
alfresco.hazelcast.password=alfrescocluster
#   Protocol used for member discovery (tcp, ec2, udp)
alfresco.hazelcast.protocol=tcp
#   Location of the Hazelcast configuration file
alfresco.hazelcast.configLocation=classpath:alfresco/hazelcast/hazelcast-${alfresco.hazelcast.protocol}.xml
#   XML elements to incorporate into Hazelcast config, in particular
#   hostnames/IP addresses to use for membership discovery
alfresco.hazelcast.tcp.config=<members></members>
#   Whether to bind to a specific host interface
alfresco.hazelcast.specify.interface=false
#   The interface to bind to, if enabled above.
alfresco.hazelcast.bind.interface=
#   Amazon Web Services - EC2 discovery
alfresco.hazelcast.ec2.accesskey=my-access-key
alfresco.hazelcast.ec2.secretkey=my-secret-key
alfresco.hazelcast.ec2.region=us-east-1
#   Only instances belonging to this group will be discovered, default will try all running instances
alfresco.hazelcast.ec2.securitygroup=
alfresco.hazelcast.ec2.tagkey=type
alfresco.hazelcast.ec2.tagvalue=hz-nodes


The alfresco.hazelcast.protocol property determines which configuration file will be loaded by hazelcast. The name of the file that will be loaded from the classpath is hazelcast-p.xml where p will be substituted with the value of the protocol property.

To gain further control over the name and location of the configuration file, use the alfresco.hazelcast.configLocation property and set this to any value you choose.


Hazelcast configuration file pre-processing


To support use of the properties mentioned above in the Hazelcast configuration file, an instance of the class org.alfresco.repo.cluster.HazelcastConfigFactoryBean is used to pre-process the text before returning a Hazelcast configuration object.

An instance of the class org.alfresco.repo.cluster.HazelcastInstanceFactory is used to create the actual Hazelcast cluster and holds a reference to the com.hazelcast.config.Config object created by the HazelcastConfigFactoryBean above. This level of indirection is required (rather than directly creating a HazelcastInstance in the spring configuration) to allow enabling/disabling of the Hazelcast clustering.


Example properties


Supposing you have two nodes that you wish to cluster, one on IP address 192.168.1.104 and one on 192.168.56.101. To configure the first node (using TCP/IP for node discovery), the following properties may be used:


alfresco.cluster.name=my-cluster
alfresco.hazelcast.tcp.config=<members>192.168.1.104,192.168.56.101</members>
alfresco.hazelcast.specify.interface=true
alfresco.hazelcast.bind.interface=192.168.1.104
alfresco.ehcache.rmi.hostname=192.168.1.104


For the second node, the following may be used:


alfresco.cluster.name=my-cluster
alfresco.hazelcast.tcp.config=<members>192.168.1.104,192.168.56.101</members>
alfresco.hazelcast.specify.interface=true
alfresco.hazelcast.bind.interface=192.168.56.101
alfresco.ehcache.rmi.hostname=192.168.56.101


Notice that the property alfresco.ehcache.rmi.hostname is also set in both nodes, to ensure the correct RMI URLs are generated.
Configuration