Platform and OS Independent ZCS to ZCS Migration Using Rsync: Difference between revisions

No edit summary
No edit summary
Line 109: Line 109:
Restore the LDAP data to the new server. As zimbra, type on new server:
Restore the LDAP data to the new server. As zimbra, type on new server:
  rm -rf /opt/zimbra/data/ldap/hdb/*
  rm -rf /opt/zimbra/data/ldap/hdb/*
rm -rf /opt/zimbra/data/ldap/config/*
If this is an ldap master with replicas:  
If this is an ldap master with replicas:  
  rm -rf /opt/zimbra/data/ldap/accesslog/*
  rm -rf /opt/zimbra/data/ldap/accesslog/*

Revision as of 23:07, 17 January 2013

This is a method for ZCS to ZCS migration that preserves all settings and user accounts. It may work across differing OSs and hardware platforms, including 32 bit to 64 bit server migrations. While it has been tested by Zimbra staff and customers, this documentation is community contributed, and is not certified Zimbra documentation.

While it may be possible to to move between different Operating Systems using rsync, we have not tested every combination, and some may fail due to various incompatibilities.


Attention.png

IT IS PREFERRED TO USE THE SAME LINUX DISTRIBUTION AND RELEASE. FAILURE TO DO SO CAN RESULT IN ERRORS.

MIGRATING PRODUCTION SERVERS WITHOUT TESTING CAN RESULT IN PRODUCTION OUTAGE.

WE STRONGLY ENCOURAGE performing a test run of the process using a virtual machine or non-production server. This would require a small downtime window while the last rsync is performed.

IMPORTANT Please review this important background information. Should you encounter difficulty, it will be important to know what you are actually doing. This wiki is meant to provide the steps in a simplified manner, but it is NOT meant to replace the following documentation.

Network Edition: Moving from 32-bit to 64-bit Server

Ajcody-Notes-Server-Move

Ajcody-Notes-Server-Move#The_Actual_Steps

King0770-Notes-YAMM

Attention.png



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 --progress -avzHS -e ssh  /opt/zimbra/ root@NEWHOSTIP:/opt/zimbra


Move Day-

STOP SERVICES ON OLD HOST. Failure to stop services can result in data corruption on the target host.

zmcontrol stop

Perform last rsync as root on old host.

nice -n -20 rsync -avzHS -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. Backup LDAP config data, type:

/opt/zimbra/libexec/zmslapcat -c /backup

e. On new host, do:

mkdir /backup

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

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

g. From old host, copy over the ldap-config.bak file:

scp /backup/ldap-config.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/*
rm -rf /opt/zimbra/data/ldap/config/*

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 -n 0 -F /opt/zimbra/data/ldap/config -cv -l /backup/ldap-config.bak 

Type:

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


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

Make sure that the UID for the zimbra user is the same as before. If it has changed, edit /etc/passwd to make it match the zimbra user UID on the old server.

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.

Note for Ubuntu users: Some users have reported issues with the slapadd commands failing on the new server due to the inability of 64 bit Ubuntu to run the old 32 bit slapadd command copied from the old server. One possible workaround is to install the 32 bit runtime libraries on the new server.

apt-get install ia32-libs
Jump to: navigation, search