How To Install & Configure Zimbra High Availability (HA)

In the previous articles, i’ve been explain how to install and configure Zimbra on CentOS 6 or CentOS 7how to install and configure online failover/failback on CentOS 6 using Heartbeat and how to install and configure data replication on CentOS 6 using DRBD. All above guidance could be combined to get Zimbra High Availability. For online failover/failback, you could using Heartbeat. For data replication, you could using DRBD. Heartbeat + DRBD will produce High Availability (HA). The following is guidance to configure Zimbra HA
Step by step to configure Zimbra HA
For the Linux systems, i am using CentOS 6 64 Bit. For easy understanding, this is my information system
# Server 1
Hostname   : node1
Domain     : imanudin.net
IP Address : 192.168.80.91

# Server 2
Hostname   : node2
Domain     : imanudin.net
IP Address : 192.168.80.92

# Alias IP
Hostname   : mail
Domain     : imanudin.net
IP Address : 192.168.80.93
Alias IP will be used for access clients/users. This alias IP will be configured online failover
# install Zimbra on CentOS 6 on all nodes (node1 and node2) as described at this link : How To Install Zimbra 8.6 on CentOS 6. Please note some information below
– Please change name of each nodes refers into mail.imanudin.net when installing Zimbra
– Set IP address of each nodes refers into mail.imanudin.net include DNS and /etc/hosts
# Stop Zimbra and DNS services on all nodes (node1 and node2)

1.su - zimbra -c "zmcontrol stop"
2.service named off
3.chkconfig zimbra off
4.chkconfig named off

# After installed Zimbra, install and configure Heartbeat on all nodes (node1 and node2) as described at this link : How To Configure Online Failover/Failback on CentOS 6 Using Heartbeat
# After installed Heartbeat and online failover/failback working fine, then install DRBD for data replication on all nodes (node1 and node2) as described at this link : How To Configure Data Replication/Synchronize on CentOS 6 Using DRBD
# Testing data replication DRBD that has been worked : Testing Data Replication/Synchronize on DRBD
# After DRBD has been worked, copy file/folder /opt/zimbra into DRBD devices.
Do the following command only at node1
– Rysnc Zimbra

1.drbdadm primary r0
2.mount /dev/drbd0 /mnt/tmp
3.rsync -avP --exclude=data.mdb /opt/ /mnt/tmp
data.mdb will be huge if copied by rsync so that take a long time. For the tricks, use cp for copy data.mdb to DRBD devices 😀
– Copy data.mdb

1.cp /opt/zimbra/data/ldap/mdb/db/data.mdb /mnt/tmp/zimbra/data/ldap/mdb/db/data.mdb
2.chown zimbra.zimbra /mnt/tmp/zimbra/data/ldap/mdb/db/data.mdb
# Umount DRBD devices after rsync file/folder Zimbra at node1

1.umount /dev/drbd0
# Move folder /opt existing to another folder, do the following command on all nodes (node1 and node2)

1.mv /opt /backup­opt
2.mkdir /opt
3.mount /dev/drbd0 /opt
# Configure /etc/hosts and dns records on all nodes (node1 and node2)

1.vi /etc/hosts
so that like below
127.0.0.1       localhost
192.168.80.91   node1.imanudin.net   node1
192.168.80.92   node2.imanudin.net   node2
192.168.80.93   mail.imanudin.net    mail

1.vi /var/named/db.imanudin.net
change IP address of mail so that refers into IP 192.168.80.93. See the following example
$TTL 1D
@       IN SOA  ns1.imanudin.net. root.imanudin.net. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
@       IN      NS      ns1.imanudin.net.
@       IN      MX      0 mail.imanudin.net.
ns1     IN      A       192.168.80.91
mail    IN      A       192.168.80.93
# Configure file /etc/ha.d/haresources on all nodes (node1 and node2)

1.vi /etc/ha.d/haresources
so that like below
node1.imanudin.net IPaddr::192.168.80.93/24/eth0:0 drbddisk::r0 Filesystem::/dev/drbd0::/opt::ext3 named zimbra
# Stop service Heartbeat on node2 and then node1

1.service heartbeat stop
# Start service Heartbeat on node1 and then node2

1.service heartbeat start
TESTING HA
– Failover
After Zimbra running well on node1, please stop service Heartbeat on node1 or force off machine

1.service heartbeat stop
All services that taken over by Heartbeat will automatically stopped and taken over by node2. How long node2 can start all services worked again, depends how long start services (named and zimbra)
– Failback
Please start again service Heartbeat on node1 or power on machine

1.service heartbeat start
All running services on node2 will automatically stopped and taken over by node1
Hooray, finally you could build Zimbra HA with DRBD+Heartbeat
For log information about HA process, you can see at /var/log/ha-log
Good luck and hopefully useful

Nhận xét

Bài đăng phổ biến