Bacula-users

Re: [Bacula-users] Storage daemon didn't accept Device "FifoStorage"

2008-11-03 15:58:13
Subject: Re: [Bacula-users] Storage daemon didn't accept Device "FifoStorage"
From: Arno Lehmann <al AT its-lehmann DOT de>
To: bacula-users AT lists.sourceforge DOT net
Date: Mon, 03 Nov 2008 21:55:50 +0100
Hi,

31.10.2008 12:32, Isabel Bermejo wrote:
> Ok
> Now I understand the situation. If I define a Storage Fifo Device, I'm
> backing up to a "virtual" device, isn't it? So I have to define a Job with
> RunBeforeJob option and a FileSet with readfifo=yes and as Device I can
> define a file device so the backup is made in a file.

Correct.

> Supposing I'm right, I've modified my files and now I've got a Device
> Resource with File as Media Type. The Job and FileSet resource are the same.
> Now, if I run the job I get the next error:
> 31-Oct 12:14 client-dir: Start Backup JobId 10069,
> Job=BackupMySQL.2008-10-31_12.14.46
> 31-Oct 12:14 client-fd: RunBeforeJob: mkfifo: cannot create fifo
> `/tmp/fifofiles': File exists

Ok. The FIFO seems to exist (or a regular file with the name). You 
should handle that case in your run before job script (in fact, you 
already do).

Just delete the FIFO manually now, and make sure the script deletes it 
after it's finished, or, alternatively, only create it when it's not 
already there.

> 31-Oct 12:14 client-fd: RunBeforeJob: mysql[30026]: OK Dump done with no
> errors.Exit status 0

Don't ask me where that data went ;-)

> 31-Oct 12:14 client-sd: Recycled volume "MySQL-0006" on device
> "/bacula/sqli8", all previous data lost.
> 31-Oct 12:15 client-fd:      Cannot open /tmp/fifofiles: ERR=Interrupted
> system call.

Probably this is not actually a FIFO, or there is no writer process 
attached to it.

> 31-Oct 12:15 client-dir: Max Volume jobs exceeded. Marking Volume
> "MySQL-0006" as Used.
> 31-Oct 12:15 client-dir: Bacula 1.36.3 (22Apr05): 31-Oct-2008 12:15:49
>   JobId:                  10069
>   Job:                    BackupMySQL.2008-10-31_12.14.46
>   Backup Level:           Full
>   Client:                 client-fd
>   FileSet:                "MySQLdb" 2008-10-31 12:02:38
>   Pool:                   "MySQLPool"
>   Storage:                "FifoStorage"
>   Start time:             31-Oct-2008 12:14:48
>   End time:               31-Oct-2008 12:15:49
>   FD Files Written:       1
>   SD Files Written:       1
>   FD Bytes Written:       0
>   SD Bytes Written:       70
>   Rate:                   0.0 KB/s
>   Software Compression:   None
>   Volume name(s):         MySQL-0006
>   Volume Session Id:      6
>   Volume Session Time:    1225449755
>   Last Volume Bytes:      515
>   Non-fatal FD errors:    1
>   SD Errors:              0
>   FD termination status:  OK
>   SD termination status:  OK
>   Termination:            Backup OK -- with warnings
> 
> 31-Oct 12:15 client-dir: Begin pruning Jobs.
> 31-Oct 12:15 client-dir: No Jobs found to prune.
> 31-Oct 12:15 client-dir: Begin pruning Files.
> 31-Oct 12:15 client-dir: No Files found to prune.
> 31-Oct 12:15 client-dir: End auto prune.
> 
> The error now is "Cannot open /tmp/fifofiles: ERR=Interrupted system call."
> And it seems to have done the backup ok because I can see FD Files Written
> 1, but if I try to restore there's no file backed up.
> 
> It seems that RunBeforeJob executes the script before backup is initiated.
> So the client, when tries to read the fifo file, finds nothing on it and the
> backup is empty. If, instead of using RunBeforeJob, I use
> ClientRunBeforeJob, the results are the same.

Obviously, the script needs to be run on the client - that's where the 
data is dumped from MySQL to the FIFO.

> I don't know how can I run the script and the backup at the same time so
> bacula client reads for a temp file and backup the information to a file
> without requiring more space (I mean without dumping databases to a file)

There is sample code somewhere on the web... IIRC, your client run 
before job script needs to
a) close its file handles so it can go into background and not 
interfere with the FD
b) background itself
c) create the FIFO
d) wait a bit for the actual job to start, i.e. for the reader to 
attach to the FIFO
e) dump the database
f) close / destroy the database

(I'm not sure if b should not happen after c, so it can send error 
messages to the FD.)

Ok... 
http://wiki.bacula.org/doku.php?id=application_specific_backups:postgresql 
has a bit more sophisticated way to do things, but you could probably 
adapt it to MySQL easily.

Arno

> Thanks
> ISABEL
> 
> 
> 
> -----Mensaje original-----
> De: Isabel Bermejo [mailto:ibermejo AT inmoecheverria DOT com]
> Enviado el: viernes, 31 de octubre de 2008 11:35
> Para: Arno Lehmann; bacula-users AT lists.sourceforge DOT net
> Asunto: Re: [Bacula-users] Storage daemon didn't accept Device
> "FifoStorage"
> 
> 
> Hi
> 
> Yes, the script I made works correctly. It dumps the database to a file
> /tmp/fifofile.
> 
> What I want to do is to backup MySQL database using bacula and fifo. I know
> that is easy to dump first the database to a file and then backup that file
> (I've tried this way and it works correctly), but I have not enough space to
> dump a high database to a file. I read in Bacula manual that I can configure
> the Bacula Storage defining a Device Resource with fifo. As I can read from
> manual:
> 
> "In addition to a tape device name or a directory name, Bacula will accept
> the name of a FIFO. If a FIFO device is specified for a backup operation,
> you must have a program that reads what Bacula writes into the FIFO...with
> the RunBeforeJob directive." And then I can see an example of a fifo device
> resource
> 
> So I configured a job with RunBeforeJob option specifying a script which
> dumps the database to a fifofile. Then I create a new FileSet with
> readfifo=yes because this option, "If enabled, tells the Client to read the
> data on a backup and write the data on a restore to any FIFO (pipe) that is
> explicitly mentioned in the FileSet. In this case, you must have a program
> already running that writes into the FIFO for a backup or reads from the
> FIFO on a restore". Moreover, I create a Storage named FifoStorage, that is
> configured in Storage daemon.
> 
> I'm not sure if I'm doing things right, but I'm gonna explain you what is my
> intention: When I run a backupMySQL, the scripts initiates the dump to a
> fifofile while the client reads that file backing up the database whitout
> using extra space.
> 
> Now, my question is: Do you mean that I have to define the fifo only in one
> of the resource? Which will be a correct configuration? I'm confused about
> all the documents I've read
> 
> Thank you
> ISABEL
> 
> 
> -----Mensaje original-----
> De: Arno Lehmann [mailto:al AT its-lehmann DOT de]
> Enviado el: viernes, 31 de octubre de 2008 11:04
> Para: bacula-users AT lists.sourceforge DOT net
> Asunto: Re: [Bacula-users] Storage daemon didn't accept Device
> "FifoStorage"
> 
> 
> Hi,
> 
> 31.10.2008 10:27, Isabel Bermejo wrote:
>> Hi
>> I'm trying to backup MySQL database using bacula and a FifoStorage. First
> I
>> configure a script named "backwithfifo" which dumps the database.
>>
>> #!/bin/sh
>> #
>> exec > /dev/null
>> SCRIPTDIR=/usr/bin
>> mkfifo /tmp/tmpfifo
>> cd $SCRIPTDIR
>> ./mysqldump -h localhost -u root -pclipper iesa > /tmp/tmpfifo
>> res=$?
>> if (test $res -ne 0) then
>>    logger -t mysql -isd ERROR Dump done with errors. Exit status $res
>> else
>>    logger -t mysql -isd OK Dump done with no errors. Exit status $res
>> fi
> 
> I assume this works correctly.
> 
>> Then I modify Bacula files to run the backup, using the script, to a
>> fifofile.
>>
>> In Bacula-Director file:
>> Job {
>>    Name = "BackupMySQL"
>>    Type = Backup
>>    Client = client-fd
>>    FileSet = "MySQLdb"
>>    Schedule = "WeeklyCycleAfterBackup"
>>    Storage = FifoStorage
>>    Messages = Standard
>>    Pool = MySQLPool
>>    RunBeforeJob = "/etc/bacula/MyScripts/backwithfifo" #this is the script
>> which dumps the database to a fifofile
>>    Write Bootstrap = "/var/lib/bacula/BackupMySQL.bsr"
>>
>> FileSet {
>>    Name = "MySQLdb"
>>    Include {
>>       Options {
>>          signature = MD5
>>          readfifo = yes
>>       }
>>       File = /tmp/fifofiles
>>    }
>> }
>>
>> Storage {
>>    Name = FifoStorage
>>    Address = xxx.xxx.xxx.xxx
>>    SDPort = 9103
>>    Password = "password"
>>    Device = FifoStorage
>>    Media Type = Fifo
>> }
>>
>> In Bacula-Storage file:
>> Device {
>>    Name = FifoStorage
>>    Media Type = Fifo
>>    Archive Device = /tmp/fifofiles
> 
> This is probably not what you want - the FIFO is read by the FD and
> you've already set that up above.
> 
> Here, you need a normal storage device - either a tape drive or a disk
> directory where the volumes will be written to. The SD doesn't need to
> know anything about the FIFO setup.
> 
>>    Label Media = yes
>>    Random Access = no
>>    AutomaticMount = no
>>    RemovableMedia = no
>>    MaximumOpenWait = 60
>>    AlwaysOpen = no
> 
> Those settings also look like you tried to set up a FIFO for storage -
> you can do that, but is is in no way related to the FIFO where the
> backed up data comes from.
> 
> You'd need a FIFO created on the SD, which would direct its output
> somewhere else.
> 
> You probably should simply try this with a regular disk-based storage
> first.
> 
> Arno
> 
>> }
>>
>> When I run the backup job, it results on an error:
>>
>> 31-Oct 10:08 client-dir: RunBefore: mysql[28164]: Volcado realizado
>> correctamente.Exit status 0
>> 31-Oct 10:08 client-dir: No prior Full backup Job record found.
>> 31-Oct 10:08 client-dir: No prior or suitable Full backup found. Doing
> FULL
>> backup.
>> 31-Oct 10:08 client-dir: Start Backup JobId 10063,
>> Job=BackupMySQL.2008-10-31_10.07.42
>> 31-Oct 10:08 client-sd: BackupMySQL.2008-10-31_10.07.42 Fatal error:
>>      Archive "FifoStorage" requested by DIR could not be opened or does
> not
>> exist.
>> 31-Oct 10:08 client-dir: BackupMySQL.2008-10-31_10.07.42 Fatal error:
>>      Storage daemon didn't accept Device "FifoStorage" because:
>>      3925 Device "FifoStorage" could not be opened or does not exist.
>> 31-Oct 10:08 client-dir: BackupMySQL.2008-10-31_10.07.42 Error: Bacula
>> 1.36.3 (22Apr05): 31-Oct-2008 10:08:26
>>   JobId:                  10063
>>   Job:                    BackupMySQL.2008-10-31_10.07.42
>>   Backup Level:           Full (upgraded from Incremental)
>>   Client:                 client-fd
>>   FileSet:                "MySQLdb" 2008-10-31 09:59:45
>>   Pool:                   "MySQLPool"
>>   Storage:                "FifoStorage"
>>   Start time:             31-Oct-2008 10:07:44
>>   End time:               31-Oct-2008 10:08:26
>>   FD Files Written:       0
>>   SD Files Written:       0
>>   FD Bytes Written:       0
>>   SD Bytes Written:       0
>>   Rate:                   0.0 KB/s
>>   Software Compression:   None
>>   Volume name(s):
>>   Volume Session Id:      2
>>   Volume Session Time:    1225443462
>>   Last Volume Bytes:      0
>>   Non-fatal FD errors:    0
>>   SD Errors:              0
>>   FD termination status:
>>   SD termination status:
>>   Termination:            *** Backup Error ***
>>
>> As you can see, the error is "Storage daemon didn't accept Device
>> FifoStorage because could not be opened or does not exist". I can see the
>> file fifofile in /tmp/fifofile and I can do a cat but the Storage Daemon
>> seems can't open the file. I don't know how to configure a backup job for
> a
>> database using fifo. Can anyone tell me where is the error?
>>
>> Thanks a lot
>> ISABEL
>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Bacula-users mailing list
>> Bacula-users AT lists.sourceforge DOT net
>> https://lists.sourceforge.net/lists/listinfo/bacula-users
>>
> 
> --
> Arno Lehmann
> IT-Service Lehmann
> Sandstr. 6, 49080 Osnabrück
> www.its-lehmann.de
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Bacula-users mailing list
> Bacula-users AT lists.sourceforge DOT net
> https://lists.sourceforge.net/lists/listinfo/bacula-users
> 
> 
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Bacula-users mailing list
> Bacula-users AT lists.sourceforge DOT net
> https://lists.sourceforge.net/lists/listinfo/bacula-users
> 
> 
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Bacula-users mailing list
> Bacula-users AT lists.sourceforge DOT net
> https://lists.sourceforge.net/lists/listinfo/bacula-users
> 

-- 
Arno Lehmann
IT-Service Lehmann
Sandstr. 6, 49080 Osnabrück
www.its-lehmann.de

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

<Prev in Thread] Current Thread [Next in Thread>