Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
  2 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 09-18-2007, 09:38 PM
fisch09 fisch09 is offline
Special Member
 
Join Date: Dec 2006
Location: Melbourne, VIC, Australia
Posts: 115
fisch09 is on a distinguished road
Wink How to: cold standby server (no cluster)

Hi,

Having a cold standby server in a different location would be nice. But at this point you can't use clustering anymore. So I spent some time and build a cold standby. Here is how I did it.

System: ZCS 4.5.6 NE on Ubuntu 6.06.1

Step one:
Create a 1:1 copy of your server. You can use what ever you prefer LVM snapshot, physical hard drive copy, rsync. I used rsync as I don't have physical access to server. Important for this step: zimbra needs to be down to make sure its really 1:1.

Step two:
Adjusting DNS. As zimbra wont start if the DNS is not correct we have to fake a bit.
Lets say the primary server is: zmail.mydomain.tld - add an additional DNS entry for this server zmail2.mydomain.tld
Install a local DNS server on your cold standby server - I used dnsmasq.
We need this DNS server so the cold standby server can use the FQDN of your primary server while having a different IP. To do this I added this line in /etc/dnsmasq.conf:
Code:
address=/zmail.mydomain.tld/192.168.1.100
and changed /etc/hosts to:
Code:
127.0.0.1       localhost.localdomain localhost
192.168.1.100  zmail.mydomain.tld zmail
Now the cold standby server can use "zmail.mydomain.tld" to run a local zimbra configured for you primary server and still access the primary server using zmail2.mydomain.tld.

Step three:
Configure password less ssh using ssh keys - we need this to use rsync in a cron job.

Step four:
To be sure nothing is going wrong while syncing the backups I moved /opt/zimbra/backup to /zmailbackup.

Step five:
Create some scripts to control the sync / restore and if your server is "cold standby" or "active"

/root/coldstandby is just a file. I use it to check if the server is in "cold standby" modus or live.

/root/change.zimbra.status.sh is used to change the function from "cold standby" to "live". If the server is live you don't want to sync with your primary server anymore.....

Code:
#!/bin/bash
case $1 in
"status")
   if [ -f /root/coldstandby ]; then
   echo "server is in cold standby modus"
   else
   echo "server is LIVE"
   fi
   ;;
"cold")
   echo "switching into cold modus"
   echo "... remove start scripts"
   update-rc.d -f zimbra remove
   echo "... activate sync, backup, restore"
   echo "if this file is missing server is live" > /root/coldstandby
   echo "... stop zimbra"
   /etc/init.d/zimbra stop
   echo "... done"
   ;;
"hot")
   echo "switching into live modus"
   echo "... install start scripts"
   update-rc.d zimbra defaultis 99
   echo "... deactivate sync, backup, restore"
   rm /root/coldstandby
   echo "... check if a restore is running"
   RESTORE=`ps fax | grep -i java | grep -i restore | wc -l`
   if [ $RESTORE -gt 0 ]; then
     while [ $RESTORE -gt 0 ]; do
       echo "!!! FOUND ACTIVE RESTORE PROCESS PLEASE WAIT UNTIL FINISHED !!!"
       echo "... waiting for 5 min, and check again"
       sleep 3000
       RESTORE=`ps fax | grep -i java | grep -i restore | wc -l`
     done
   fi
   echo "... no restore runnin anymore ... going live now"
   /etc/init.d/zimbra stop
   /etc/init.d/zimbra start
   ;;
*)
   echo "help..."
   echo "switch to live modus: ./change.zimbra.status hot"
   echo "switch to cold modus: ./change.zimbra.status cold" 
   echo "query status: ./change.zimbra.status status"
   ;;
esac
/root/sync.live.server.sh syncs the backup folder with the primary server and starts the restore.
Code:
#!/bin/bash
if [ -f /root/coldstandby ];
then
  echo "`date`: start syncing backups" >> /var/log/zimbra.cold.log
  rsync -a root@zmail2.mydomain.tld:/opt/zimbra/backup/* /zmailbackup/
  echo "`date`: start restoring backups" >> /var/log/zimbra.cold.log
  su - zimbra /opt/zimbra/cold.restore.sh
  echo "`date`: restore finished"
else
  echo "`date`: no sync/restore done server considered to be LIVE" >> /var/log/zimbra.cold.log
fi
/opt/zimbra/cold.restore.sh restores the backup
Code:
#!/bin/bash
zmcontrol stop
LABEL=`zmrestoreldap -lbs -t /zmailbackup | sed -n 1p`
zmrestoreldap -lb $LABEL -t /zmailbackup
zmmailboxctl start
zmrestore -a "all" --ignoreRedoErrors -t /zmailbackup
zmcontrol stop
I had trouble with RedoErrors and the only way I could get it to work was using the "--ignoreRedoErrors" option. I also tried to use zmrestoreoffline - but this did not work at all for me. The "zmcontrol stop" at the beginning and the end are just for safety.

The only thing that is left is a cron job. I have this line in my /etc/crontab:
Code:
55 */2  * * *   root   /root/sync.live.server.sh
For me this is 30min after the server did it's backup - which works fine for me.

I know that the "cold standby" server is never 100% up2date but this is ok for me.

Cheers
Andre
Reply With Quote
  #2 (permalink)  
Old 09-18-2007, 09:44 PM
jholder's Avatar
jholder jholder is offline
Zimbra Employee
 
Join Date: Oct 2005
Location: San Mateo, CA
ZCS Version: 5.0.5 RHEL4 64-bit GA
Posts: 5,409
jholder is on a distinguished road
Send a message via Yahoo to jholder
Default

Wow.
Wow.
Wow.

Can you put something in the wiki? If you do, I think I can find some stuff to send you
__________________
Reply With Quote
  #3 (permalink)  
Old 09-26-2007, 12:36 PM
leog21 leog21 is offline
Senior Member
 
Join Date: Sep 2007
ZCS Version: ZCS 5.0.6 on Centos 5 DRBD/HA
Posts: 68
leog21 is on a distinguished road
Default better solution

We've successfully setup Zimbra on a DRBD / Heartbeat solution with automatic failover + one-to-one NAT. I'm currently working on documenting an implementation plan.

Best,
Leo

Last edited by leog21 : 09-26-2007 at 12:37 PM. Reason: clearity
Reply With Quote
  #4 (permalink)  
Old 10-17-2007, 05:00 AM
russgalleywood russgalleywood is offline
Elite Member
 
Join Date: Aug 2006
Posts: 200
russgalleywood is on a distinguished road
Default

This kind of thing sounds great Guys so well done!

i would love to have some kind of backup/sync system for our Zimbra install which does not involve clustering and which could be switched on in case of failure.

Wish I could give you something more than just encouragement but keep up the good work!
Reply With Quote
  #5 (permalink)  
Old 10-17-2007, 07:24 AM
randall randall is offline
Special Member
 
Join Date: Jun 2007
Location: Philippines
ZCS Version: Release 5.0.5_GA_2201.UBUNTU6 UBUNTU6 FOSS edition
Posts: 159
randall is on a distinguished road
Default

great one andre. gratz! keep up the good work and the love for the community....
Reply With Quote
  #6 (permalink)  
Old 10-24-2007, 02:47 PM
SoftDux SoftDux is offline
Junior Member
 
Join Date: Sep 2007
Posts: 7
SoftDux is on a distinguished road
Default

Quote:
Originally Posted by leog21 View Post
We've successfully setup Zimbra on a DRBD / Heartbeat solution with automatic failover + one-to-one NAT. I'm currently working on documenting an implementation plan.

Best,
Leo
Hi leog21

I'm interested to read about your experience with this kind of setup, have you got it done yet?
Reply With Quote
  #7 (permalink)  
Old 01-28-2008, 06:22 AM
okahmad okahmad is offline
Junior Member
 
Join Date: Feb 2007
Posts: 5
okahmad is on a distinguished road
Default

Quote:
Originally Posted by leog21 View Post
We've successfully setup Zimbra on a DRBD / Heartbeat solution with automatic failover + one-to-one NAT. I'm currently working on documenting an implementation plan.

Best,
Leo
Hello Leo,

I hope you were able to make some progress with this document? We are waiting for your guidance.

Best,

Osman
Reply With Quote
  #8 (permalink)  
Old 02-21-2008, 07:26 AM
krag krag is offline
Junior Member
 
Join Date: Feb 2008
Posts: 3
krag is on a distinguished road
Default

If I'm understanding this correctly, when you failover you'll only recover to the point of a last backup on your primary server?

So you'd need to run regular backups (once an hour?)? What kind of impact would this have on performance?

I need to get around the problem of hardware failure, and I quite like this idea but it may be easier to go down the SAN route and share a mount point between two servers?

Thanks.
Reply With Quote
  #9 (permalink)  
Old 05-13-2008, 05:22 AM
RaNd RaNd is offline
Member
 
Join Date: Feb 2007
Location: Greece
ZCS Version: 4.5.5_GA_838.UBUNTU6 // 5.0.5_GA_2201.UBUNTU6 FOSS edition
Posts: 19
RaNd is on a distinguished road
Default

Is ti possible to adjust the scripts so it can work to Open Source Edition ??
Reply With Quote
  #10 (permalink)  
Old 06-22-2008, 11:58 AM
brianfinley brianfinley is offline
Junior Member
 
Join Date: Apr 2006
Posts: 4
brianfinley is on a distinguished road
Default

Quote:
Originally Posted by leog21 View Post
We've successfully setup Zimbra on a DRBD / Heartbeat solution with automatic failover + one-to-one NAT. I'm currently working on documenting an implementation plan.

Best,
Leo
Leo, we are very interested in your solution. Looking forward to seeing your notes -- even if they're still in a raw form.

Thanks!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.zimbra.com/forums/installation/11524-how-cold-standby-server-no-cluster.html
Posted By For Type Date
Zimbra: del.icio.us tag/zimbra This thread Refback 09-27-2007 01:49 PM
Zimbra™ Collaboration Suite - SWiK This thread Refback 09-27-2007 02:36 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
initializing ldap...FAILED(256)ERROR manjunath Installation 37 05-19-2008 06:08 PM
need advice on configuring zimbra to work with fax server pheonix1t Administrators 0 07-11-2007 07:46 PM
Error 256 on Installation RuinExplorer Installation 5 10-19-2006 09:19 AM
Getting problems in FC4 while instalation kitty_bhoo Installation 13 09-12-2006 10:34 PM
Zimbra fails after working for 2 weeks Linsys Administrators 9 10-20-2005 01:26 PM


freshmeat.net sourceforge.net The best Java IDE



 

Search Engine Optimization by vBSEO 3.0.0