Hello,

Mark today in your calendar.  Bacula just did its first backup and restore of a 
MySQL database using a plugin. 
I did it with using a simplistic "pipe" plugin.

The operation consisted of adding the following line to the Include section of 
the FileSet:

                  1                    2                                  3     
                                          4
Plugin = "bpipe:/@MYSQL/regress.sql:mysqldump -f --opt --databases 
regress:mysql"

This plugin line goes in the FileSet section where you have your File = xxx 
lines, and
for this plugin is composed of 4 fields separated by colons (I've indicated the 
field
numbers above the Plugin line for reference only.

Field 1 specifies a specific plugin name (in this case bpipe).
Field 2 specifies the namespace (in this case the pseudo path/filename under 
which the 
   backup will be saved -- this will show up in the restore tree selection).
Field 3 is the "reader" shell command used for doing a backup.  Since this is a 
pipe
   plugin (Linux shared object), it does a popen() on that command.
Field 4 is the "writer" shell command used for doing the restore.

I created a MySQL database named regress, populated it, backed it up, dropped 
the database, then I restored the "file" /@MYSQL/regress.sql, and the database 
was
restored.  There is nothing magical about /@MYSQL/...  It is just something 
unique
and distinctive enough that it will not be confused with another file on the 
system.

As I mentioned, this is a rather trivial example of what can be done with a 
simple
pipe plugin.  As it stands, bpipe knows nothing about MySQL (it is 365 lines of
C code), but it could be any shared object that can implement a C interface,
and I could imagine for example a MySQL specific plugin which could all 
databases 
or a list of databases.  Also, Bacula was running with an SQLite database -- it 
certainly 
would not work very well if Bacula were using the MySQL database in question 
during the restore ... 

Obviously, this is a first cut and there remains a lot to be done (much clean 
up, a lot of 
additional implementation, error message implementation, and documentation), but
at least it is now a full proof of concept.

By the way, this is an example of what I call a "plugin command", where a 
specific plugin
is referenced, and it backs up a specific file (or set of files).  I have also 
planned plugins
that will be called when particular Options are met (i.e. to backup all .gz 
files, ...).  However,
I am putting off implementation of those plugins until later.

Best regards,

Kern

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to