Zarafa High Availability setup with MySQL master-slave

From Zarafa wiki

This article describes how you can create a manual High Availability system
for Zarafa, MySQL and Apache. MySQL replication is used to replicate the
database on the two servers.
Introduction

Introduction

In this whitepaper we will describe how you can create a High Availability system for Zarafa and
MySQL between two servers. This HA system is based on a active-passive environment.

In this case we don't use DRBD for exact copies of both servers.
Before we start to configure the HA system, you need to install on both servers Apache, Zarafa and a MTA.
To monitor the servers we use the default Linux tool Heartbeat.
The Standy-server will monitor the Main server. When the main server is down for more then 30
seconds the Standy server will start Zarafa and will get the ip-address of the main server.
The database is replicated continuously on both servers by the default MySQL master-slave
replication.

To avoid inconsistent databases we advise you to reconfigure manually the HA environment
after a failover.

Contents

Zarafa in High Availability environment

Before starting with setting up a High Availability system, make sure you have a complete
backup of your Zarafa database and have some good experience with MySQL configurations.\

Zarafa is NOT responsible for lost data or corrupt databases.

Setup MySQL replication

In a master-slave replication environment the slave will execute all queries that are done on the
master server. The master server will records all the execute queries in binary logfiles, the slave
server will read these logfiles and execute the query on it's own database.
For an application, like Zarafa, it's not possible to do write actions of the slave server.
The slave server reads the binlog files all the time. When the master server has a failure, the
slave cannot connect to the master server and will no longer read the binary logfiles.

Configuration

To configure MySQL for replication you need two servers both with the same MySQL version
installed. First you need to configure the master server by the following steps:

Copy the ha.cf to your slave server and switch the last two lines, so the slave node is the first
line.

Open or create the file haresources on the master and add the following line:
master.zarafa.com failover

This line will set the init-script that will be started when the master is down.

Open or create the file haresources on the slave and add the following line:
slave.zarafa.com

Open or create the file authkeys and add the following line:

auth 2
2 sha1 security!

Change the permissions of this file to 600 and copy this file to the slave server.

Now you have to create the init-script that will be started when the master server is down.
Below you will find a example failover script that will start the Zarafa services and take over the
ip-address of the master server.

Tips and hints

To start the HA cluster, we recommended to first start the master server and then the slave
server. We strongly advise to start the Heartbeat monitoring manually when both servers are
successfully started.

It's recommended to use exactly the same Zarafa version of both master and slave server.