View Single Post
  #5 (permalink)  
Old 11-05-2007, 01:43 PM
Rich Graves Rich Graves is offline
Outstanding Member
 
Posts: 596
Default

I did 2500 users in 36 hours last July with essentially no user-visible downtime, though the total volume of mail was only 500GB.

I used a set of queue/lockfile directories to keep 4 simultaneous imapsync jobs going.

Of the 3 boxes involved, the imapsync host in the middle needs to be the most powerful.

For the two weeks before the migration, I ran imapsyncs in a loop (one simultaneous job during peak hours, three simultaneous jobs off hours), copying mail from user@carleton.edu on the Cyrus server to user@migrate.carleton.edu in the Zimbra server. The per-user final sync process was:

- Pick the next available user from the "todo" queue; move lockfile into "doing" queue.

- Incremental imapsync, AUTH PLAIN as the cyrus admin user on the originating end, and as a Zimbra admin user on the destination. Here's my command line. ldap2migrate.pl populates the Zimbra directory from our enterprise directory (trivial script, but probably only locally useful), and all the regtrans2's are necessary to work around folder names that conflict with default calendars/addressbooks/etc and the fact that ":" seems to be illegal in Zimbra folder names.

Code:
#!/bin/sh
ssh zimbra@mail2 "(ldap2migrate.pl carlnetid=$* | zmprov)"
imapsync --host1 original-imap.carleton.edu --host2 new-zimbra.carleton.edu\
 --buffersize 8192000 \
 --user1 $* --user2 $*@migrate.carleton.edu --nosyncacls --noauthmd5 --ssl1 --ssl2 --sep1 /\
 --exclude '^Trash-not-migrated$|^Trash$|^trash$|^Deleted Messages$' \
 --syncinternaldates --authuser1 cyrus --authuser2 zimbra-superuser@carleton.edu\
 --useheader Message-ID --useheader Date --skipsize --subscribe --prefix1 ''\
 --expunge2 --passfile1 /root/cyrus-pass --passfile2\
 /root/zimbra-pass  --authmech1 PLAIN --authmech2 PLAIN --delete2\
 --expunge1 --regextrans2 's/^Calendar$/Calendar (old)/' \
 --regextrans2 's/^CALENDAR/CALENDAR (old)/' \
 --regextrans2 's/^Contacts$/Contacts (old)/'\
 --regextrans2 's/^Notes$/Notes (old)/'\
 --regextrans2 's/^calendar$/calendar (old)/'\
 --regextrans2 's/^contacts$/contacts (old)/'\
 --regextrans2 's/^notes$/notes (old)/' --regextrans2 's/: / /g'\
 --regextrans2 's/://' --regextrans2 's/^Contacts\//Contacts (old)\//i'\
 --regextrans2 's/^Calendar\//Calendar\//i'\
 --regextrans2 's/^Notes\//Notes (old)\//i' 2>&1\
 >> /var/log/migration/$*-cyrus-zimbra-migrate 2>> /var/log/migration-err/$* ||
mail -s "imapsync errors $*" admin-account@carleton.edu < /var/log/migration-err/$*
- When that incremental imapsync is done, rename the Cyrus account to user.migrate (which has the effect of locking out the user); set forwarding for user@carleton.ed to a mailer that simply queues; create a new Cyrus account "user" with a couple placeholder messages to the effect "your mail is being synchronized to the new server, please try Zimbra in 15 minutes"; and run another incremental imapsync

- When the second imapsync is done (typically only a minute, though multi-gigabyte mailboxes took as long as 30 minutes simply to list), rename the Zimbra account from user@migrate.carleton.edu to user@carleton.edu, then set forwarding on the original system to deliver to Zimbra

- Move the lockfile for user to the "done" directory

If your source server is something other than Cyrus imapd, then renaming accounts might be a little less trivial, but you ought to be able to do something similar.
Reply With Quote