如何修复 Bacula 错误“2902 存储错误”?

如何修复 Bacula 错误“2902 存储错误”?

场景:服务器备份得很好。尝试在另一台计算机(我的工作站)上添加文件守护程序,但该作业失败,并出现错误“2902 存储错误”。日志还提供了有关密码的 bacula 文档链接,但我认为我的配置已经遵循了那里设置的规则。

服务器守护进程

导演

#
# Default Bacula Director Configuration file
#
#  The only thing that MUST be changed is to add one or more
#   file or directory names in the Include directive of the
#   FileSet resource.
#
#  For Bacula release 5.2.12 (12 September 2012) -- gentoo 
#
#  You might also want to change the default email address
#   from root to your address.  See the "mail" and "operator"
#   directives in the Messages resource.
#

Director {                            # define myself
  Name = castellan-dir
  DIRport = 9101                # where we listen for UA connections
  QueryFile = "/usr/libexec/bacula/query.sql"
  WorkingDirectory = "/var/lib/bacula"
  PidDirectory = "/var/run"
  Maximum Concurrent Jobs = 1
  Password = "GRek4WPD2RlNGkdzhW00zyA6Xg2FU/fFMVP2eQyWEzi6"         # Console password
  Messages = Daemon
}

JobDefs {
  Name = "DefaultJob"
  Type = Backup
  Level = Incremental
  Client = castellan-fd 
#  FileSet = "Full Set"
  Schedule = "WeeklyCycle"
  Storage = MainBackupArray
  Messages = Standard
  Pool = File
  Priority = 10
  Write Bootstrap = "/var/lib/bacula/%c.bsr"

  RunScript {
    RunsWhen = Before
    FailJobOnError = No
    RunsOnClient = No
    Command = "/bin/mount /dev/md4"
  }
  RunScript {
    RunsWhen = After
    RunsOnSuccess = Yes
    RunsOnFailure = Yes
    RunsOnClient = No
    Command = "/bin/umount /dev/md4"
  }

}


#
# Define the main nightly save backup job
#   By default, this job will back up to disk in /tmp
Job {
  Name = "BackupCastellan"
  JobDefs = "DefaultJob"
  FileSet = "Full Set"
}

Job {
  Name = "BackupLiege"
  JobDefs = "DefaultJob"
  Client = liege-fd
  FileSet = "LiegeFullset"
}

#Job {
#  Name = "BackupClient2"
#  Client = castellan2-fd
#  JobDefs = "DefaultJob"
#}

# Backup the catalog database (after the nightly save)
Job {
  Name = "BackupCatalog"
  JobDefs = "DefaultJob"
  Level = Full
  FileSet = "Catalog"
  Schedule = "WeeklyCycleAfterBackup"
  # This creates an ASCII copy of the catalog
  # Arguments to make_catalog_backup.pl are:
  #  make_catalog_backup.pl <catalog-name>
  RunBeforeJob = "/usr/libexec/bacula/make_catalog_backup.pl MyCatalog"
  # This deletes the copy of the catalog
  RunAfterJob  = "/usr/libexec/bacula/delete_catalog_backup"
  Write Bootstrap = "/var/lib/bacula/%n.bsr"
  Priority = 11                   # run after main backup
}

#
# Standard Restore template, to be changed by Console program
#  Only one such job is needed for all Jobs/Clients/Storage ...
#
Job {
  Name = "RestoreFiles"
  Type = Restore
  Client = castellan-fd                 
  FileSet = "Full Set"                  
  Storage = MainBackupArray
  Pool = Default
  Messages = Standard
  Where = /tmp/bacula-restores

  RunScript {
    RunsWhen = Before
    FailJobOnError = No
    RunsOnClient = No
    Command = "/bin/mount /dev/md4"
  }
  RunScript {
    RunsWhen = After
    RunsOnSuccess = Yes
    RunsOnFailure = Yes
    RunsOnClient = No
    Command = "/bin/umount /dev/md4"
  }

}


# List of files to be backed up
FileSet {
  Name = "Full Set"
  Include {
    Options {
      signature = MD5
      compression=gzip
    }
    File = /
    File = /boot
    File = /var
  }

  Exclude {
    File = /dev
    File = /var/lib/bacula
    File = /proc
    File = /mnt
    File = /media
    File = /.journal
    File = /.fsck
    File = /var/lib/minecraft/wholebackups
    File = /var/lib/minecraft/backups
    File = /var/nas/live_torrents
  }
}

FileSet {
  Name = "LiegeFullset"
  Include {
    Options {
      signature = MD5
      compression=gzip
    }
    File = "C:/" 
  }

  Exclude {
    File = "C:/Temp"
  }
}




#
# When to do the backups, full backup on first sunday of the month,
#  differential (i.e. incremental since full) every other sunday,
#  and incremental backups other days
Schedule {
  Name = "WeeklyCycle"
  Run = Full 1st sun at 2:05
  Run = Differential 2nd-5th sun at 2:05
  Run = Incremental mon-sat at 2:05
}

# This schedule does the catalog. It starts after the WeeklyCycle
Schedule {
  Name = "WeeklyCycleAfterBackup"
  Run = Full sun-sat at 4:00
}

# This is the backup of the catalog
FileSet {
  Name = "Catalog"
  Include {
    Options {
      signature = MD5
    }
    File = "/var/lib/bacula/bacula.sql"
  }
}

# Client (File Services) to backup
Client {
  Name = castellan-fd
  Address = castellan
  FDPort = 9102
  Catalog = MyCatalog
  Password = "PeVkZSMSO/rvermyd0shMYfTGg70P3gB2YBdkXcEwDdE"          # password for FileDaemon
  File Retention = 2 months            # 30 days
  Job Retention = 12 months            # six months
  AutoPrune = yes                     # Prune expired Jobs/Files
}

# Client (File Services) to backup
Client {
  Name = liege-fd
  Address = liege
  FDPort = 9102
  Catalog = MyCatalog
  Password = "vZwrnQRZanw4q8BE3BEraGsc9UQnehYHNyvirP1fhURU"      # password for FileDaemon
  File Retention = 2 months            # 30 days
  Job Retention = 12 months            # six months
  AutoPrune = yes                     # Prune expired Jobs/Files
}

#
# Second Client (File Services) to backup
#  You should change Name, Address, and Password before using
#
#Client {
#  Name = castellan2-fd                
#  Address = castellan2
#  FDPort = 9102
#  Catalog = MyCatalog
#  Password = "PeVkZSMSO/rvermyd0shMYfTGg70P3gB2YBdkXcEwDdE2"         # password for FileDaemon 2
#  File Retention = 30 days            # 30 days
#  Job Retention = 6 months            # six months
#  AutoPrune = yes                     # Prune expired Jobs/Files
#}


# Definition of file storage device
Storage {
  Name = MainBackupArray
# Do not use "localhost" here    
  Address = 192.168.10.192                # N.B. Use a fully qualified name here
  SDPort = 9103
  Password = "3Yzd6Ohb5GMWfMZx8GJbQNf06BSV3WpMQK3Tl3tTsil2"
  Device = MainBackupArray
  Media Type = File
}



# Definition of DDS tape storage device
#Storage {
#  Name = DDS-4    
#  Do not use "localhost" here
#  Address = castellan                # N.B. Use a fully qualified name here
#  SDPort = 9103
#  Password = "3Yzd6Ohb5GMWfMZx8GJbQNf06BSV3WpMQK3Tl3tTsil2"          # password for Storage daemon
#  Device = DDS-4                      # must be same as Device in Storage daemon
#  Media Type = DDS-4                  # must be same as MediaType in Storage daemon
#  Autochanger = yes                   # enable for autochanger device
#}

# Definition of 8mm tape storage device
#Storage {
#  Name = "8mmDrive"
#  Do not use "localhost" here
#  Address = castellan                # N.B. Use a fully qualified name here
#  SDPort = 9103
#  Password = "3Yzd6Ohb5GMWfMZx8GJbQNf06BSV3WpMQK3Tl3tTsil2"
#  Device = "Exabyte 8mm"
#  MediaType = "8mm"
#}

# Definition of DVD storage device
#Storage {
#  Name = "DVD"
#  Do not use "localhost" here
#  Address = castellan                # N.B. Use a fully qualified name here
#  SDPort = 9103
#  Password = "3Yzd6Ohb5GMWfMZx8GJbQNf06BSV3WpMQK3Tl3tTsil2"
#  Device = "DVD Writer"
#  MediaType = "DVD"
#}


# Generic catalog service
Catalog {
  Name = MyCatalog
# Uncomment the following line if you want the dbi driver
# dbdriver = "dbi:mysql"; dbaddress = 127.0.0.1; dbport =  
  dbname = "bacula"; dbuser = "bacula"; dbpassword = "GMWfMZx8GJbQNf06BSV3WpMQK3Tl3tTsil2"
}

# Reasonable message delivery -- send most everything to email address
#  and to the console
Messages {
  Name = Standard
#
# NOTE! If you send to two email or more email addresses, you will need
#  to replace the %r in the from field (-f part) with a single valid
#  email address in both the mailcommand and the operatorcommand.
#  What this does is, it sets the email address that emails would display
#  in the FROM field, which is by default the same email as they're being
#  sent to.  However, if you send email to more than one address, then
#  you'll have to set the FROM address manually, to a single address. 
#  for example, a '[email protected]', is better since that tends to
#  tell (most) people that its coming from an automated source.

#
  mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) \<[email protected]\>\" -s \"Bacula: %t %e of %c %l\" %r"
  operatorcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) \<[email protected]\>\" -s \"Bacula: Intervention needed for %j\" %r"
  mail = [email protected] = all, !skipped            
  operator = [email protected] = mount
  console = all, !skipped, !saved
#
# WARNING! the following will create a file that you must cycle from
#          time to time as it will grow indefinitely. However, it will
#          also keep all your messages if they scroll off the console.
#
  append = "/var/log/bacula/working/bacula.log" = all, !skipped
  catalog = all
}


#
# Message delivery for daemon messages (no job).
Messages {
  Name = Daemon
  mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula daemon message\" %r"
  mail = [email protected] = all, !skipped            
  console = all, !skipped, !saved
  append = "/var/log/bacula/working/bacula.log" = all, !skipped
}

# Default pool definition
Pool {
  Name = Default
  Pool Type = Backup
  Recycle = yes                       # Bacula can automatically recycle Volumes
  AutoPrune = yes                     # Prune expired volumes
  Volume Retention = 2 days         # one year
}

# File Pool definition
Pool {
  Name = File
  Pool Type = Backup
  Recycle = yes                       # Bacula can automatically recycle Volumes
  AutoPrune = yes                     # Prune expired volumes
  Volume Retention = 2 days         # one year
  Maximum Volume Bytes = 100G          # Limit Volume size to something reasonable
  Maximum Volumes = 1000               # Limit number of Volumes in Pool
  LabelFormat = "Vol"
}


# Scratch pool definition
Pool {
  Name = Scratch
  Pool Type = Backup
}

#
# Restricted console used by tray-monitor to get the status of the director
#
Console {
  Name = castellan-mon
  Password = "4BcHoJRAOkZJlMf8wm6s11ZoAfwYYpefAnMstlzfUj7h"
  CommandACL = status, .status
}

文件

#
# Default  Bacula File Daemon Configuration file
#
#  For Bacula release 5.2.13 (19 February 2013) -- gentoo 
#
# There is not much to change here except perhaps the
# File daemon Name to
#

#
# List Directors who are permitted to contact this File daemon
#
Director {
  Name = castellan-dir
  Password = "PeVkZSMSO/rvermyd0shMYfTGg70P3gB2YBdkXcEwDdE"
}

#
# Restricted Director, used by tray-monitor to get the
#   status of the file daemon
#
Director {
  Name = castellan-mon
  Password = "QEN/69pxCIYQ9GOvJK+XL1VGLl8ovRxfSMOe1Kt2Q/Fp"
  Monitor = yes
}

#
# "Global" File daemon configuration specifications
#
FileDaemon {                          # this is me
  Name = castellan-fd
  FDport = 9102                  # where we listen for the director
  WorkingDirectory = /var/lib/bacula
  Pid Directory = /var/run
  Maximum Concurrent Jobs = 20
}

# Send all messages except skipped files back to Director
Messages {
  Name = Standard
  director = castellan-dir = all, !skipped, !restored
}

贮存

#
# Default Bacula Storage Daemon Configuration file
#
#  For Bacula release 5.2.12 (12 September 2012) -- gentoo 
#
# You may need to change the name of your tape drive
#   on the "Archive Device" directive in the Device
#   resource.  If you change the Name and/or the 
#   "Media Type" in the Device resource, please ensure
#   that dird.conf has corresponding changes.
#

Storage {                             # definition of myself
  Name = castellan-sd
  SDPort = 9103                  # Director's port      
  WorkingDirectory = "/var/lib/bacula"
  Pid Directory = "/var/run"
  Maximum Concurrent Jobs = 20
}

#
# List Directors who are permitted to contact Storage daemon
#
Director {
  Name = castellan-dir
  Password = "3Yzd6Ohb5GMWfMZx8GJbQNf06BSV3WpMQK3Tl3tTsil2"
}

#
# Restricted Director, used by tray-monitor to get the
#   status of the storage daemon
#
Director {
  Name = castellan-mon
  Password = "uA1iI8Vxirh+JZc7zPTengOQt978CG3F6V3MNI/I2Sbi"
  Monitor = yes
}

#
# Note, for a list of additional Device templates please
#  see the directory <bacula-source>/examples/devices
# Or follow the following link:
#  http://bacula.svn.sourceforge.net/viewvc/bacula/trunk/bacula/examples/devices/
#

#
# Devices supported by this Storage daemon
# To connect, the Director's bacula-dir.conf must have the
#  same Name and MediaType. 
#

Device {
  Name = MainBackupArray
  Media Type = File
  Archive Device = /mnt/backup/main
  LabelMedia = yes;                   # lets Bacula label unlabeled media
  Random Access = Yes;
  AutomaticMount = yes;               # when device opened, read it
  Requires Mount = no;
  RemovableMedia = no;
  AlwaysOpen = no;
  #Mount Command = "/bin/mount /dev/md4";
  #Unmount Command = "/bin/umount /dev/md4";
  Mount Point = "/mnt/backup"
  Write Part Command = ""
}

#
# An autochanger device with two drives
#
#Autochanger {
#  Name = Autochanger
#  Device = Drive-1
#  Device = Drive-2
#  Changer Command = "/usr/libexec/bacula/mtx-changer %c %o %S %a %d"
#  Changer Device = /dev/sg0
#}

#Device {
#  Name = Drive-1                      #
#  Drive Index = 0
#  Media Type = DLT-8000
#  Archive Device = /dev/nst0
#  AutomaticMount = yes;               # when device opened, read it
#  AlwaysOpen = yes;
#  RemovableMedia = yes;
#  RandomAccess = no;
#  AutoChanger = yes
#  #
#  # Enable the Alert command only if you have the mtx package loaded
#  # Note, apparently on some systems, tapeinfo resets the SCSI controller
#  #  thus if you turn this on, make sure it does not reset your SCSI 
#  #  controller.  I have never had any problems, and smartctl does
#  #  not seem to cause such problems.
#  #
#  Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
#  If you have smartctl, enable this, it has more info than tapeinfo 
#  Alert Command = "sh -c 'smartctl -H -l error %c'"  
#}

#Device {
#  Name = Drive-2                      #
#  Drive Index = 1
#  Media Type = DLT-8000
#  Archive Device = /dev/nst1
#  AutomaticMount = yes;               # when device opened, read it
#  AlwaysOpen = yes;
#  RemovableMedia = yes;
#  RandomAccess = no;
#  AutoChanger = yes
#  # Enable the Alert command only if you have the mtx package loaded
#  Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
#  If you have smartctl, enable this, it has more info than tapeinfo 
#  Alert Command = "sh -c 'smartctl -H -l error %c'"  
#}

#
# A Linux or Solaris LTO-2 tape drive
#
#Device {
#  Name = LTO-2
#  Media Type = LTO-2
#  Archive Device = /dev/nst0
#  AutomaticMount = yes;               # when device opened, read it
#  AlwaysOpen = yes;
#  RemovableMedia = yes;
#  RandomAccess = no;
#  Maximum File Size = 3GB
## Changer Command = "/usr/libexec/bacula/mtx-changer %c %o %S %a %d"
## Changer Device = /dev/sg0
## AutoChanger = yes
#  # Enable the Alert command only if you have the mtx package loaded
## Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
## If you have smartctl, enable this, it has more info than tapeinfo 
## Alert Command = "sh -c 'smartctl -H -l error %c'"  
#}

#
# A Linux or Solaris LTO-3 tape drive
#
#Device {
#  Name = LTO-3
#  Media Type = LTO-3
#  Archive Device = /dev/nst0
#  AutomaticMount = yes;               # when device opened, read it
#  AlwaysOpen = yes;
#  RemovableMedia = yes;
#  RandomAccess = no;
#  Maximum File Size = 4GB
## Changer Command = "/usr/libexec/bacula/mtx-changer %c %o %S %a %d"
## Changer Device = /dev/sg0
## AutoChanger = yes
#  # Enable the Alert command only if you have the mtx package loaded
## Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
## If you have smartctl, enable this, it has more info than tapeinfo 
## Alert Command = "sh -c 'smartctl -H -l error %c'"  
#}

#
# A Linux or Solaris LTO-4 tape drive
#
#Device {
#  Name = LTO-4
#  Media Type = LTO-4
#  Archive Device = /dev/nst0
#  AutomaticMount = yes;               # when device opened, read it
#  AlwaysOpen = yes;
#  RemovableMedia = yes;
#  RandomAccess = no;
#  Maximum File Size = 5GB
## Changer Command = "/usr/libexec/bacula/mtx-changer %c %o %S %a %d"
## Changer Device = /dev/sg0
## AutoChanger = yes
#  # Enable the Alert command only if you have the mtx package loaded
## Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
## If you have smartctl, enable this, it has more info than tapeinfo 
## Alert Command = "sh -c 'smartctl -H -l error %c'"  
#}




#
# A FreeBSD tape drive
#
#Device {
#  Name = DDS-4 
#  Description = "DDS-4 for FreeBSD"
#  Media Type = DDS-4
#  Archive Device = /dev/nsa1
#  AutomaticMount = yes;               # when device opened, read it
#  AlwaysOpen = yes
#  Offline On Unmount = no
#  Hardware End of Medium = no
#  BSF at EOM = yes
#  Backward Space Record = no
#  Fast Forward Space File = no
#  TWO EOF = yes
#  If you have smartctl, enable this, it has more info than tapeinfo 
#  Alert Command = "sh -c 'smartctl -H -l error %c'"  
#}

# 
# Send all messages to the Director, 
# mount messages also are sent to the email address
#
Messages {
  Name = Standard
  director = castellan-dir = all
}

工作站

文件

#
# Default  Bacula File Daemon Configuration file
#
#  For Bacula release 7.0.5 (08/05/14) -- Windows MinGW64
#
# There is not much to change here except perhaps the
# File daemon Name
#

#
# "Global" File daemon configuration specifications
#
FileDaemon {                            # this is me
  Name = liege-fd
  FDport = 9102                # where we listen for the director
  WorkingDirectory = "C:\\Program Files\\Bacula\\working"
  Pid Directory = "C:\\Program Files\\Bacula\\working"
  Plugin Directory = "C:\\Program Files\\Bacula\\plugins"
  Maximum Concurrent Jobs = 10
}

#
# List Directors who are permitted to contact this File daemon
#
Director {
  Name = castellan-dir
  Password = "vZwrnQRZanw4q8BE3BEraGsc9UQnehYHNyvirP1fhURU"  # Director must know this password
}

#
# Restricted Director, used by tray-monitor to get the
#   status of the file daemon
#
Director {
  Name = liege-mon
  Password = ""
  Monitor = yes
}

# Send all messages except skipped files back to Director
Messages {
  Name = Standard
  director = castellan-dir = all, !skipped, !restored
}

工作结果

28-Mar 02:05 castellan-dir JobId 1518: No prior Full backup Job record found.
28-Mar 02:05 castellan-dir JobId 1518: No prior or suitable Full backup found in catalog. Doing FULL backup.
28-Mar 02:07 castellan-dir JobId 1518: shell command: run BeforeJob "/bin/mount /dev/md4"
28-Mar 02:07 castellan-dir JobId 1518: Start Backup JobId 1518, Job=BackupLiege.2015-03-28_02.05.00_19
28-Mar 02:07 castellan-dir JobId 1518: Using Device "MainBackupArray" to write.
28-Mar 01:48 liege-fd JobId 1518: Fatal error: Authorization key rejected by Storage daemon.
Please see http://www.bacula.org/en/rel-manual/Bacula_Freque_Asked_Questi.html#SECTION00260000000000000000 for help.
28-Mar 02:07 castellan-dir JobId 1518: Fatal error: Bad response to Storage command: wanted 2000 OK storage
, got 2902 Bad storage

28-Mar 02:07 castellan-dir JobId 1518: Error: Bacula castellan-dir 5.2.13 (19Jan13):
  Build OS:               x86_64-pc-linux-gnu gentoo
  JobId:                  1518
  Job:                    BackupLiege.2015-03-28_02.05.00_19
  Backup Level:           Full (upgraded from Incremental)
  Client:                 "liege-fd" 7.0.5 (04Aug14) Microsoft Windows 7 Ultimate Edition Service Pack 1 (build 7601), 64-bit,Cross-compile,Win64
  FileSet:                "LiegeFullset" 2015-03-18 02:05:00
  Pool:                   "File" (From Job resource)
  Catalog:                "MyCatalog" (From Client resource)
  Storage:                "MainBackupArray" (From Job resource)
  Scheduled time:         28-Mar-2015 02:05:00
  Start time:             28-Mar-2015 02:07:29
  End time:               28-Mar-2015 02:07:41
  Elapsed time:           12 secs
  Priority:               10
  FD Files Written:       0
  SD Files Written:       0
  FD Bytes Written:       0 (0 B)
  SD Bytes Written:       0 (0 B)
  Rate:                   0.0 KB/s
  Software Compression:   None
  VSS:                    no
  Encryption:             no
  Accurate:               no
  Volume name(s):
  Volume Session Id:      127
  Volume Session Time:    1422045928
  Last Volume Bytes:      86,414,167,951 (86.41 GB)
  Non-fatal FD errors:    2
  SD Errors:              0
  FD termination status:  Error
  SD termination status:  Waiting on FD
  Termination:            *** Backup Error ***

28-Mar 02:07 castellan-dir JobId 1518: shell command: run AfterJob "/bin/umount /dev/md4"

答案1

我遇到过类似的问题,问题是客户端和服务器版本的差异。检查您的 bacula 版本(在客户端和服务器上执行此操作)

apt-cache policy bacula

如果它们不相同,那么请确保您的客户端与您的服务器匹配。这对我有用。

在这里得到一些帮助https://serverfault.com/questions/202785/how-to-check-bacula-version

答案2

检查工作站 (liege) 是否可以访问服务器 (castellan = 192.168.10.192) 上的存储守护进程端口 (9103)。确保它未被 iptables 或中间网络防火墙阻止。

答案3

在我的例子中,DIRECTOR 不知何故无法找到存储守护进程,因为它使用了主机的名称(在 Debian 上,通常与 /etc/hosts 中的 127.0.1.1 相关联)。

我也遇到了错误“错误:lib/bsock_tcp.cc:184 BnetHost2IpAddrs() for host“mybareoshostname”失败:ERR=没有与主机名关联的地址”,我以为客户端在解析它时遇到了问题(我的路由器有一个不稳定的 DNS 服务器)...而实际上是 Director 无法连接到 SD。

最初我以为我可以通过设置存储守护进程的控制器配置中的 SD 地址为 127.0.0.1 来解决这个问题(并忽略了“不要这样做”的评论)

相关内容