Thanks, Rich,

I'm going to test this script and see how it goes. I hope I have enough
diskspace to hold all the dumps during the backup.

Kind regards,
Marc 

-----Oorspronkelijk bericht-----
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Rich
Verzonden: dinsdag 5 juni 2007 10:04
Aan: bacula-users
Onderwerp: Re: [Bacula-users] FW: Backup of a mysql dump of the database

On 2007.05.23. 11:53, Marc wrote:
> Hi,
>  
> I've searched the archives, but I can not find any relevant information.
> Therefor my question: is it possible to do a database by database dump 
> and backup these dump files? Because of database sizes, it would be 
> very nice if this can be done database by database. I mean first do 
> the dump of database 1, move it to bacula, remove the dump, dump of 
> database 2, move it to bacula, etc...
>  
> Can this be done?

i didn't see whether you successfully resolved your problem, so here's a
quick & crude script, which backs up each database as a separate file, and
does this for all of the databases.
script does not protect from simultaneous runs, does not compress dumps (as
that is done by bacula job) - though all this is very easy to add.

for bacula job, just add something like ;

   ClientRunBeforeJob = "/scripts/mysqlbackup create"
   ClientRunAfterJob = "/scripts/mysqlbackup remove"

note, the script probably has several problems, so feel free to correct
those ;)

-----------------------------------------------------
#!/bin/bash

HOME=/root
DUMPDIR=/var/tmp/database_dump
MYSQLDUMP=/usr/local/mysql/bin/mysqldump
DUMPCOMMAND="$MYSQLDUMP --add-drop-database --add-drop-table --add-locks
--extended-insert\
  --single-transaction --quick"

fail() {
     echo "failure : $1"
     exit 1
}

create() {
     if [ ! -d "$DUMPDIR" ]; then
         mkdir -p "$DUMPDIR" || fail "unable to create directory $DUMPDIR"
     fi

     for i in `echo "show databases" | mysql -N`; do
         $DUMPCOMMAND $i > "$DUMPDIR"/"$i" || fail "unable to dump database
$i"
     done
}

remove() {
     rm "$DUMPDIR"/* || fail "unable to remove db dumps"
}

case $1 in
     create)
         create
         ;;
     remove)
         remove
         ;;
     *)
         fail "pass either create or remove"
esac


> Kind regards,
> Marc
--
  Rich

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express Download DB2 Express C - the
FREE version of DB2 express and take control of your XML. No limits. Just
data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to