Severalnines Blog
The automation and management blog for open source databases

Active-active Alfresco cluster with MySQL Galera and GlusterFS

Posted in:

Alfresco is a popular collaboration tool available on the open-source market. It is Java based, and has a content repository, web application framework and web content management system. For critical large-scale implementations that require 24*7 uptime, a multi-node cluster would be appropriate. Since Alfresco depends on external components such as the database and the filesystem, clustering the Alfresco instances only would not be enough.

In this post, we are going to show you how to deploy an active-active Alfresco cluster with MySQL Galera Cluster (database), GlusterFS (filesystem) and HAproxy with Keepalived (load balancer) to achieve redundancy of all the required system components.

Please note that clustering of Alfresco instances is only available in the Alfresco Enterprise. Hazelcast is used to provide multicast messaging between the web-tier nodes. This blog will be using the community edition, and note that e.g. site/user dashboard layout changes on one Alfresco node are not replicated to the other nodes since Hazelcast is only enabled in the enterprise edition. However, the content repository works fine in the community edition as the content files are on the same GlusterFS partition and the content metadata is replicated via Galera. 


We will have a three-node Galera cluster co-located with Alfresco. Another two nodes, fs1 and fs2 will be used as a replicated file storage system for Alfresco content using GlusterFS. These two nodes will also have HAproxy and Keepalived for high availability load-balancing. ClusterControl will be hosted on fs2 to monitor Galera nodes. We will be using Alfresco version 4.2 (Community edition) and all hosts are running on Debian 7.2 Wheezy 64bit. All commands shown below are executed in root environment.



Our hosts definition in all nodes:		virtual_ip		alfresco1 galera1		alfresco2 galera2		alfresco3 galera3		fs1 haproxy1		fs2 haproxy2 clustercontrol


Deploying MySQL Galera Cluster, HAproxy and Keepalived (Virtual IP)

1. Use the Galera Configurator to deploy a three-node Galera Cluster. Use galera1, galera2 and galera3 for the MySQL nodes, and fs2 ( for the ClusterControl node. Once deployed, enable passwordless SSH from the ClusterControl node to fs1 so ClusterControl can provision the node:

$ ssh-copy-id -i ~/.ssh/id_rsa

2. Deploy HAProxy on fs1 and fs2 by using Add Load Balancer wizard.

3. Install Keepalived and configure an appropriate virtual IP for HAproxy failover, similar to screenshot below:

At the end of the deployment, the top summary bar in the ClusterControl UI should look like the below:

4. Configure HAproxy to serve Alfresco on port 8080 by adding the following lines into /etc/haproxy/haproxy.cfg on fs1 and fs2:

listen alfresco_8080
	bind *:8080
	mode tcp
	option httpchk GET /share
	balance source
	server alfresco1 check inter 5000
	server alfresco2 check inter 5000

Restart the HAproxy instance:

$ killall -9 haproxy && /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /var/run/ -st $(cat /var/run/


5. Create a schema for Alfresco by using Manage >> Schema and Users >> Create a database called “alfresco”. Then assign all privileges to the schema with a wildcard host (‘%’).

At the moment, MySQL Galera Cluster is load balanced with virtual IP, listening on port 33306.


Configuring GlusterFS

Following steps should be performed on fs1 and fs2 unless specified otherwise.

1. Install GlusterFS server:

$ apt-get install glusterfs-server -y

2. Create a directory for Gluster brick:

$ mkdir /brick

3. On fs1, probe fs2 as peer:

$ gluster peer probe fs2

While on fs2, probe fs1 as peer:

$ gluster peer probe fs1

4. Create the volume named “datastore” with replication on both hosts’ brick:

$ gluster volume create datastore replica 2 transport tcp fs1:/brick fs2:/brick
Creation of volume datastore has been successful. Please start the volume to access data.

5. Start the datastore volume:

$ gluster volume start datastore

6. Verify the volume is ready:

$ gluster volume info
 Volume Name: datastore
Type: Replicate
Status: Started
Number of Bricks: 2
Transport-type: tcp
Brick1: fs1:/brick
Brick2: fs2:/brick

Mounting GlusterFS

Following steps should be performed on all Alfresco nodes.

1. Install GlusterFS client:

$ apt-get install glusterfs-client -y

2. Create the mount point:

$ mkdir /storage

3. Add following line into /etc/fstab:

virtual_ip:/datastore  /storage        glusterfs       defaults,_netdev 0 0

4. Mount the newly defined GlusterFS partition in /etc/fstab:

$ mount -a

5. Verify that the partition is mounted correctly:

$ mount | grep /storage
virtual_ip:/datastore on /storage type fuse.glusterfs (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other,max_read=131072)

Installing Alfresco

Following steps should be performed on all Alfresco nodes unless specified otherwise.

1. Install packages required by Alfresco:

$ apt-get install -y openssh-server apache2 xvfb xfonts-base ghostscript imagemagick

2. Download Alfresco Community installer from

$ wget --content-disposition

3. Make the installer executable:

$ chmod +x alfresco-community-4.2.e-installer-linux-x64.bin

4. Launch the installer:

$ ./alfresco-community-4.2.e-installer-linux-x64.bin --mode text

Follow the installation wizard. It is worth mentioning some of the non-default answers that we used during the installation:

[1] Easy - Installs servers with the default configuration
[2] Advanced - Configures server ports and service properties.: Also choose optional components to install.
Please choose an option [1] : 2
Java [Y/n] : Y
PostgreSQL [Y/n] :n
Alfresco : Y (Cannot be edited)
SharePoint [Y/n] :Y
Web Quick Start [y/N] : y
Google Docs Integration [Y/n] :Y
LibreOffice [Y/n] :Y
JDBC URL: [jdbc:postgresql://localhost/alfresco]: jdbc:mysql://virtual_ip:33306/alfresco
JDBC Driver: [org.postgresql.Driver]:
Web Server domain: []:
Launch Alfresco Community Share [Y/n]: n


Make sure that Alfresco is not started once the installation is complete. We will need to apply some custom configurations, as in the next section.

Configuring Alfresco

1. Create a symlink to simplify the Alfresco path:

$ ln -s /opt/alfresco-4.2.e /opt/alfresco

2. Download the MySQL connector for Java from MySQL Connector download site and install it into Tomcat library:

$ wget
$ tar -xzf mysql-connector-java-5.1.28.tar.gz
$ cd mysql-connector-java*
$ cp mysql-connector-java-5.1.28-bin.jar /opt/alfresco/tomcat/lib/

3. On alfresco1, copy the content of /opt/alfresco/alf_data to /storage:

$ cp -pfR /opt/alfresco/alf_data /storage/

4. Change the Alfresco root directory in /opt/alfresco/tomcat/shared/classes/ to the GlusterFS mount point:


5. Start Alfresco service:

$ service alfresco start

Wait until the bootstrapping process completes. You can monitor the process by examining the Tomcat process log file at /opt/alfresco/tomcat/logs/catalina.out.

Open the Alfresco page at and login using default username “admin” with specified password during the installation process. You should see the Alfresco dashboard similar to the screenshot below:


You should see some activity on your database cluster, as seen from the ClusterControl dashboard:



Related Post

MySQL in the Cloud - Pros and Cons of Amazon RDS

Moving your data into a public cloud service is a big decision. All the major cloud vendors offer cloud database services, with Amazon RDS for MySQL being probably the most popular. In this blog, we’ll have a close look at what it is, how it works, and compare its pros and cons.

Posted in:

Planets9s - 2016’s most popular s9s resources

Planets9s is a weekly communication on all the latest Severalnines resources and technologies around automation and management of open source databases such as MySQL, MariaDB, PostgreSQL & MongoDB.

Posted in:

Planets9s - Online schema change for MySQL & MariaDB, MySQL storage engine & backups … and more

Planets9s is a weekly communication on all the latest Severalnines resources and technologies around automation and management of open source databases such as MySQL, MariaDB, PostgreSQL & MongoDB.

Posted in:

Planets9s - Download our new DevOps Guide to Database Backups for MariaDB & MySQL

Planets9s is a weekly communication on all the latest Severalnines resources and technologies around automation and management of open source databases such as MySQL, MariaDB, PostgreSQL & MongoDB.

Posted in: