Page 1 of 4

[SOLVED] Zimbra to Zimbra Migration Script

Posted: Fri Sep 26, 2008 3:48 am
by hinyinlam
Hi

VERSION 2.03 IS OUT! SEE THE LAST REPLY!

Since I have problem transferring the old Zimbra to my Zimbra installation, I have decided to write a script to automatically transfer all data to the new installation. The old and new installation are of different domain!
Best of all, interruption for the source server is minimum as you can first rsync the data and then later on move it to the new server
Assumption

1. since this script don't setup anything for you, it just move user's data to the correct position, please setup your Zimbra, create users USING SAME NAME----@source_server.com and @target_server.com will be consider the same person!
2. I assume the source server and SSH without password to the target server, I also assume you are root user, setup any SSH authen permission etc.....
3. I assume both target and source servers are of the same Zimbra version
4. I assume that this script MAY corrupt your data, making your users upset, BACKUP BACKUP AND BACKUP (just tar jcvf zimbra.tar.bz2 /opt/zimbra! so simple!)

5. I am not responsible for any damages caused by the script, provided as is.

6. I assume you will give some response and submit some feature/bug to me, ok?:)
Precedure

1. start both server's Zimbra, edit the parameters in the script file

2. in source server (where you want the data copy from), run Zimbra2Zimbra.sh

3. run /opt/zimbra/libexec/zmfixperms
Done!

Zimbra2Zimbra.zip


[SOLVED] Zimbra to Zimbra Migration Script

Posted: Mon Sep 29, 2008 9:59 pm
by hinyinlam
This version fixed many issues and improved stability by simplifying codes.

It works as the followings:

1. you created accounts on both servers with same names (ie on source server abc@123.com and target server abc@any_other_domain.com)

2. it will then get mailbox id of abc@123.com from source server and abc@any_other_domain.com from target server

3. it will convert all database things from abc@123.com to abc@any_other_domain.com

4. copy all mapped mailbox to destination

5. restart the target server so make everything fresh
Fixed issues:

1. duplicate object exists during send email

2. no such mailbox/ no such folder error during login
Improvement:

1. split script into two parts: Source Server and Target Server part to improve stability

2. speed up SQL processing

3. use soft link to map mailbox instead of moving it, so repeatedly run the script will don't have to rsync from scratch, so any interrupted/inconsistent will be fixed very quick
How to use:

1. source server must have root access to target server using passwordless SSH, ie ssh don't have to type password

2. unzip my scripts, chmod +x them

3. run Zimbra2Zimbra.sh
Please give some comment on the script

Zimbra2Zimbrazip.zip


[SOLVED] Zimbra to Zimbra Migration Script

Posted: Mon Sep 29, 2008 11:27 pm
by mmorse
Nice usage of mysqldump & I like your logic for managing the store blobs - quite ingenious!

[SOLVED] Zimbra to Zimbra Migration Script

Posted: Tue Sep 30, 2008 2:42 am
by hinyinlam
how's the checkpoint values generated?

any algorithm?

[SOLVED] Zimbra to Zimbra Migration Script

Posted: Wed Oct 08, 2008 10:29 pm
by hinyinlam
Improvement:

Since sometime the target server / source servers are busy, rsync and sed will occupy too much IO resource (ie too aggressive), use of IONice with the lowest priority will avoid killing your server, especially those who use LVM snapshot in combine with dm-crypt

Zimbra2Zimbra.zip


[SOLVED] Zimbra to Zimbra Migration Script

Posted: Thu Oct 09, 2008 4:52 pm
by ThorGoLucky
Hi, will this script work if the Service Host Name is different on the new server?
old mail.mu.university.edu --> new mail.nonprofitcorporation.com
Thanks!

[SOLVED] Zimbra to Zimbra Migration Script

Posted: Thu Oct 09, 2008 9:28 pm
by hinyinlam
sure!

see in the Target.sh line 1:

IGNORE_DOMAIN_DIFFERENCE=1

meaning that the script will only match username

ie @mail.mu.university.edu will match @mail.nonprofitcorporation.com

[SOLVED] Zimbra to Zimbra Migration Script

Posted: Tue Oct 14, 2008 10:24 pm
by hinyinlam
Improvement:

Rsync now know how to delete non-exist files and build hardlinks on the target server

What a space saving!

ZimbraZimbraMigration.zip


[SOLVED] Zimbra to Zimbra Migration Script

Posted: Thu Oct 16, 2008 8:22 am
by Ger
Hello people.

Last week I decided to migrate one domain, to another zimbra server because I need to give a client of the company where I work, the managment of the accounts from his domain, I´ve notice that I could do it with network edition of zimbra, but my cheff doesen´t want to buy the licence, and I would have to migrate the whole server to the newone with network edition too. that´s not what I wanted.

so, I have two posibilites to do it, the first and easy one, would be to migrate the accounts from the domain, passwords, mailboxes and all the caracteristics of each account to the new server, but I really don´t know how can I do it, the second posibility, is to clone one server to the other, and change the pubiic IP on the dns server for that domain. but I´m having problems with ldap, first of all, I want to duplicate the ldap database from old server to new server. but when I run zmcontrol start, it starts all services OK and when starts ldap I recive the message "Unable to determine enabled services from ldap, Enabled services read from cache. Service list may be inaccurate" and I cannot access to webmin. I thought it has something to do with /etc/hosts or resolving mx records, but I could bring up a zimbra server without A and MX record, and a functionaling /etc/hosts. so that isn´t the problem.
Can you give me please some help about it?

thank you for reading this large question, and sorry for my bad english!

[SOLVED] Zimbra to Zimbra Migration Script

Posted: Fri Oct 17, 2008 2:07 am
by hinyinlam
[quote user="Ger"]Hello people.

Last week I decided to migrate one domain, to another zimbra server because I need to give a client of the company where I work, the managment of the accounts from his domain, I´ve notice that I could do it with network edition of zimbra, but my cheff doesen´t want to buy the licence, and I would have to migrate the whole server to the newone with network edition too. that´s not what I wanted.

so, I have two posibilites to do it, the first and easy one, would be to migrate the accounts from the domain, passwords, mailboxes and all the caracteristics of each account to the new server, but I really don´t know how can I do it, the second posibility, is to clone one server to the other, and change the pubiic IP on the dns server for that domain. but I´m having problems with ldap, first of all, I want to duplicate the ldap database from old server to new server. but when I run zmcontrol start, it starts all services OK and when starts ldap I recive the message "Unable to determine enabled services from ldap, Enabled services read from cache. Service list may be inaccurate" and I cannot access to webmin. I thought it has something to do with /etc/hosts or resolving mx records, but I could bring up a zimbra server without A and MX record, and a functionaling /etc/hosts. so that isn´t the problem.
Can you give me please some help about it?

thank you for reading this large question, and sorry for my bad english![/QUOTE]

my script may work with NetworkOpenSource or OpenSourceNetwork version because the part that the script change should be the same between different editions
unable to determine enabled services may be because of ssh login issues.