Platform and OS Independent ZCS to ZCS Migration Using Rsync

Revision as of 15:17, 16 June 2011 by Lshaughnessy (talk | contribs)

This is a method for ZCS to ZCS migration that preserves all settings and user accounts, and can be done across different OS's and hardware platforms, including 32 bit to 64 bit server migrations. It has been tested by Zimbra staff and customers.

Broadly:

Install Zimbra packages on new host

rsync /opt/zimbra from old host to target host

Import LDAP data

Run Zimbra installer to upgrade files in /opt/zimbra


To Outline:

Install the exact same release of ZCS on the new server using the -s flag. Use the 64 bit version if you are migrating from 32 to 64 bit.

Remove /opt/zimbra on new host.

Rsync /opt/zimbra from the old server to the new server. This can be done several times prior to the move date to save time.


On move date-

Stop services on old server and complete last rsync to the new one.

Repair permissions on the new server.

Make a backup of the LDAP and scp it to the new server.

Rename new server to old host name. Change IP on new host to old IP or change DNS and allow to propagate.

Restore the LDAP from backup.

Re-run install.sh.

Bring new server online.


Some more detail:

Install the just the packages on new host.

./install.sh -s

Remove /opt/zimbra on new host.

rm -rf /opt/zimbra

On old host, rsync /opt/zimbra AS ROOT to the new host.

nice -n +19 rsync -avzH -e ssh --progress /opt/zimbra/ root@NEWHOSTIP:/opt/zimbra


Move Day-

Stop services on old host.

zmcontrol stop

Perform last rsync as root on old host.

nice -n -20 rsync -avzH -e ssh --delete --progress /opt/zimbra/ root@NEWHOSTIP:/opt/zimbra 

Repair permissions on new host.

/opt/zimbra/libexec/zmfixperms --verbose --extended 

Export the LDAP data on the old host:

a. Create an LDAP dump directory. As root, type:

mkdir /backup

b. As root, type:

chown zimbra:zimbra /backup

c. Backup the LDAP data, as zimbra, type:

/opt/zimbra/libexec/zmslapcat /backup

d. On new host, do:

mkdir /backup

e. From old host, copy over the ldap.bak file:

scp /backup/ldap.bak root@newserver.com:/backup 

Rename new host to old name and change IP. If you are not changing the IP, make sure that you have updated DNS and that the hostname resolves to the correct IP. (This varies by distro- /etc/hosts /etc/sysconfig etc). You may want to reboot the host just to be sure the name change takes.

Restore the LDAP data to the new server. As zimbra, type on new server:

rm -rf /opt/zimbra/data/ldap/hdb/*

If this is an ldap master with replicas:

rm -rf /opt/zimbra/data/ldap/accesslog/*
mkdir -p /opt/zimbra/data/ldap/hdb/db /opt/zimbra/data/ldap/hdb/logs

If this is an ldap master with replicas:

mkdir -p /opt/zimbra/data/ldap/accesslog/db /opt/zimbra/data/accesslog/logs

Type:

chown -R zimbra:zimbra /opt/zimbra/data/ldap

Type:

/opt/zimbra/openldap/sbin/slapadd -q -b "" -F /opt/zimbra/data/ldap/config -cv -l /backup/ldap.bak

Note: When migrating from 32 bit to 64 bit openldap.i386 and libgcc.i386 will need to be installed on the new server to support the functions of importing the 32-bit generated ldap database.

Run:

./install.sh 

this time without the -s flag. This will upgrade the files under /opt/zimbra that need to be corrected for the new hardware. Select Y to upgrade. Do not check the database.

Some users have reported that they needed to update the ssh keys after starting the new server:

zmsshkeygen

zmupdateauthkeys

zmcontrol restart

Now your /opt/zimbra/* is the same on both hosts (or upgraded for new hardware by install.sh), and you have imported the LDAP DB, your hostname should be the same as before. You should be able to start Zimbra on the new host.


Please see here for information on the Documents migration:

[[1]]

Jump to: navigation, search