Page 6 of 22 FirstFirst ... 4567816 ... LastLast
Results 51 to 60 of 211

Thread: Full Server Backup and Restore of “open source version”

  1. #51
    Join Date
    Jan 2006
    Posts
    83
    Rep Power
    9

    Default

    Quote Originally Posted by marcmac
    Well, I didn't write that script, so I'm not sure what's going on with it - but did you run it as the zimbra user? After su - zimbra?
    this is really awesome- guys really, think about this

    zimbra employee helps to troubleshoot the backup script that has been created to help work around one of the limitations of the free version of zimbra. These people are nerds, who love the software.

    So many other "exchange killers" including products like notes, groupwise, are all written by the same sort of people that write exchange. THATS WHY THEY ALL SUCK!

    marc honestly, stuff like this is why i'm going to buy zimbra for my office
    Last edited by robbyt; 03-02-2006 at 03:44 PM.

  2. #52
    Join Date
    Dec 2005
    Posts
    43
    Rep Power
    9

    Default Progress

    Quote Originally Posted by mubley
    I've tested the backup script on Zimbra GA on CentOS 4.2 and it works fine for me. The problem you're seeing must be specific to MacOS. Unfortunately, I don't have access to a Mac so I can't help you any further. Sorry.

    I'm making some progress. I needed to modify the script to add in the correct path to the mysql.sock file in the arguments to mysqldump. (--socket=/opt/zimbra/db/mysql.sock) However, now I'm getting an access denied message during the mysqldump portion of the script. Is there a u/p I need in order to access the mysql database?

    If I don't use the --socket argument, it complains about not being able to connect using the /tmp/mysql.sock file (which obviously doesn't exist).
    Last edited by yetdog; 03-08-2006 at 08:33 AM.

  3. #53
    Join Date
    Sep 2005
    Posts
    2,103
    Rep Power
    14

    Default

    Yes.

    zmlocalconfig -s | grep mysql will show the user/pass

  4. #54
    Join Date
    Dec 2005
    Posts
    43
    Rep Power
    9

    Default

    Quote Originally Posted by marcmac
    Yes.

    zmlocalconfig -s | grep mysql will show the user/pass
    Once again, a Zimbra employee with no obligation to contribute helps out I was able to hardcode the u/p into the mysqldump script and it works flawlessly now. Thanks!

  5. #55
    Join Date
    Sep 2005
    Posts
    2,103
    Rep Power
    14

    Default

    Hardcoding is teh suxor.

    Add this to the top of the (assuming bash) script:

    source /opt/zimbra/bin/zmshutil || exit 1
    zmsetvars

    Now all of the zmlocalconfig variables will be in your env, so you can:

    mysql -u ${zimbra_mysql_user} -p ${zimbra_mysql_password} ...

    And it will work on everyone's box.

  6. #56
    Join Date
    Mar 2006
    Posts
    10
    Rep Power
    9

    Default the trick is keeping everything in sync...

    I know the OS version is limited for a reason, but I'm going to ask anyway..

    If I simply dump the users's sql mailbox db, and restore from that dump later, will that work as an effective, per-mailbox backup or is it more than just the mailbox db's that are needed to backup the user data?

  7. #57
    Join Date
    Aug 2005
    Location
    San Mateo, CA
    Posts
    4,789
    Rep Power
    19

    Default

    It's more. You need the mailbox data on disk(messages), LDAP, and the journal files for point-in-time recovery.
    Looking for new beta users -> Co-Founder of Acompli. Previously worked at Zimbra (and Yahoo! & VMware) since 2005.

  8. #58
    Join Date
    Feb 2006
    Location
    Pune, India
    Posts
    294
    Rep Power
    9

    Default Does this look Ok?

    This is what I did, and experimented with one account in Zimbra. It worked well. But don't know if it is technically correct to do so.

    Code:
    #!/usr/bin/perl
    use POSIX;
    
    # You can change the below given three directories to point to relevant directories on your system
    # DO NOT FORGET to put a trailing "/" after the directory names, else the results wont be good!
    
    # This is where Zimbra is installed.
    my $zimbra_src = "/opt/zimbra/";
    
    # This is where it needs to be synced.
    my $zimbra_synced = "/opt/zimbra_synced/";
    
    # This is where the snapshots are stored.
    my $zimbra_snaps = "/opt/zimbra_snaps/";
    
    ######################### Please dont change anything below this line #########################
    
    my $introduction = qq[
    This script will:
    
            Step 1. Put the entire running instance of Zimbra under maintenance mode. During the maintenance mode all users will have Read-Only access.
            Step 2. Sync the contents of $zimbra_src to $zimbra_synced directory.
            Step 3. Change Zimbra's mode from maintenance to active.
            Step 4. Create a gzipped tarball, as a snapshot from the contents of Synced directory and store it in $zimbra_snaps.
    
    Warning:
            1. This script can take a lot of time depending upon the size of your Zimbra directory. Please do not interrupt it in the process.
    
    Advice:
            It is preferred that you run this script as \"nohup zimbra_backup &\" or run it using cron. This way the process of backup will not be interrupted.
    
    ];
    
    print $introduction;
    
    # Check if the directories mentioned above exist
    
    if (!(-e $zimbra_src)) {
            print "Oops! You specified the wrong Zimbra directory.\n";
            exit;
    }
    
    if (!(-e $zimbra_synced)) {
            print "The directory Syncing that you have specified does not exist. So, creating $zimbra_synced ...\n";
            mkdir ($zimbra_synced, 0700);
    }
    
    if (!(-e $zimbra_snaps)) {
            print "The directory for storing snapshots that you have specified does not exist. So, creating $zimbra_snaps ...\n";
            mkdir ($zimbra_snaps, 0700);
    }
    
    my $cmd_maintenance = "sudo -u zimbra /opt/zimbra/bin/zmcontrol maintenance";
    
    # Changing to maintenance mode
    print "Now, Changing to maintenance mode ...            (READ-ONLY MODE ENABLED)\n";
    system($cmd_maintenance);
    
    # Using rsync for syncing
    my $cmd_rsync = "rsync -av $zimbra_src $zimbra_synced";
    print "Now, Using rsync to sync the data...\n";
    system($cmd_rsync);
    
    # Going out of maintenance mode
    print "Now, Changing out from maintenance mode ...      (NORMAL MODE ENABLED)\n";
    system($cmd_maintenance);
    
    # Get the date and time
    $ENV{TZ} = ':/usr/share/zoneinfo/Asia/Calcutta';
    my $current_date_time = POSIX::strftime('%Y-%B-%d-%H-%M-%S', localtime(time));
    
    # Create filename for gzipped tarball
    my $targz_filename = "zmbak-$current_date_time.tar.gz";
    $targz_filename = "$zimbra_snaps"."$targz_filename";
    
    my $cmd_gztar = "tar -Pcvzf $targz_filename $zimbra_synced";
    
    print "Now, Creating a gzipped tarball from the synced directory ...\n";
    system($cmd_gztar);
    
    print "Done! Thank-you for using this script!\n";
    I am editing this post because I think it will be good to explain what the script above does:

    This script will:

    Step 1. Put the entire running instance of Zimbra under maintenance mode. During the maintenance mode all users will have Read-Only access.
    Step 2. Sync the contents of /opt/zimbra to /opt/zimbra_synced directory.
    Step 3. Change Zimbra's mode from maintenance to active.
    Step 4. Create a gzipped tarball, as a snapshot from the contents of Synced directory and store it in /opt/zimbra_snaps.

    Is this logically, Ok?

    Thank-you,

    Sincerely,

    Chintan Zaveri.
    Last edited by czaveri; 04-03-2006 at 10:55 PM.

  9. #59
    Join Date
    Dec 2005
    Posts
    44
    Rep Power
    9

    Default zmcontrol

    Is this logically, Ok?

    Thank-you,

    Sincerely,

    Chintan Zaveri.
    Hi Chintan,

    I don't think that "zmcontrol maintenance" will give you a consistent backup. It may appear to work for your test machine with only one account, but it probably won't work for a production machine that constantly receives email. It appears to me that "zmcontrol maintenance" doesn't actually do anything (at least in 3.0.1_GA_160.RHEL4). Here's the relevant snippet from /opt/zimbra/bin/zmcontrol:
    Code:
    sub setMaintenanceMode {
            my $mode = shift;
    }
    You could, however, do something like the following (this is taken from my bash script that you can find earlier in this thread):
    Code:
    echo
    echo --------------------------------------------------------
    echo Setting all accounts to maintenance mode.
    echo --------------------------------------------------------
    for i in `$zimbra_dir/bin/zmprov gaa`
    do
    $zimbra_dir/bin/zmprov ma $i zimbraAccountStatus maintenance
    done
    
    -->Insert your rsync here<--
    
    echo
    echo --------------------------------------------------------
    echo Setting all accounts to active mode.
    echo --------------------------------------------------------
    for i in `$zimbra_dir/bin/zmprov gaa`
    do
    $zimbra_dir/bin/zmprov ma $i zimbraAccountStatus active
    done

  10. #60
    Join Date
    Feb 2006
    Location
    Pune, India
    Posts
    294
    Rep Power
    9

    Default Thanks mubley

    Thank-you very much, mubley,

    This will be very helpful.

    Regards,

    Chintan Zaveri.

Similar Threads

  1. mailbox backup & restore on open source version
    By Artturi in forum Administrators
    Replies: 3
    Last Post: 07-30-2010, 04:26 PM
  2. Restore single account failed from full backup
    By fmodola in forum Administrators
    Replies: 4
    Last Post: 06-20-2007, 05:27 AM
  3. 3 testing: LDAP: 389 Failed when restore zimbra
    By victorLeong in forum Administrators
    Replies: 15
    Last Post: 05-24-2007, 06:45 AM
  4. copying only last full backup to store offsite
    By riccadus in forum Administrators
    Replies: 0
    Last Post: 01-11-2007, 12:29 AM
  5. Zimbra Full Backup and Restore???
    By jgao in forum Administrators
    Replies: 3
    Last Post: 01-19-2006, 12:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •