Moving Zimbra 8.0.9 to Zimbra 8.6 on a new server

Moving Zimbra 8.0.9 to Zimbra 8.6 on a new server

Disclaimer: I have the NETWORK/pro version but chose not to use the backups. This method should work with both the free and paid version as a result.  We perform offsite backups and use tar to handle the sparse 80GB ldap file.  This can run hot without the need to stop zimbra. The plan is to run this often and just before final cut-over do your shutdown as an extra precaution. You can test the new server with these hot images and even perform an upgrade test with this method.  As the backup server has multiple zimbra customer instances, this method allows one to have a central backup server for catastrophic recovery for those customers.

Summary of Steps

  • On existing host, Backup existing zimbra instance via rsync (see note)
  • On new host, install zimbra software (install.sh -s)
  • On new host, pull zimbra instance via rsync
  • On new host, install zimbra software (install.sh)
  • On new host, update new ip address
  • Optional: Can try upgrade of new zimbra software

Note: we push vs pull zimbra from the existing host because we create a tar image of the ldap database which is a sparse file.

Steps

Modify /etc/hosts on new host so that the name of your old server is represented in this new server. Run split brain DNS and set the resolv.conf to 127.0.0.1. install operating specific software required for a normal zimbra installation. Finally set the hostname to be exactly the same.

rsync to a central backup server (initial push is slow but subsequent are in minutes).  Zimbra instance was approx 80GB that this was tested against. Once the initial instance is copied, subsequent updates take a few minutes or less to keep everything in sync.


#!/bin/sh

# 80GB sparse file so we handle differently
cd /opt/zimbra/data/ldap/mdb/db
tar cvzSpf data.mdb.tar.gz data.mdb

# backup /opt/zimbra including this sparse ldap tar file just created but ignore the actual sparse file
rsync --progress --delete --archive --verbose --hard-links --exclude=zimbra/dat
a/ldap/mdb/db/data\.mdb --exclude=zimbra/backup /opt/zimbra BackupServer:/opt/customer-instance

exit

On new server, two methods to initially create the /opt/zimbra structure required before overlaying with your rsync image.

IMPORTANT: I tested against the same version of zimbra software but wonder if using an upgraded version would also work?

Method 1:
Same version as rysnc image from zimbra server

#./install.sh -s --skip-activation-check
# vi /etc/logrotate.d/zimbra --- USER/GROUP must be replaced with zimbra
# /etc/rsyslog.conf - will be populated later
# /etc/sudoers - will be populated later
# crontab entry for zimbra will be populated later

Method 2:
Previous version of zimbra was installed so remove previous version first. This cleans everything (ie. removes data) but leaves the password and group files in tact.

# ./install -u

Extract zimbra instance from our backup server


#!/bin/sh

#
# Assumes: ldap has tar image of sparse file in our backup area
#

# backup /opt/zimbra including this sparse ldap file just created via tar
rsync --progress --delete --archive --verbose --hard-links --exclude=zimbra/data/ldap/mdb/db/data\.mdb --exclude=zimbra/backup BackupServer:/opt/customer-instance/zimbra /opt

echo
echo 'Unpacking ldap stuff'
cd /opt/zimbra/data/ldap/mdb/db
/bin/rm -f data.mdb
tar xvzSpf data.mdb.tar.gz
chown zimbra:zimbra data.mdb

echo
echo 'fixing permissions'
cd /opt/zimbra
/opt/zimbra/libexec/zmfixperms -extended
chown -R zimbra:zimbra /opt/zimbra/.ssh

At this point, you have a broken zimbra instance but the next step will repair it. Ignore the warning below from the install step about the license.


# cd zcs-NETWORK-8.0.9_GA_6191.RHEL6_64.20141103151719

# ./install.sh --skip-activation-check

Almost there… fix the ip addresses. Replace X.X.X.X with new server


% zmprov -l ms `zmhostname` zimbraMtaMyNetworks '127.0.0.0/8 X.X.X.X/32'

% postfix reload

# vi /opt/zimbra/conf/opendkim-localnets.conf
# vi /opt/zimbra/conf/amavisd.conf
# vi /opt/zimbra/conf/salocal.cf

You can repeat this as often as required and test the server prior.  The next step will prevent you from rolling back so if that happens, one must do an ./install -u first.

Install the upgraded version of Zimbra. Once you upgrade, you can’t roll back the version of zimbra to a previous release without repeating all these steps.

 # cd zcs-NETWORK-8.6.0_GA_1153.RHEL6_64.20141215151258 # ./install.sh 

Update 10/25/2016:

When moving a 8.6 site with this method, zimbra will attempt to install their DNS caching server. That means the install will bring up the config menu because you have a port conflict on port 53. Choose option 5 and then option 1 for status and disabled that. No need as we are running bind with split-brain to make this work correctly.

If moving to Zimbra 8.7, they require that you having proxying enabled for everything. See readme note: enabling proxy for the commands.

Update 11/1/2016:

This method works so well that the following can be done.  rsync data to newserver, then install -s –skip-activation-check; then rsync data as directed above. This is the case where you have forgot to install the zimbra software but don’t want to blow away all that real data your rsync’d.