Manual Cluster Setup

Question / Problem

In order to satisfy fail-over and/or performance requirements, it is recommended to setup a clustered environment consisting of 2 or more individual CRX cluster instances. This article is about how to manually setup a cluster of 2 CRX instances.

Answer / Resolution

Cluster nodes communicate with each other on different layers: via TCP/IP and the filesystem via a shared folder. The latter has to be accessible both in a read/write fashion for all instances participating in a cluster. Only the master instance will write to this folder. If the master instance dies or is stopped, another instance automatically becomes the new master.

There are multiple ways to install a cluster. One is to change the repository-template.xml file and install each instance normally, another is to create a 'template' instance and copy that to each additional cluster node.

Installation Using a Custom repository-template.xml

CRX 2.x only.

Before installing the first instance, extract the crx-explorer_crx.war file.

Edit the repository-template.xml file: set the shared path.

Re-pack the crx-explorer_crx.war file.

For each instance, install this custom crx-explorer_crx.war file. All cluster nodes will point to the same shared path.

To include the shared directory in the Online Backup, create a symlink to the shared path in each cluster node. This can be done while CRX is running. The symlink is only used during online backup; the symlink is not used during normal operation. The configuration does not need to be changed for this. To create a symlink:

This is only required on the cluster nodes where you want to use the Online Backup tool. The recommended symlink name is shared, however a different name can be used. The symlink needs to be within the crx-quickstart folder for the Online Backup tool.

Installation Using Template Instance

Install First Instance

Start off with installing the first instance. Since a shared folder is required (e.g. NFS or CIFS), it is recommended to use symlinks on the filesystem to transparently make this network share available.

Create a symlink named shared pointing to the network-share where the shared folder should be stored: ln -s <path_to_network_share> shared

Start CRX/CQ: java -Xmx256m -jar *.jar

During the installation, CRX will transparently use the network-share via the shared symlink to install its shared files and folders. Once the installation is complete, verify that the network-share has actually been used and that CRX is running correctly. Then stop the instance and proceed to the next step.

Install Additional Cluster Node

Copy the same CRX quickstart jar-file from above including a valid license.properties file to a second machine, e.g. /opt/day/crx

Copy the complete crx-quickstart folder from the first instance to the second machine, below /opt/day/crx

On the second machine, navigate to /opt/day/crx/crx-quickstart/repository

Delete the file cluster_node.id which will be automatically recreated on startup (the cluster ID has to be unique)

Make sure the symlink shared points to the same network-share as on the first instance

Start both instances one after another

At this point, a 2-node CRX cluster is running. Content that is created/modified on either instance is visible on the other.