Configuring CQ for a Shared-Everything Cluster

Configuring CQ for a Shared-Everything Cluster

So recently I was tasked to set up a "Shared-All" or "Shared-Everything" cluster in CQ5.5 (SP 2.1).  I found out fairly quickly that the resources online do not describe this process very well, so I figured I would share my experience with the web!

For those who are unaware, the "Shared-All" configuration of CQ5 is where both the datastore and file journal are on a NAS or shared mount between all clustered servers.  The reason we went with this configuration in my situation was due to some network issues when syncronizing after a rather large deployment.  I am going to assume you have a working node of an unclustered CQ instance for these instructions to work.  Please if you do not have this, it's as simple as double-clicking the jar (or java -jar cq5.5-author-4502.jar) and waiting for the welcome splashpage to appear.

Once you have a base instance we can get started, please ensure the instance not running as we will be moving and modifying configuration files from within the installed directory.  Please note that these instructions are catered towards Mac/Linux hosts, but should be the same for Windows as well.

Here are a few placeholders which you can replace for your environment-specific values:

<CQ_INSTALL_LOCATION> - This is the location of your crx-quickstart folder. for example: /opt/cq/crx-quickstart

<SHARED_DATASTORE_MNT> - This is the location of the shared datastore, for example: /mnt/cq/shared/datastore.  The storage should be mounted at the same location on all cluster nodes.

<SHARED_DATASTORE_MNT> - This is the location of the shared journal, for example: /mnt/cq/shared/journal.  The storage should be mounted at the same location on all cluster nodes.

${rep.home} - this is not a placeholder, but a standard CQ XML variable pointing to the <CQ_INSTALL_LOCATION>/repository folder.

 

Note: It is possible to set up the XML configurations to point to the exact mount location.  In this case you do not need to make symbolic links. 

And on to the configuration.  First, we'll need to modify "repository.xml", this can be found under <CQ_INSTALL_LOCATION>/repository/repository.xml

1.  Modify the following line (For these instructions, we are setting up symbolic links to the datastore, so the path is pointing to the symbolic link - we will set these links further along in the document):

<DataStore class="com.day.crx.core.data.ClusterDataStore"/>

To the following

        <DataStore class="org.apache.jackrabbit.core.data.FileDataStore">

                <param name="path" value="${rep.home}/repository/datastore"/>

                <param name="minRecordLength" value="4096"/>

        </DataStore>

2.  Next, Modify the <Cluster> tag to point to the shared journal location.  Keep in mind in this example, it is a symbolic link pointing to the shared location.  

Change the following line:

  <Cluster>

        <Journal class="com.day.crx.persistence.tar.TarJournal"/>

    </Cluster>

To the following:

<Cluster syncDelay="2000">

    <Journal class="com.day.crx.core.journal.FileJournal">

        <param name="sharedPath" value="${rep.home}/tarJournal" />

    </Journal>

</Cluster>

3.  Now we've set up the basic XML configurations, we just need to set up the actual files.  First, we'll move the datastore files from <CQ_INSTALL_LOCATION>/repository/repository/datastore to <SHARED_DATASTORE_MNT>.  For example: mv <CQ_INSTALL_LOCATION>/repository/repository/datastore/* <SHARED_DATASTORE_MNT>.

4,  Once the move has completed, you should have an empty folder.  Delete the empty folder, and create a symbolic link to your shared datastore folder: ln -s <SHARED_DATASTORE_MNT> <CQ_INSTALL_LOCATION>/repository/repository/datastore.  Please note the symbolic link location should be placed where it was configured in step 1, above.

5. Next we need to move the journal files into the shared location.  This is most easily done by moving the entire folders for the following items: <CQ_INSTALL_LOCATION>/repository/workspaces, <CQ_INSTALL_LOCATION>/repository/version, <CQ_INSTALL_LOCATION>/repository/repository/nodetypes, <CQ_INSTALL_LOCATION>/repository/repository/namespaces

Move each of the above named folders into the shared journal location, for example: mv <CQ_INSTALL_LOCATION>/repository/workspaces <SHARED_JOURNAL_MNT>

6. Once the move has completed, remove the previous "tarJournal" folder and create a symbolic link pointing to the shared journal location: rm -rf <CQ_INSTALL_LOCATION>/repository/tarJournal

followed by: ln -s <SHARED_JOURNAL_MNT> <CQ_INSTALL_LOCATION>/repository/tarJournal

7. We now have a single node set up for shared-everything clustering.  In order to add new nodes to this instance.  Please start up the node to ensure it starts up successfully.  Upon successful start, you can create new nodes at will by re-doing the configuration above on another new instance or cloning the master node (above).  If you are cloning the master node, there are a few minor details you need to check:

  1. cluster_node.id must be unique per node.  This is located under <CQ_INSTALL_LOCATION>/crx.0000/cluster_node.id as well as <CQ_INSTALL_LOCATION>/repository/cluster_node.id
  2. cluster.properties should have the addresses of each cluster node (and on all nodes). The following line should be added to the cluster.properties file:  addresses=<node1.ip>,<node2.ip>, ... 
    1. These files can be found in the same location as the cluster_node.id files.

That's it!  Not too hard right?  If you have any issues feel free to post a comment below and I'll do my best to answer quickly:)

Share this post

0 Comments

comments powered by Disqus