Difference between revisions of "Moving ZCS to New Server"

(Method For Open Source Edition Users)
(Redirected page to ZCS to ZCS rsync Migration)
Line 1: Line 1:
{{WIP}}{{Unsupported}}{|  width="100%" border="0"
#REDIRECT [[ZCS_to_ZCS_rsync_Migration]]
|  bgcolor="orange" | [[Image:Attention.png]]
This article describes the steps to move a ZCS server to a new physical or virtual server. '''This wiki article is NOT supported by the Zimbra Support team for Network Edition Customers. The only two supported method to follow are the [[Network_Edition_Disaster_Recovery]] and [[Ajcody-Notes-Server-Move]] wiki pages.''' Server moves not following these two wiki pages will not be supported by the Zimbra Support team.
{{Article Infobox|{{admin}}||{{ZCS 8.6}}|{{ZCS 8.5}}|{{ZCS 8.0}}}}This article contains two ways to move ZCS setup from your existing server to new server.
'''''Note:''' For Network Edition Customers, there have been updates to the zmrestore command in ZCS 6.0.  To find out more about these updates, see [[CLI zmrestore Network Edition only]].''
=Method For Network Edition Customers=
If you are moving to new server and have latest backup with you then you should follow these steps:
* Install a new server. Keep the "hostname" and "zmhostname" same as old server.
* Take a latest full backup and after taking a full backup also take a incremental backup in your current running server. Running an incremental backup will copy the redologs and the backup will be up to date.
* Install the same version of ZCS which is running on your current system.
* Copy /opt/zimbra/backup directory from the old server to the new server in the same location.
* Now restore the data on new server using "zmrestore" command as follows:
$ zmrestoreldap -lb <label> ( Label of latest full backup )
If you are restoring large number of accounts, you may want to run this command with nohup so that the session does not terminate. (Observe whether the LDAP server is started successfully after the restore, it must be running for the next steps).
'''''Note:''' To find the LDAP session label to restore, type '''zmrestoreldap –lbs'''.''
$ zmrestore -sys -ra -a all -c
After issuing this command the data will get restored properly and if any error occurs it will be prompted after the process is completed.
You will get an notification that admin and wiki accounts are not restore, which you have to restore manually after this, as follows:
$ zmrestore -a admin@yourdomain.com
$ zmrestore -a wiki@yourdomain.com
=Method For Open Source Edition Users=
Second method which you can follow is using rsync command.
'''You need to have the same Operating System on both, old and new server:'''
==Old server==
* Stop your existing Zimbra Collaboration like zimbra user:
zmcontrol stop
* Check if no zimbra process is running if so kill that process.
ps -efa | grep zimbra
* A recommendation is to use a external NFS to save the cold Backup. For example:
mkdir /mnt/backup
mount YOURNFSSERVERIP:/backup /mnt/backup
* Do a cold and offline backup of '''/opt/zimbra''' directory using rsync command, like root:
rsync -avHK /opt/zimbra /mnt/backup/zimbra.bak
After a while will end with something like this:
sent 22,445,201,818 bytes  received 847,852 bytes  7,426,319.16 bytes/sec
total size is 22,449,064,081  speedup is 1.00
* Run the next commands to know the exact hostname, and zmhostname of the old server, like zimbra user:
hostname -a
hostname -f
==New server==
* On new server, '''install the same version''' of Zimbra Collaboration and keep the "hostname" and "zmhostname" same as old server.
* Stop Zimbra Collaboration on new server:
zmcontrol stop
* Remove the complete zimbra directory:
rm -rf /opt/zimbra
* Restore from cold backup using rsync command:
rsync -avHK /mnt/backup/zimbra.bak /opt/zimbra
= Switch from 32-bit to 64-bit =
If your operating system and hostname are the same, but you are switching from 32-bit to 64-bit, follow [[Network_Edition:_Moving_from_32-bit_to_64-bit_Server]] (This applies to both the Open Source and the Network Editions). The server can also have a '''different operating system'''.
= Switch Operation Systems or Hosts Using rsync =
<u>'''These are experimental notes on migrating from Fedora Core 6 x64 (running RHEL5 version) to Ubuntu 10.04 x64 (running Ubuntu 10.04 version) on a new host with ZCS 6.0.8, but may be applicable to other switches'''</u>
* Stop your existing ZCS using <tt>zmcontrol stop</tt>.
* Follow the instructions on [[Network_Edition:_Moving_from_32-bit_to_64-bit_Server]] to export the LDAP configuration from the old server (you'll import it later)
* Check that no zimbra process is running - if not kill that process.
* Backup your <tt>/opt/zimbra</tt> folder to the new server:
    # rsync -avHS /opt/zimbra/ newserver:/opt/zimbra.$oldserver/
* Perform a clean install of the same version of Zimbra as you had on the old server, on the new server (with the new server as the default hostname)
* Shut down zimbra on the new server using <tt>zmcontrol stop</tt>
* Copy the data and config from your old server over the relevant directories on the new server (as root):
    # cd /opt/zimbra
    # mkdir /var/tmp/zcs-distribution-backup
    # mv conf data db index logger postfix-*/conf redolog store /var/tmp/zcs-distribution-backup
    # for f in conf data db index logger postfix-*/conf redolog store ; do mv /opt/zimbra.$oldserver/$f/ $f/ ; done
    # rm data/postfix/spool/pid/master.pid
* Follow the instructions on [[Network_Edition:_Moving_from_32-bit_to_64-bit_Server]] to import the LDAP configuration from the old server to the new one. Note that you should rather pass the exact <tt>ldap.bak</tt> filename than the whole directory or <tt>slapadd</tt> can hang
* If the <tt>uid</tt> or <tt>gid</tt> of the zimbra user have changed, edit them in <tt>/opt/zimbra/conf/localconfig.xml</tt>
* Run <tt>/opt/zimbra/libexec/zmfixperms</tt> as root
* This is now a version of Zimbra for your new operating system, with your old operating system's data, that thinks it's still the old hostname
* Add your old servername to <tt>/etc/hosts</tt> but make it point at the new server's IP address
* Start up <tt>ldap</tt> as zimbra:
    # ldap start
* Change the hostname with <tt>zmsetservername -n $newserver</tt> following [[ZmSetServerName]] instructions to see if there are any other values that need changing. (You should also search for IP addresses like <tt>zimbraMtaMyNetworks</tt> etc)
* Restart zimbra on the new server with <tt>zmcontrol restart</tt>
* Remove your old servername from <tt>/etc/hosts</tt>
* Check that everything starts up OK by watching <tt>/var/log/zimbra.log</tt>. If not debug, rinse and repeat
{{Article Footer|Zimbra Collaboration 8.6, 8.5, 8.0|02/29/2008}}
[[Category:Server Move]]

Latest revision as of 16:34, 25 June 2015

Jump to: navigation, search