====== Backup mit Bacula ====== Bacula ist ein Netzwerkbackupsystem mit Client/Server-Architektur das Daten in einem heterogenen Netzwerk sichert. Bacula unterstützt Linux-, Unix- und Windows-Backup-Clients, und eine Reihe von professionellen Backup-Geräte einschließlich Tape-Libraries. Administratoren und Betreiber können das System über eine Konsole, grafische Benutzeroberfläche oder Web-Schnittstelle konfigurieren. Als Backend werden [[datenbanken:MySQL]], [[datenbanken:PostgreSQL]] oder SQLite für die Speicherung von Informationen verwendet. Quelle: [[wpde>Bacula|Wikipedia]]. ===== Versionen, Entwicklung und Forks ===== * Bacula Community-Version * Bacula Enterprise Edition (Firma: Bacula Systems) - [[https://www.baculasystems.com/corporate-data-backup-software-solutions/professional-backup-software/enterprise-community-comparison/|Unterschiede zur Community Edition]] * Bareos (Firma: Bareos GmbH & Co. KG; Lizenz: AGPL v3): Bugfixes und Sicherheitsupdates werden vorrangig für Subscription-Kunden bereitgestellt. Fork von Bacula 5.2.13, [[https://github.com/bareos/bareos|Versionsübersicht]], [[https://www.openhub.net/p/bareos|Aktivität]] Bareos wurde (etwa 2010) von Bacula abgespalten, vorrangig aus der Unzufriedenheit heraus das neue Features nur in der Enterprise-Edition gelandet sind die nicht unter freier Lizenz steht. Aktuellere Windows-Clients werden z.B. nur gegen Bezahlung angeboten, bei [[http://sourceforge.net/projects/bacula/files/Win32_64/|Sourceforge ist maximal 5.2.10 erhältlich]]). Zudem sollte die Konfiguration einfacher und mit sinnvollen Standards versehen werden und ein intuitivere Bedienung (Weboberfläche) geschaffen werden. Wann braucht man kommerzielle Versionen? - Web-Oberfläche für Kunden? - aktueller Windows-Client? - spezielle plugins (Datenbanken, backend wie Ceph)? - wenn man kein eigenes know-how hat (bzw. aufbauen will) ==== Bacula 11.x ==== [[https://www.bacula.org/11.0.x-manuals/en/main/Installing_Bacula.html|Bacula Community 9.x, 11.x Official Packages Installation Script]] ===== Links ===== * [[http://www.bacula.org/de/|Bacula Hompage]] * [[http://bacula.org/en/?page=documentation|Dokumentation]] * [[http://lucasmanual.com/mywiki/Bacula|Bacula: The Open Source Commercial Backup Solution]] * [[http://www.sibbald.com/bacula/html-manual/FileSet_Resource.html|FileSet Resource definition]] * [[http://sourceforge.net/apps/wordpress/bacula/|Bacula Project Design Blog]] * [[http://bacula.org/manuals/en/concepts/concepts/What_is_Bacula.html#SECTION00430000000000000000|Bacula Konfiguration]] * [[http://www.bacula.org/en/rel-manual/faq.html|Bacula FAQ]] z. B.[[http://www.bacula.org/en/rel-manual/faq.html#AuthorizationErrors|Authorization Errors]] ([[http://wiki.bacula.org/doku.php?id=faq|FAQ des Wikis]]) * [[http://wiki.bacula.org/doku.php?id=3rd_party_addons|3rd party Addons]] * [[https://groups.google.com/forum/#!topic/bareos-users/MWcdPb6RjEI|Experiences with tape libraries]] ==== Vorträge ==== * [[https://www.youtube.com/watch?v=gpE4mMGdig8|SLAC: Open Source Backup: von Bacula zu Bareos]] ==== Dienstleister ==== in Deutschland: * [[http://www.stefanux.net|stefanux.net]] (Autor dieser Seite - Bacula) * [[https://www.bareos.com/de/Preise.html|Bareos Subskription]] minimal Einrichtung 290€/Jahr + 1000€/Jahr für Support * [[http://www.heinlein-support.de|Heinlein Support]] Bacula/Bareos-Schulungen * [[http://www.netways.de/de/produkte/bacula/supportvertraege/|Netways Bacula Supportverträge]] (Spezialisierung Datacenter) * [[http://hsc-solutions.de/|HSC-Solutions]] * [[http://www.dass-it.de|dass-it]] - Philipp Storz Autor des Bacula-Buches ===== Komponenten und Begriffe ===== {{:software:bacula-components.png|Bacula Schaubild}} * **Catalogue** (SQL-DB): Katalog der gesicherten Dateien und sonstige Daten, unterstützt werden: MySQL (''bacula-director-mysql''**)**, PostgreSQL (''bacula-director-pgsql'') und SQLite (bacula-director-sqlite / bacula-director-sqlite3 ) * **Director** (bacula-dir): Koordination der Komponenten, Steuerung, archiviert Daten im Katalog * **Storage** (bacula-sd): stellt Sicherungsplatz zur Verfügung, verwaltet Datenträger * **File-daemon** (bacula-fd): führt Sicherungs- und Rücksicherungaufträge aus. Gibts für Windows, Linux, MacOS, BSDs, ... Unter Windows werden offene Dateien von dem Volume-shadow-copy-service gesichert. * **Console**: ''bacula-console,bacula-console-gnome'', ''bacula-console-qt'' oder ''bacula-console-wx'' Director und Catalog gibts einmal, die anderen Komponenten lassen sich beliebig (oft) verteilen. * Jobs: Ein Backup-Auftrag enthält/verweist auf: * 1 Client * 1 FileSet * einen Zeitplan (Schedule) * in einem Pool von Datenträgern. * FileSets: definiert welche Dateien gesichert werden. * Pools: * Schedules (Zeitpläne) Siehe auch: [[http://bacula.org/manuals/en/concepts/concepts/What_is_Bacula.html#SECTION00430000000000000000|Bacula Konfiguration]] ===== Features ===== * Acurate Backups (gelöschte Dateien werden beim Restore nicht wiederhergestellt): * Verschlüsselung der Daten (Bareos, ...) * Hardware-Verschlüsselung von LTO4+ Laufwerken nutzbar, Modus AES256-GCM (nur Bareos; lädt Schlüssel in das Bandlaufwerk) * Netzwerk Bandbreiten Begrenzung (...) * Dateien über x Größe ausnehmen (Bareos) * Jobs mit exakt gleichen Parametern nochmal ausgeführt (rerun/rerun since): Bareos * All-Drives-Feature (Bareos): in Bacula müssen alle Dateisystem/Laufwerk explizit angegeben werden, neue Dateisystem oder Laufwerkbuchstaben müssen explizit angegeben werden, das feature in Bareos nimmt dies automatisch vor * Alle Komponenten laufen auf Windows (nur Bareos, Bacula nur FD): Director, storage-daemon und low-level-tool bextract (benötigt für sehr alte Windows-Dateien wo die Windows-ACLs intakt bleiben sollen) * Windows EFS filesystems (Bareos ab 13.4.x) * mehrere Jobs-IDs mit bconsole abbrechen (Bareos ab 13.2.x) * passive-Client nur in Bareos (ab 13.1.x) - Firewallproblematik siehe unten * Unterstützung des dedup-Dateisystems von Server 2012 (Bareos) * storage-daemon plugins (Bareos), Beispiel (de)Kompression auf dem SD * Bandbreitenlimitierung (Bacula 7.2.0, Bareos) ==== Transportverschlüsselung ==== CA (fremde oder eigene): * [[https://www.bacula.org/11.0.x-manuals/en/main/Bacula_TLS_Communications_E.html|bacula]] * [[https://docs.bareos.org/TasksAndConcepts/TransportEncryption.html#getting-tls-certificates|bareos]] TLS-PSK (Pre Shared Keys) * [[https://www.bacula.org/bacula-release-11-0-5/|bacula ab 11.x]] * [[https://docs.bareos.org/TasksAndConcepts/TransportEncryption.html|Bareos ab >= 18.2.4]] ==== Verschlüsselung auf dem fd ==== Mit dem feature "PKI Encryption" können die Daten direkt auf dem fd/agent verschlüsselt werden (bevor sie zum storage daemon geschickt werden), das funktioniert über einen Public/Key-Schlüssel auf dem client, die Daten werden per AES-128 verschlüsselt. Einschränkungen: * metadaten werden nicht verschlüsselt (Dateiname, Größe etc.) * der director könnte durch ein restore-job den Schlüssel ändern bzw. austauschen [[https://www.bacula.org/5.0.x-manuals/en/main/main/Data_Encryption.html|Data Encryption]] (bacula) [[https://docs.bareos.org/TasksAndConcepts/DataEncryption.html|Data Encryption]] (bareos) ==== Object storage ==== S3 Object storage wird nativ in Bacula Enterprise Edition ab Version 8.8 implementiert ([[http://www.bacula.lat/enterprise-bacula-s3-swift-ceph-and-cloud-storage-driver-quick-guide/?lang=en|Enterprise Bacula S3, Swift, CEPH and Cloud Storage Driver Quick Guide]] bzw. [[https://www.baculasystems.com/trial-documentation/step-3-using-bacula-trial-edition/scenario-7-backup-using-the-cloud-plugin/|Scenario 7: Backup using the Cloud plugin]]). In der community-Version geht das nur mit Umwegen: [[https://blog.bacula.org/whitepapers/ObjectStorage.pdf|Bacula Cloud Backup whitepaper]] **Bareos**: Rados (Ceph) Storage plugin () [[https://groups.google.com/forum/#!msg/bareos-users/hnLJrH60GHU/TJlb6j47BAAJ|How to get good speed with Rados (Ceph) storage daemon]]. ===== Backup ===== ==== Arten ==== * vollständig (Vollbackup): alle Daten * differenziell: geänderte Daten seite letztem Vollbackup * inkrementell: geänderte Daten seit letzter Sicherung. Falls das letzte Vollbackup fehlt wird automatisch ein Vollbackup durchgeführt ==== Vorgehensweise ==== === labeling === Wenn ein Job den Status "is waiting for an appendable Volume" anzeigt, muss auf der Console der Befehl "label" eingeben werden. Bacula schickt auch eine eMail mit dem Betreff " Bacula: Intervention needed for ...". Die Backup-Datei bekommt den Namen des Labels. === Firewalling und Anbindung von Internethosts === [[https://www.bacula.org/9.6.x-manuals/en/problems/Dealing_with_Firewalls.html|Firewalling]] Wer muss wen erreichen? * Console -> DIR:9101 * DIR -> SD:9103 * DIR -> FD:9102 * FD -> SD:9103 Eine Anbindung von Backupquellen (mit installiertem bacula-fd) im Internet ist mit Bacula möglich. Vorrausssetzung ist, das die Backupquellen den Storage-daemon (bacula-sd) erreichen können (in der Konfiguration Address und SDPort). Falls dieser im internen LAN steht und nur einen intern erreichbaren DNS-Hostnamen hat, muss dieser mit hosts-Datei umgebogen werden und eine Freigabe in der Firewall eingerichtet werden. Zu beachten ist, dass z. B. der Download beim Vollbackup sehr lange dauern kann und auch ein Restore bei einer geringen Uploadgeschwindigkeit sehr lange dauern wird. Zusätzlich sollte die Firewall-regeln (Verbindung von file-daemon zum storage-daemon) auch die IP enthalten damit der Dienst nicht für das ganze Internet erreichbar ist. Bareos hat den Modus "passive Client", der eine eingehende Verbindung vom file-daemon zum storage daemon (+DNS-Kenntnis wie man ihn erreicht) unnötig macht. * [[http://www.bacula.lat/bacula-client-behind-nat-support-with-the-connect-to-director-directive/?lang=en|Bacula Client Behind NAT Support with the Connect To Director Directive]] * fd hinter NAT: [[http://www.bacula.lat/bacula-firewallnat-transversing-client-initiated-backup/?lang=en|Client Initiated Backup]] ab [[https://www.baculasystems.com/corporate-data-backup-software-solutions/bacula-enterprise-data-backup-software/client-initiated-backup-with-bacula-enterprise-edition-8-6/|Bacula Enterprise 8.6]] [[https://www.bacula.org/9.0.x-manuals/en/main/New_Features_in_9_0_0.html#SECTION00308000000000000000|Bacula OSS 9.0]] ===== Restore ===== Es stehen verschiedene Möglichkeiten zum restore zur Verfügung, die häufigste Wahl ist das letzte Backup ("5: Select the most recent backup for a client") bzw. ein bestimmter Zeitpunkt ("6: Select backup for a client before a specified time"). Vollständige Liste der Möglichkeiten: To select the JobIds, you have the following choices: 1: List last 20 Jobs run 2: List Jobs where a given File is saved 3: Enter list of comma separated JobIds to select 4: Enter SQL list command 5: Select the most recent backup for a client 6: Select backup for a client before a specified time 7: Enter a list of files to restore 8: Enter a list of files to restore before a specified time 9: Find the JobIds of the most recent backup for a client 10: Find the JobIds for a backup for a client before a specified time 11: Enter a list of directories to restore for found JobIds 12: Select full restore to a specified Job date 13: Cancel ===== Tools ===== Das folgende Skript löscht alle wartenden Jobs: #!/bin/bash jobIds=`echo 'status dir running' | bconsole | fgrep 'is waiting' | awk '{print $1}'` for i in $jobIds do if [ -z `echo "$i" | grep '^[0-9]\+$'` ] then echo "Error: job ID $i is not a number!" else echo "Killing waiting Bacula job $i" echo "cancel jobid=$i" | bconsole fi done Quelle: https://www.cyberwizzard.nl/gentoo-linux/144-kill-all-waiting-backup-jobs-in-bacula.html ====== baculum Webconsole ====== FIXME ==== Console bacula-console ==== Wenn die bacula-console richtig konfiguriert ist kommt bei der Verbindung folgende Meldung: Connecting to Director MY-BACULA:9101 1000 OK: bacula-dir Version: 1.38.11 (28 June 2006) Die möglichen Kommandos bekommt man nach Eingabe von "help": Command Description ======= =========== add add media to a pool autodisplay autodisplay [on|off] -- console messages automount automount [on|off] -- after label cancel cancel [ ==== bacula-console-qt ==== Die grafische Konsole aus dem Ubuntu-Paket (''bacula-console-qt'') ist sehr zähflüssig in der Bedienung. Starten kann man sie mit dem Aufruf von ''bat'', es muss im Aufrufverzeichnis eine Konfigurationsdatei unter dem Namen bat.conf existieren, diese kann man von der bconsole (''/etc/bacula/bconsole.conf'') nehmen. ==== Bacula und Nagios ==== FIXME ==== BReport ==== [[http://breport.sourceforge.net/]] ==== Traymonitor ==== Der Traymonitor wird als "Restricted Director" konfiguriert. Dazu vergibt man ein eigenes Passwort. ===== Konfiguration ===== ==== abweichende Ports ==== Achtung: Falls die Standard-ports (TCP 5901 bis 5903) geändert werden, solltes dieses in der ''/etc/services'' auch eingetragen werden! Ansonsten finden die Init-scripte das PID-file (dort steht die aktuelle Prozess-ID drin) nicht und man wundert sich warum Konfigurationsänderungen nicht übernommen werden. Grund ist das die Prozesse gar nicht gefunden werden und somit auch nicht neu starten, deshalb werden Konfigurationsänderungen auch nicht übernommen. {{:software:bacula-conf-diagram.png|Bacula Konfigurationsdiagramm}} ==== Dualstack ==== Bacula bindet standardmäßig leider nur 0.0.0.0 (nicht ::0), daher müssen die Listen-IP explizit angegeben werden oder (eleganter) den FQDN (hier: fqdn.backup.server). Bei IPv6 würde also der FD erstmal in einen Verbindungsreset hineinlaufen und danach auf IPv4 zurückfallen. Hier ist eine funktionierende Dualstack-konfiguration (v4 + v6, getestet mit Version 9.4.2, auskommentiert ist der "alte" Konfigurationsstyle): /etc/bacula/bacula-dir.conf : # DirAddress = fqdn.backup.server # bind to this address # DIRport = 9101 # where we listen for UA connections DirAddresses = { ipv4 = { addr = fqdn.backup.server; port = 9101; } ipv6 = { addr = fqdn.backup.server; port = 9101; } } /etc/bacula/bacula-fd.conf : # FDAddress = fqdn.backup.server # FDport = 9102 FDAddresses = { ipv4 = { addr = fqdn.backup.server; port = 9102; } ipv6 = { addr = fqdn.backup.server; port = 9102; } } /etc/bacula/bacula-sd.conf : # SDAddress = fqdn.backup.server # SDport = 9103 SDAddresses = { ipv4 = { addr = fqdn.backup.server; port = 9103; } ipv6 = { addr = fqdn.backup.server; port = 9103; } } } ==== Director: bacula-dir.conf ==== * Sektionen: * Director * Port 9101 * Password: Passwort für die Console * JobDefs Config-Datei per include einbinden (Übersichtlichkeit, Automatisierung): # source everything under "/etc/bacula/conf.d" @|"sh -c 'for f in /etc/bacula/conf.d/*.conf ; do echo @${f} ; done'" ==== File-Daemon bacula-fd.conf ==== - Name (Name) anpassen - IP-Adresse (FDAddress) zum lauschen angeben - Restricted Director für traymonitor konfigurieren === systemd-service === * Bacula-fd systemd.service ''/etc/systemd/system/bacula-fd.service'' * systemctl daemon-reload * systemctl enable bacula-fd.service # Systemd Bacula service file # # Copyright (C) 2000-2016 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS # # /lib/systemd/system/bacula-fd.service # # Description: # Used to start the bacula file daemon service (bacula-fd) # # enable : systemctl enable bacula-fd # start : systemctl start bacula-fd # # # from http://www.freedesktop.org/software/systemd/man/systemd.unit.html [Unit] Description=Bacula File Daemon service Requires=network.target After=network.target RequiresMountsFor=/var/lib/bacula /etc/bacula /usr/sbin /run/bacula # from http://www.freedesktop.org/software/systemd/man/systemd.service.html [Service] Type=simple User=root Group=root Environment="CONFIG=/etc/bacula/bacula-fd.conf" EnvironmentFile=-/etc/default/bacula-fd ExecStartPre=/usr/sbin/bacula-fd -t -c $CONFIG ExecStart=/usr/sbin/bacula-fd -f -c $CONFIG ExecReload=/bin/kill -HUP $MAINPID SuccessExitStatus=15 StandardError=syslog [Install] WantedBy=multi-user.target ==== Storage-Daemon bacula-sd.conf ==== - Name (Name) anpassen - IP-Adresse (SDAddress) zum lauschen angeben - Restricted Director für traymonitor konfigurieren - Storage für die Dateiablage konfigurieren. - Name und Mediatype müssen in'' bacula-dir.conf'' übereinstimmen - Standardmäßig ist hier die Dateiablage unter /tmp angegeben. ==== Console ==== - ''Öffnen /etc/bacula/bconsole.conf'' - Hostname (address) des directors eintragen - Password (password) des directors eintragen ==== Jobs vor/nach Backup auf Zielhost ausführen ==== Dies geht über [[http://www.bacula.org/en/dev-manual/Configuring_Director.html#5203|Client Run Before/After Jobs]]. ==== verschlüsselte Kommunikation ==== In der Standardeinstellung wird anhand des Passwort-hashes (per CRAM-MD5) überprüft ob eine Kommunikation erlaubt wird. Ansonsten wird die Kommunikation unverschlüsselt geführt. Ab Bacula version 2.5.x ist SSL/TLS-Verschlüsselung möglich: Nur Authentifizierung der Partner (keine Verschlüsselung der Nutzdaten!): TLS Authenticate = yes Vollständige Verschlüsselung (Authentifizierung + Nutzdaten), siehe auch: [[http://www.bacula.org/5.0.x-manuals/en/main/main/Bacula_TLS_Communications.html|Bacula TLS - Communications Encryption]] TLS Enable = yes TLS Require = yes # enforce encrypted communication Verify Peer = yes Die Kommunikationspartner werden überprüft (Einstellung nur auf im Server-kontext möglich, also beim dir FIXME). Wenn nicht per ''TLS Allowed CN'' bestimmte Common-Names eingeschränkt sind, dann werden alle gültigen Zertifikate der im System bekannten Root-CAs akzeptiert. TLS Allowed CN = Schränkt auf bestimmte Common-Names ein, die Direktive kann mehrfach angegeben werden. TLS CA Certificate File = /etc/bacula/ca.pem # This is a server certificate, used for incoming console connections TLS Certificate = /etc/bacula/host.crt.pem # public Certificate TLS Key = /etc/bacula/host.key.pem # private key ====== Konfigurations Beispiele Bacula ====== ===== File-daemon ===== ==== Vorgehensweise ==== - bacula-fd.conf anlegen - Passwort / IP / Name ändern - die fd-Konfiguration anpassen - In Client-Sektion die Daten aus der eben angelegten "bacula-fd.conf" kopieren - JobDefs - Job - Fileset ==== Windows ==== Der file-Daemon (Bezeichnung als "Client" auf Windows). # # "Global" File daemon configuration specifications # FileDaemon { # this is me Name = windowSRV-fd FDport = 9102 # where we listen for the director WorkingDirectory = "C:/Dokumente und Einstellungen/All Users/Anwendungsdaten/Bacula/Work" Pid Directory = "C:/Dokumente und Einstellungen/All Users/Anwendungsdaten/Bacula/Work" Maximum Concurrent Jobs = 2 } # # List Directors who are permitted to contact this File daemon # Director { Name = bacula-dir Password = "Passwort_ändern!" } # # Restricted Director, used by tray-monitor to get the # status of the file daemon # Director { Name = bacula-mon Password = "Passwort_ändern!" Monitor = yes } # Send all messages except skipped files back to Director Messages { Name = Standard director = bacula-dir = all, !skipped, !restored } ==== Linux ==== # # List Directors who are permitted to contact this File daemon # Director { Name = bacula-dir Password = "Passwort_ändern!" } # # Restricted Director, used by tray-monitor to get the # status of the file daemon # Director { Name = bacula-mon Password = "Passwort_ändern!" Monitor = yes } # # "Global" File daemon configuration specifications # FileDaemon { # this is me Name = bacula-fd FDport = 9102 # where we listen for the director WorkingDirectory = /var/lib/bacula Pid Directory = /var/run/bacula Maximum Concurrent Jobs = 20 FDAddress = 127.0.0.1 # change! } # Send all messages except skipped files back to Director Messages { Name = Standard director = bacula-dir = all, !skipped, !restored } ===== Console ===== # # Bacula User Agent (or Console) Configuration File # Director { Name = bacula.pi4-director DIRport = 9101 address = bacula.pi4 Password = "Passwort_ändern!" } ====== Problembehebung ====== Passt die Version des fd zum director/sd? -> er därf älter sein aber nicht neuer! Evtl. muss der bacula-fd und bacula-common per downgrade auf eine ältere Version gebracht werden und per pinning vor updates geschützt werden. ===== Fatal error: Unable to authenticate with File daemon at "ADDRESSE:PORT" ===== Gründe - **Name des Directors** ist in der Konfiguration des directors und des file-daemons unterschiedlich - **Passwort des file-daemons** ist in der Konfiguration des directors und des file-daemons unterschiedlich - nach **Portänderungen** wurde die Konfiguration nicht korrekt übernommen (veränderte Ports in ''/etc/services'' eintragen) - **"Maximum Concurrent Jobs"** wurde auf dem file-daemons überschritten und er lehnt zusätzliche Verbindungen ab - hosts.allow or hosts.deny verbieten eine Kommunikation zwischen den Rechnern - es existiert kein **Reverse-lookup** für die Adresse - **diverse Netzwerkprobleme** - funktioniert DNS? - Ist der fd wirklich auf dem Zielrechner auf dem angegebenem Port (überprüfen mit ''lsof -i'') - Blockiert eine zwischengeschaltete **Firewall** die Kommunikation? - der Director muss den fd erreichen können - der fd muss den sd erreichen können (fd initiiert die Verbindung!) - Routing-probleme - ... siehe auch: [[http://www.bacula.org/5.0.x-manuals/en/problems/problems/Bacula_Frequently_Asked_Que.html#SECTION00260000000000000000|I'm Getting Authorization Errors. What is Going On? (Bacula-FAQ)]] ===== wartende Jobs canceln ===== Per [[https://www.stefanux.de/wiki/doku.php/shellscripts/shellscripts|Shellskript]] die wartenden Jobs abbrechen: #!/bin/bash jobIds=`echo 'status dir running' | bconsole | fgrep 'is waiting' | awk '{print $1}'` for i in $jobIds do if [ -z `echo "$i" | grep '^[0-9]\+$'` ] then echo "Error: job ID $i is not a number!" else echo "Killing waiting Bacula job $i" echo "cancel jobid=$i" | bconsole fi done Alternativ: [[http://wiki.bacula.org/doku.php?id=bacula_manual:the_job_resource#max_wait_time_time|Max Wait Time]] Quelle: [[https://www.cyberwizzard.nl/gentoo-linux/144-kill-all-waiting-backup-jobs-in-bacula.html|Kill all waiting backup jobs in Bacula]] ===== Volume properties ändern ===== z.B. falls der Datenträger voll war: #!/bin/bash for i in $(seq -w 00 68) do if [ -z `echo "$i" | grep '^[0-9]\+$'` ] then echo "Error: job ID $i is not a number!" else echo "update volume=Bacula-Vol-00$i volstatus=append" | bconsole fi done ===== Fatal error: File daemon at "x.x.x.x:9102" rejected Hello command ===== Diese Fehlermeldung entsteht wenn die Komponenten von Bacula von der Versionsnummer her inkompatibel sind. Z.B. dann wenn der Director eine ältere Versionsnummer als der File-daemon hat. Wenn man den FD auf die gleiche Versionsnummer wie den Director bringt ist man auf der sicheren Seite. Wenn der file-daemon eine ältere Versionnummer als der Director hat sollte es trotzdem funktionieren. Siehe auch Kapitel DB-Upgrade. ===== Bacula DB-Upgrade bei MySQL ===== Während der großen Versionssprünge kommt es zu Änderungen im Datenbank-layout. Die Tabelle Version zeigt die aktuelle Version des Layouts. Die folgenden SQL-Befehle befinden sich u.a. im [[http://packages.debian.org/squeeze/amd64/bacula-director-mysql/download|bacula-director-mysql-Paket]] von [[debian:Debian]] wenn es entpackt wurde in der data.tar.gz im Verzeichnis ''/usr/share/dbconfig-common/data/bacula-director-mysql/upgrade/mysql'' bei anderen DB-Versionen analog. Aktuelle DB-Version anzeigen: SELECT * FROM Version; **DB-Upgrade auf Bacula 3.x **, mir ist nicht bekannt welche minimale Version nötig ist, es funktioniert von Version 10 (z. B. Bacula 2.4.4) auf 11: -- Fix bad index on Media table DROP INDEX inx8 ON Media; CREATE UNIQUE INDEX inx8 ON Media (VolumeName(128)); ALTER TABLE File CHANGE FileId FileId BIGINT UNSIGNED NOT NULL AUTO_INCREMENT; ALTER TABLE BaseFiles CHANGE FileId FileId BIGINT UNSIGNED NOT NULL; ALTER TABLE Job ADD ReadBytes BIGINT UNSIGNED DEFAULT 0 AFTER JobBytes; ALTER TABLE Media ADD ActionOnPurge TINYINT DEFAULT 0 AFTER Recycle; ALTER TABLE Pool ADD ActionOnPurge TINYINT DEFAULT 0 AFTER Recycle; DELETE FROM Version; INSERT INTO Version (VersionId) VALUES (11); -- If you have already this table, you can remove it with: -- DROP TABLE JobHistory; -- Create a table like Job for long term statistics CREATE TABLE JobHisto ( JobId INTEGER UNSIGNED NOT NULL, Job TINYBLOB NOT NULL, Name TINYBLOB NOT NULL, Type BINARY(1) NOT NULL, Level BINARY(1) NOT NULL, ClientId INTEGER DEFAULT 0, JobStatus BINARY(1) NOT NULL, SchedTime DATETIME DEFAULT 0, StartTime DATETIME DEFAULT 0, EndTime DATETIME DEFAULT 0, RealEndTime DATETIME DEFAULT 0, JobTDate BIGINT UNSIGNED DEFAULT 0, VolSessionId INTEGER UNSIGNED DEFAULT 0, VolSessionTime INTEGER UNSIGNED DEFAULT 0, JobFiles INTEGER UNSIGNED DEFAULT 0, JobBytes BIGINT UNSIGNED DEFAULT 0, ReadBytes BIGINT UNSIGNED DEFAULT 0, JobErrors INTEGER UNSIGNED DEFAULT 0, JobMissingFiles INTEGER UNSIGNED DEFAULT 0, PoolId INTEGER UNSIGNED DEFAULT 0, FileSetId INTEGER UNSIGNED DEFAULT 0, PriorJobId INTEGER UNSIGNED DEFAULT 0, PurgedFiles TINYINT DEFAULT 0, HasBase TINYINT DEFAULT 0, INDEX (StartTime) ); **DB-Upgrade von Bacula 3.x auf 5.0** (Version 11 auf 12): ALTER TABLE JobMedia DROP Copy ; ALTER TABLE Job ADD COLUMN HasCache tinyint default 0 after HasBase; ALTER TABLE Job ADD COLUMN Reviewed tinyint default 0 after HasCache; ALTER TABLE Job ADD COLUMN Comment BLOB AFTER Reviewed; ALTER TABLE JobHisto ADD COLUMN HasCache tinyint default 0 after HasBase; ALTER TABLE JobHisto ADD COLUMN Reviewed tinyint default 0 after HasCache; ALTER TABLE JobHisto ADD COLUMN Comment BLOB AFTER Reviewed; ALTER TABLE Status ADD COLUMN Severity int; UPDATE Status SET Severity = 15; UPDATE Status SET Severity = 100 where JobStatus = 'f'; UPDATE Status SET Severity = 90 where JobStatus = 'A'; UPDATE Status SET Severity = 10 where JobStatus = 'T'; UPDATE Status SET Severity = 20 where JobStatus = 'e'; UPDATE Status SET Severity = 25 where JobStatus = 'E'; CREATE TABLE PathHierarchy ( PathId integer NOT NULL, PPathId integer NOT NULL, CONSTRAINT pathhierarchy_pkey PRIMARY KEY (PathId) ); CREATE INDEX pathhierarchy_ppathid ON PathHierarchy (PPathId); CREATE TABLE PathVisibility ( PathId integer NOT NULL, JobId integer NOT NULL, Size int8 DEFAULT 0, Files int4 DEFAULT 0, CONSTRAINT pathvisibility_pkey PRIMARY KEY (JobId, PathId) ); CREATE INDEX pathvisibility_jobid ON PathVisibility (JobId); CREATE INDEX basefiles_jobid_idx ON BaseFiles ( JobId ); DELETE FROM Version; INSERT INTO Version (VersionId) VALUES (12); **DB-Upgrade von Bacula 5.0 auf 5.2** (Version 14): CREATE TABLE RestoreObject ( RestoreObjectId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, ObjectName BLOB NOT NULL, RestoreObject LONGBLOB NOT NULL, PluginName TINYBLOB NOT NULL, ObjectLength INTEGER DEFAULT 0, ObjectFullLength INTEGER DEFAULT 0, ObjectIndex INTEGER DEFAULT 0, ObjectType INTEGER DEFAULT 0, FileIndex INTEGER UNSIGNED DEFAULT 0, JobId INTEGER UNSIGNED NOT NULL REFERENCES Job, ObjectCompression INTEGER DEFAULT 0, PRIMARY KEY(RestoreObjectId), INDEX (JobId) ); CREATE INDEX jobhisto_jobid_idx ON JobHisto (JobId); ALTER TABLE File ADD COLUMN DeltaSeq smallint default 0; DELETE FROM Version; INSERT INTO Version (VersionId) VALUES (14); **DB-Upgrade von Bacula 5.2 auf 7.2.0** (Version auf 15): INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES ('I', 'Incomplete Job',25); ALTER TABLE Media ADD COLUMN VolABytes BIGINT UNSIGNED DEFAULT 0; ALTER TABLE Media ADD COLUMN VolAPadding BIGINT UNSIGNED DEFAULT 0; ALTER TABLE Media ADD COLUMN VolHoleBytes BIGINT UNSIGNED DEFAULT 0; ALTER TABLE Media ADD COLUMN VolHoles INTEGER UNSIGNED DEFAULT 0; ALTER TABLE Media CHANGE VolWrites VolWrites BIGINT UNSIGNED; CREATE TABLE Snapshot ( SnapshotId INTEGER UNSIGNED AUTO_INCREMENT, Name TINYBLOB NOT NULL, JobId INTEGER UNSIGNED DEFAULT 0, FileSetId INTEGER UNSIGNED DEFAULT 0, CreateTDate BIGINT NOT NULL, CreateDate DATETIME NOT NULL, ClientId INTEGER UNSIGNED DEFAULT 0, Volume TINYBLOB NOT NULL, Device TINYBLOB NOT NULL, Type TINYBLOB NOT NULL, Retention INTEGER DEFAULT 0, Comment BLOB, primary key (SnapshotId) ); CREATE UNIQUE INDEX snapshot_idx ON Snapshot (Device(255), Volume(255), Name(255)); CREATE INDEX jobtdate_idx on JobHisto (JobTDate); UPDATE Version SET VersionId=15; **DB-Upgrade von Bacula 7.2.x auf 9.0.x** (Version 16): ALTER TABLE BaseFiles MODIFY COLUMN BaseId BIGINT UNSIGNED NOT NULL AUTO_INCREMENT; ALTER TABLE Media CHANGE COLUMN VolParts VolType INTEGER UNSIGNED DEFAULT 0; ALTER TABLE Media ADD COLUMN VolParts INTEGER DEFAULT 0; ALTER TABLE Media ADD COLUMN VolCloudParts INTEGER DEFAULT 0; ALTER TABLE Media ADD COLUMN LastPartBytes BIGINT DEFAULT 0; ALTER TABLE Media ADD COLUMN CacheRetention BIGINT DEFAULT 0; ALTER TABLE Pool ADD COLUMN CacheRetention BIGINT DEFAULT 0; -- If you switch to MySQL 5.7 ALTER TABLE Device ALTER COLUMN CleaningDate DROP DEFAULT; ALTER TABLE Job ALTER COLUMN SchedTime DROP DEFAULT; ALTER TABLE Job ALTER COLUMN StartTime DROP DEFAULT; ALTER TABLE Job ALTER COLUMN EndTime DROP DEFAULT; ALTER TABLE Job ALTER COLUMN RealEndTime DROP DEFAULT; ALTER TABLE JobHisto ALTER COLUMN SchedTime DROP DEFAULT; ALTER TABLE JobHisto ALTER COLUMN StartTime DROP DEFAULT; ALTER TABLE JobHisto ALTER COLUMN EndTime DROP DEFAULT; ALTER TABLE JobHisto ALTER COLUMN RealEndTime DROP DEFAULT; ALTER TABLE LocationLog ALTER COLUMN Date DROP DEFAULT; ALTER TABLE FileSet ALTER COLUMN CreateTime DROP DEFAULT; ALTER TABLE Media ALTER COLUMN FirstWritten DROP DEFAULT; ALTER TABLE Media ALTER COLUMN LastWritten DROP DEFAULT; ALTER TABLE Media ALTER COLUMN LabelDate DROP DEFAULT; ALTER TABLE Media ALTER COLUMN InitialWrite DROP DEFAULT; ALTER TABLE Log ALTER COLUMN Time DROP DEFAULT; # speeds up restore selection if many files and accurate CREATE INDEX job_jobtdate_idx ON Job (JobTDate); UPDATE Version SET VersionId=16; **DB-Fix 9.2.1-2**: ### this is extracted from src/cats/update_mysql_tables.in ### Authors comment: # Update version 16 to be more robust for newer more # strict MySQLs. Note: this is a post-first release # fix. ALTER TABLE Device MODIFY CleaningDate DATETIME DEFAULT NULL; ALTER TABLE File MODIFY FileIndex INTEGER DEFAULT 0; ALTER TABLE RestoreObject MODIFY FileIndex INTEGER DEFAULT 0; ALTER TABLE BaseFiles MODIFY FileIndex INTEGER DEFAULT 0; ALTER TABLE Media MODIFY FirstWritten DATETIME DEFAULT NULL, MODIFY LastWritten DATETIME DEFAULT NULL, MODIFY LabelDate DATETIME DEFAULT NULL, MODIFY InitialWrite DATETIME DEFAULT NULL; ALTER TABLE Job MODIFY SchedTime DATETIME DEFAULT NULL, MODIFY StartTime DATETIME DEFAULT NULL, MODIFY EndTime DATETIME DEFAULT NULL, MODIFY RealEndTime DATETIME DEFAULT NULL; ALTER TABLE JobHisto MODIFY SchedTime DATETIME DEFAULT NULL, MODIFY StartTime DATETIME DEFAULT NULL, MODIFY EndTime DATETIME DEFAULT NULL, MODIFY RealEndTime DATETIME DEFAULT NULL; ALTER TABLE LocationLog MODIFY Date DATETIME DEFAULT NULL; ALTER TABLE CDImages MODIFY LastBurn DATETIME DEFAULT NULL; # Permit catalog to contain negative FileIndexes ALTER TABLE File MODIFY FileIndex INTEGER DEFAULT 0; ALTER TABLE RestoreObject MODIFY FileIndex INTEGER DEFAULT 0; ALTER TABLE BaseFiles MODIFY FileIndex INTEGER DEFAULT 0; **DB-Upgrade von Bacula 9.0.x auf 11.x** (Version 17 ?): FIXME