有没有办法在 Bacula 作业中包含多个主机和多个文件集?

Is there a way to include more than one host and more than one FileSet in a Bacula Job?

编辑 #1

From the docs:

Only a single type (Backup, Restore, ...) can be specified for any job. If you want to backup multiple FileSets on the same Client or multiple Clients, you must define a Job for each one.

我猜这个问题的答案是“否”。 FML


我创建了一些如下所示的 Bacula 文件集以包含在 Bacula 作业中。我需要 运行 在六台不同的主机(客户端)上执行相同的作业,但我不知道该怎么做。

所以,我设置了一些 FileSet,如下所示:

# Wildfly FileSet
FileSet {
  Name = "Wildfly"
  Include {
    Options {
      signature = MD5
      compression = GZIP
    }
    File = /opt/wildfly/
  }
}
# Scripts, Crontabs and Configuration files FileSet
FileSet {
  Name = "Scripts Crontabs e Conf"
  Include {
    Options {
      signature = MD5
      compression = GZIP
    }
    File = /usr/local/scripts/
    File = /var/spool/cron/crontabs/
    File = /etc
  }
  Exclude {
    File = /etc/ssl/
    File = /etc/ldap/
  }
}

然后我创建了一份工作:

Job {
  Name = "BackupMyHostName"
  JobDefs = "DefaultJob"
  Client = MyHostName-fd
  Pool = MyBackupPolicy
  FileSet="Wildfly"
}

如果我必须为每个不同的文件集复制和粘贴相同的代码六次,那会很复杂。我前面还有 40(四十)台服务器。

我是Bacula的新手,但是已经一个星期了,现在我才能够掌握系统的一些定义。

我需要为这项任务的正确方向提供帮助。

如您所料,Bacula 在单个作业中支持单个文件集和单个客户端。您的不同作业可以共享同一个 FileSet、Pool 或 Schedule 配置,从而简化它。此外,您还可以设置作业模板:JobDefs,您可以使用它来简化多个复制粘贴作业配置。 因此,假设您有一个要在多个客户端的多个作业中使用的文件集。首先是一些示例配置:

文件集:

# Scripts, Crontabs and Configuration files FileSet
FileSet {
  Name = "Scripts Crontabs e Conf"
  Include {
    Options {
      signature = MD5
      compression = GZIP
    }
    File = /usr/local/scripts/
    File = /var/spool/cron/crontabs/
    File = /etc
  }
  Exclude {
    File = /etc/ssl/
    File = /etc/ldap/
  }
}

客户:

Client {
  Name = client1
  Address = client1.example.com
}
Client {
  Name = client2
  Address = client2.example.com
}

然后是模板 JobDefs:

JobDefs {
  Name = JD
  Type = Backup
  Priority = 10
  Messages = "Standard"
  WriteBootstrap = "/opt/bacula/bsr/%c-%n.bsr"
  Storage = bacula-sd
  FileSet = "Scripts Crontabs e Conf"
}

因此,在这种情况下,您可以像这样简单地创建工作:

Job {
  Name = job1
  JobDefs = JD
  Client = client1
}
Job {
  Name = job2
  JobDefs = JD
  Client = client2
}

就是这样。希望对你有帮助。