+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 22
Virtual Learning Platforms Thread, Effective Moodle Backups in Technical; Ok i have a cronjob that backups our Moodle db every night, but I'm looking for the best way to ...
  1. #1

    Gatt's Avatar
    Join Date
    Jan 2006
    Posts
    6,819
    Thank Post
    881
    Thanked 685 Times in 454 Posts
    Rep Power
    505

    Effective Moodle Backups

    Ok i have a cronjob that backups our Moodle db every night, but I'm looking for the best way to rsync our moodledata directory?

  2. #2


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,033 Times in 813 Posts
    Rep Power
    341
    but I'm looking for the best way to rsync our moodledata directory?
    We use rsback Error! and pick up the moodledata (and db dump) onto a remote server.
    To keep it simple you could just use rsync, or rsync over ssh to be more secure.

  3. #3

    Gatt's Avatar
    Join Date
    Jan 2006
    Posts
    6,819
    Thank Post
    881
    Thanked 685 Times in 454 Posts
    Rep Power
    505
    That links giving me an error about username & password ?
    trying rsync to our TeraStation at present
    just not sure how often I should do it or hjow much backup history to keep

  4. #4


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,033 Times in 813 Posts
    Rep Power
    341
    we just use rsback in a nightly cron job, logs of the cron get emailed to me nightly.
    The rsback scripts (when the website is working) provide a way of hardlinking files to save diskspace and a good way to rotate the backups.

    here;s googes cache

    rsback: pollux.franken.de

  5. Thanks to CyberNerd from:

    Gatt (9th February 2009)

  6. #5

    Join Date
    Jan 2009
    Posts
    9
    Thank Post
    1
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    How do you back up your database?

  7. #6

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,850
    Thank Post
    110
    Thanked 598 Times in 514 Posts
    Blog Entries
    1
    Rep Power
    227
    I just cronjob a mysqldump into a folder. Then let the file system backup pickup the dumps.

  8. #7

    Gatt's Avatar
    Join Date
    Jan 2006
    Posts
    6,819
    Thank Post
    881
    Thanked 685 Times in 454 Posts
    Rep Power
    505
    I do the same as Geoff for the mysql - its backing up the moodledata folder
    think I have rsync sussed, but its a backup schedule I need to work out as the folder is currently <800MB and growing!

    Do I just overwrite it each time or keep a weekly/monthly copy of it?

  9. #8


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,033 Times in 813 Posts
    Rep Power
    341
    rsync will only copy the file if it has changed. if you use the --delete option it will remove from backup anything that has been deleted from the original. The rsback scripts that I posted will deal with these problems and will save disk space because they snapshot each previous backup.
    Alternatively, just do a nightly backup and put it onto tape once a week.

  10. Thanks to CyberNerd from:

    Gatt (9th February 2009)

  11. #9

    Join Date
    Jan 2009
    Posts
    9
    Thank Post
    1
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    How safe is MysqlDump with the server running?

    If I use this

    Code:
    # Stop MySQLdatabase
    /etc/init.d/mysql stop
    echo `date + \%d/%m/%y.%H:%M:%S ` >> $DATABASEBACKUPLOG
    echo 'Stopping MySQL database.' >> $DATABASEBACKUPLOG
    
    #Dump new files
    for i in $(echo 'SHOW DATABASES;' | $MYSQL -u$MYSQLUSER -p$MYSQLPWD -h$MYSQLHOST|$GREP -v '^Database$'); do
      $MYSQLDUMP                                                    \
      -u$MYSQLUSER -p$MYSQLPWD -h$MYSQLHOST                         \
      -Q -c -C --add-drop-table --add-locks --quick --lock-tables   \
      $i > $MYSQLBACKUPDIR/$i.sql;
    done;
    
    #Start MySQLDatabase
    /etc/init.d/mysql restart
    It won't work, unless I comment out the start and stop the database.
    So is it ok to dump the database with it running? Or how do i do it with it stopping and starting

  12. #10

    Gatt's Avatar
    Join Date
    Jan 2006
    Posts
    6,819
    Thank Post
    881
    Thanked 685 Times in 454 Posts
    Rep Power
    505
    It appears to be - I do it all the time!
    my Cron script looks like this:

    Code:
     
    #/bin/sh
    /usr/bin/mysqldump -u<<username>> -p<<password>> --opt moodle > /mysql_backups/moodle/moodle.sql
    /usr/bin/gzip /mysql_backups/moodle/moodle.sql
    mkdir -p /mysql_backups/moodle/`/bin/date +%Y/%b`
    /bin/mv /mysql_backups/moodle/moodle.sql.gz /mysql_backups/moodle/`/bin/date +%Y/%b/moodle.sql_%d-%b-%Y.gz`
    This creates a folder path as such:

    /mysql_backups/moodle/<year>/<month>/moodle.sql_<date>.gz

  13. Thanks to Gatt from:

    BishopVLE (10th February 2009)

  14. #11

    Gatt's Avatar
    Join Date
    Jan 2006
    Posts
    6,819
    Thank Post
    881
    Thanked 685 Times in 454 Posts
    Rep Power
    505
    Ok got rsync working and it now copies our Web Server files to another host every hour

    Have been looking at MySQL Replication - which seems to work but its locked me out of the MySQL database on the mirror server and I cant get back in

    Update:

    Ok disabled replication and the DB is backup now.. gonna resort to using mysqldump as above
    Just need to figure out how to import the dumped files into the mirror MySQL Server..


    Daily Cron Jobs:

    Dump MySQL Database (WORKS!)
    Rsync Website & MySQL Dumps to Mirror Server (WORKS!)
    Import MySQL Dumps into Mirror Database (NEED HELP!)

    ANy ideas how to run the 1st cron job in reverse?
    Last edited by Gatt; 12th February 2009 at 02:00 PM.

  15. #12


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,033 Times in 813 Posts
    Rep Power
    341
    Quote Originally Posted by Gatt View Post


    Daily Cron Jobs:

    Dump MySQL Database (WORKS!)
    Rsync Website & MySQL Dumps to Mirror Server (WORKS!)
    Import MySQL Dumps into Mirror Database (NEED HELP!)
    You could directly import the database from a live server, without going through dumpfiles.

    Code:
    mysqldump -u 'username' -p  --opt db_name | mysql -u 'username'  -p  -h 'xxx.xxx.xxx.xxx' db_name
    or to import a mysql dump from a file

    Code:
    mysql -u 'username'  -p  -h 'xxx.xxx.xxx.xxx' db_name < path/to/filename.sql
    where db_name is the name of the database

  16. Thanks to CyberNerd from:

    Gatt (12th February 2009)

  17. #13

    Gatt's Avatar
    Join Date
    Jan 2006
    Posts
    6,819
    Thank Post
    881
    Thanked 685 Times in 454 Posts
    Rep Power
    505
    Thaks CyberNerd - will give that a try later

  18. #14

    Join Date
    Jan 2009
    Posts
    9
    Thank Post
    1
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Any tips for rsync.
    I have 3 scripts that I did and am happy with as they work.
    Make backup of moodledata
    Code:
    #/bin/sh
    cp -R /srv/www/moodledata /backups/moodledatacopied/
    tar -czvf /backups/moodledata/moodledata.tar.gz /backups/moodledatacopied/
    mkdir -p /backups/moodledata/moodledata/`/bin/date +%Y/%b`
    /bin/mv /backups/moodledata/moodledata.tar.gz /backups/moodledata/moodledata/`/bin/date +%Y/%b/moodledata_%d-%b-%Y.tar.gz`
    rm -rvf /backups/moodledatacopied/
    Make backup of moodlesoftwere

    Code:
     
    #/bin/sh
    mkdir -p /backups/moodlesoftwerecopied/
    cp -R /srv/www/htdocs/moodle /backups/moodlesoftwerecopied/moodle/
    mkdir -p /backups/moodlesoftwere/
    tar -czvf /backups/moodlesoftwere/moodle.tar.gz /backups/moodlesoftwerecopied/moodle/
    mkdir -p /backups/moodlesoftwere/moodlesoftwere/`/bin/date +%Y/%b`
    /bin/mv /backups/moodlesoftwere/moodle.tar.gz /backups/moodlesoftwere/moodlesoftwere/`/bin/date +%Y/%b/moodle_%d-%b-%Y.tar.gz`
    rm -rvf /backups/moodlesoftwerecopied/
    and make backup of moodle database.

    Code:
     
    #/bin/sh
    /usr/bin/mysqldump -uroot -p****** --opt moodle > /backups/mysql_backups/moodle/moodle.sql
    /usr/bin/gzip /backups/mysql_backups/moodle/moodle.sql
    mkdir -p /backups/mysql_backups/moodle/`/bin/date +%Y/%b`
    /bin/mv /backups/mysql_backups/moodle/moodle.sql.gz /backups/mysql_backups/moodle/`/bin/date +%Y/%b/moodle.sql_%d-%b-%Y.gz`
    These all work, and create the files in a back up directory. But once the site grows it will be to big to do full back ups daily.

    The SQL dump will have to be done daily as normal.
    The moodlesoftwere how much will that change? would that be ok to do weekly?
    But whats the best way to do the moodledata one.
    I have heard about using rsync to do incremental backups but have no idea how to do that with my script.

    TIA

  19. #15

    Gatt's Avatar
    Join Date
    Jan 2006
    Posts
    6,819
    Thank Post
    881
    Thanked 685 Times in 454 Posts
    Rep Power
    505
    @BishopVLE - I'll post my scripts and references once i get a working mirror - its just teh mysqldump that needs looking into

    THis site might help you with rsync via SSH Mirror Your Web Site With rsync | HowtoForge - Linux Howtos and Tutorials
    Its for Fedora but should work with most Distros



SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. VLE Moodle backups
    By ozydave in forum Virtual Learning Platforms
    Replies: 6
    Last Post: 14th November 2011, 09:22 PM
  2. [Pics] Simple but effective
    By Little-Miss in forum Jokes/Interweb Things
    Replies: 8
    Last Post: 7th January 2009, 12:59 PM
  3. [News] Effective Immediately
    By mattx in forum Jokes/Interweb Things
    Replies: 1
    Last Post: 30th October 2008, 03:44 PM
  4. SIMS Effective Date
    By danIT in forum MIS Systems
    Replies: 2
    Last Post: 18th July 2008, 03:05 PM
  5. Quick effective imaging...
    By Ben_Stanton in forum How do you do....it?
    Replies: 32
    Last Post: 1st May 2007, 02:07 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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