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 Thread Tools Search this Thread Display Modes
  #41 (permalink)  
Old 05-05-2011, 12:03 PM
Intermediate Member
 
Posts: 21
Default

I am working on my script now: almost done. One interesting thing i found as that i found zimbra some time crated both full-201105... and incr-201105... folder in backup/sessions folder although it was not supposed to full backup that day. Do anybody know why? I need to figure it out since i need to know which folder for restore ldap and for redolog replay.

Thanks,
Rocky
Reply With Quote
  #42 (permalink)  
Old 05-05-2011, 12:26 PM
Partner (VAR/HSP)
 
Posts: 425
Default

There's lots of info here in the forums. It is the first backup for new accounts. New accounts get a full backup on the day of creation. After that, incrementals.
Reply With Quote
  #43 (permalink)  
Old 05-05-2011, 12:36 PM
Intermediate Member
 
Posts: 21
Default

Quote:
Originally Posted by iway View Post
There's lots of info here in the forums. It is the first backup for new accounts. New accounts get a full backup on the day of creation. After that, incrementals.
You did not get my point, i am wondering which folder (incr or full ) i need to restore for ldap and mailbox. I checked only "incr-date-..." has "redologs" subfolder, i'll use this one for my daily redo log play script.
Reply With Quote
  #44 (permalink)  
Old 05-05-2011, 12:38 PM
Partner (VAR/HSP)
 
Posts: 425
Default

Redologs are in the incr folder, ldap backups should be in both.
Reply With Quote
  #45 (permalink)  
Old 05-05-2011, 03:06 PM
Intermediate Member
 
Posts: 21
Default

Thanks.

I finished all my script and tested my daily cold restore script, works very smooth. I'll post my code here ( use it at your own risks ):

1. All the functions/scripts are running from cronjob:

Code:
# Hourly sync redo log from live to standby
0 * * * * /usr/bin/rsync -avr --delete zimbra-primary.mydomain.com:/opt/zimbra/redolog/ /BACKUP/live_redo_log/ 2>1 >>/var/log/zimbra_sync.log
# Daily (Mon-Fri) sync backup and replay redo log
30 1 * * 1-5 /root/daily_sync_live_server.sh 2>1 >>/var/log/zimbra_sync.log
# Daily (Sun) sync backup and replay redo log, it get delayed because we need to wait rsync and restoreation done before apply redo log
0 12 * * 0 /root/daily_sync_live_server.sh 2>1 >>/var/log/zimbra_sync.log
# Weekly(Sat) sync backup and restore Zimbra whole DB and Mailbox
30 10 * * 6 /root/weekly_sync_live_server.sh 2>1 >>/var/log/zimbra_sync.log
2. weekly_sync_live_server.sh ( in /root directory):

Code:
#!/bin/bash

echo "`date`: start weekly syncing backups"
/usr/bin/rsync -avr --delete root@zimbra-primary.mydomain.com:/zimbabackup/ /zmailbackup/
echo "`date`: start restoring backups"
su - zimbra /opt/zimbra/weekly_cold_restore.sh
echo "`date`: restore finished"
And it called /opt/zimbra/weekly_cold_restore.sh:

Code:
#!/bin/bash
zmcontrol stop
rm -rf /opt/zimbra/db/data/*
/opt/zimbra/libexec/zmmyinit
LABEL=`zmrestoreldap -lbs -t /zimbrabackup | sed -n 1p`
zmrestoreldap -t  /zimbrabackup  -lb $LABEL
zmconvertctl start
zmlocalconfig -f -e zimbra_ldap_password=YOUR_EXIST_LDAP_PASS_ON_LIVE_SERVER
zmmailboxdctl start
zmmailboxdctl stop
cd /tmp; nohup zmrestoreoffline -t /zimbrabackup/ -lb $LABEL -sys -a all -c -br &
The above is just a series commands copied from Network Edition Disaster Recovery - Zimbra :: Wiki ; Note there missed some return results check script, it is just a very simple one. Hope someone else can found more robust auto restoration script. I ran it once, worked for me.

3. daily_sync_live_server.sh ( in /root directory):

Code:
#!/bin/bash

echo "`date`: start weekly syncing backups"
/usr/bin/rsync -avr --delete root@zimbra-primary.mydomain.com:/zimbabackup/ /zmailbackup/
echo "`date`: start restoring backups"
su - zimbra /opt/zimbra/daily_cold_restore.sh
echo "`date`: restore finished"

And here is /opt/zimbra/daily_cold_restore.sh: (play redo log):

Code:
#!/bin/bash
LABEL=`zmrestoreldap -lbs -t /zimbrabackup | grep incr | sed -n 1p`
zmrestoreldap -lb $LABEL -t /zimbrabackup
for i in `ls -rt /zimbrabackup/sessions/$LABEL/redologs/`
do
        echo "Processing /zimbrabackup/sessions/$LABEL/redologs/$i..."
        zmplayredo --logfiles /zimbrabackup/sessions/$LABEL/redologs/$i
done
4. In case live server failure, run this script to apply latest redo log then make it live:

/opt/zimbra/replay_redolog_live.sh:

Code:
#!/bin/bash
for i in `ls -rt /BACKUP/live_redo_log/archive/`
do
        echo "Processing /BACKUP/live_redo_log/archive/$i..."
        zmplayredo --logfiles /BACKUP/live_redo_log/archive/$i
done
zmplayredo --logfiles /BACKUP/live_redo_log/redo.log
zmcontrol stop
zmctrol start
Hope it can help some one else which has the similar situation as me. Our current server configuration:

Live server and standby server: Zimbra NE 7.0.1 on CentOS 5.5
Default backup schedule enabled on live server: weekly full backup, daily incremental, keep last 30 days data
Zimbra user accounts: 100~150
Mailstorage size: 200GB~300GB

For us, the rsync one full backup took 18~24 hours, restoration from one full backup took 4 hours; Replaying one day'd redo log took 10~20 minutes.
Reply With Quote
  #46 (permalink)  
Old 06-28-2011, 08:34 AM
Starter Member
 
Posts: 2
Default How to: cold standby server (no cluster)

Hi,
I've read through this post and just curious to see if anyone is installing a local dns server on the cold standby server. i have inherited the zimbra setup from past admin and the cold-standby server is not starting up. i don't see any dns server on the cold-standy server. should i install the dnsmasq to trick the cold-standby?

thanks
Reply With Quote
  #47 (permalink)  
Old 07-11-2011, 04:31 PM
Moderator
 
Posts: 1,432
Default

I would use dnsmasq. Very simple to configure so that it just does what you need it to do; it's what I use on my cold standby.
__________________
Elliot Wilen
Berkeley, CA

Don't forget to enter your Zimbra version in your forum profile.
Reply With Quote
  #48 (permalink)  
Old 07-11-2011, 07:20 PM
Starter Member
 
Posts: 1
Default

How can use dnsmasq? Will you leave the answer to me..
Reply With Quote
  #49 (permalink)  
Old 07-11-2011, 07:30 PM
Moderator
 
Posts: 1,432
Default

http://www.thekelleys.org.uk/dnsmasq/doc.html

IIRC, it's included in RHEL; you just have to activate it as a service.
__________________
Elliot Wilen
Berkeley, CA

Don't forget to enter your Zimbra version in your forum profile.
Reply With Quote
  #50 (permalink)  
Old 09-19-2011, 07:35 AM
Intermediate Member
 
Posts: 15
Default

Found a good idea using dnsmasq...
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.