bpipe Plugin
CommunityEnterpriseThe bpipe Plugin is provided in the directory src/plugins/fd/bpipe-fd.c of the Bacula
source distribution. When the plugin is compiled and linking into the resulting
dynamic shared object (DSO), it will have the name bpipe-fd.so. Please note that
this is a very simple plugin that was written for demonstration and test purposes. It
is and can be used in production, but that was never really intended.
The purpose of the plugin is to provide an interface to any system program for backup and restore. The bpipe plugin is specified in the Include section of your Job’s Fileset resource. The full syntax of the plugin directive as interpreted by the bpipe Plugin (each plugin is free to specify the syntax as it wishes) is:
Plugin = "<field1>:<field2>:<field3>:<field4>"
where:
field1 is the name of the plugin with the
trailing-fd.sostripped off, so in this case, we would put bpipe in this field.field2 specifies the namespace, which for bpipe is the pseudo path, and filename under which the backup will be saved. This pseudo path and filename will be seen by the user in the restore file tree. For example, if the value is
/MYSQL/regress.sql, the data backed up by the plugin will be put under that “pseudo” path and filename. You must be careful to choose a naming convention that is unique to avoid a conflict with a path and filename that actually exists on your system.field3 for the bpipe plugin specifies the “reader” program that is called by the plugin during backup to read the data. bpipe will call this program by doing a popen on it.
field4 for the bpipe plugin specifies the “writer” program that is called by the plugin during restore to write the data back to the filesystem.
Please note that for two items above describing the “reader” and “writer” fields, these programs are “executed” by Bacula, which means there is no shell interpretation of any command line arguments you might use. If you want to use shell characters (redirection of input or output, …), then we recommend that you put your command or commands in a shell script and execute the script. In addition if you backup a file with the reader program, when running the writer program during the restore, Bacula will not automatically create the path to the file. Either the path must exist, or you must explicitly do so with your command or in a shell script.
Putting it all together, the full plugin directive line might look like the following:
Plugin = "bpipe:/MYSQL/regress.sql:mysqldump-f
--opt--databases bacula:mysql
The directive has been split into two lines, but within the bacula-dir.conf file would
be written on a single line.
This causes the File daemon to call the bpipe plugin, which will write its data into
the “pseudo” file /MYSQL/regress.sql by calling the program
mysqldump-f opt–database bacula to read the data during backup. The mysqldump command
outputs all the data for the database named bacula, which will be read by the plugin
and stored in the backup. During restore, the data that was backed up will be sent
to the program specified in the last field, which in this case is mysql. When mysql
is called, it will read the data sent to it by the plugin writes it back to the same
database from which it came (bacula in this case).
The bpipe Plugin is a generic pipe program, that simply transmits the data from a specified program to Bacula for backup, and then from Bacula to a specified program for restore.
By using different command lines to bpipe, you can backup any kind of data (ASCII or binary) depending on the program called.
See also
Previous articles:
Next articles:
Go back to: Advanced Features Usage.