Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
 
Go Back   Zimbra - Forums > Zimbra Collaboration Suite > Installation

Welcome to the Zimbra - Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack (2) Thread Tools Display Modes
  2 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 09-18-2007, 10:38 PM
Special Member
 
Posts: 120
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, 10:44 PM
Zimbra Consultant
 
Posts: 5,606
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, 01:36 PM
Loyal Member
 
Posts: 78
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 01:37 PM. Reason: clearity
Reply With Quote
  #4 (permalink)  
Old 10-17-2007, 06:00 AM
Advanced Member
 
Posts: 227
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, 08:24 AM
Advanced Member
 
Posts: 184
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, 03:47 PM
Junior Member
 
Posts: 7
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, 07:22 AM
Junior Member
 
Posts: 5
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, 08:26 AM
Junior Member
 
Posts: 5
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, 06:22 AM
Active Member
 
Posts: 25
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, 12:58 PM
Member
 
Posts: 13
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


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

Zimbrablog.com