Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
software:bacula [2020/05/16 15:03] – [abweichende Ports] st | software:bacula [2023/07/08 11:50] (aktuell) – [Bacula DB-Upgrade bei MySQL] st | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ====== Backup mit Bacula ====== | ||
+ | Bacula ist ein Netzwerkbackupsystem mit Client/ | ||
+ | |||
+ | Bacula unterstützt Linux-, Unix- und Windows-Backup-Clients, | ||
+ | |||
+ | Quelle: [[wpde> | ||
+ | |||
+ | |||
+ | ===== Versionen, Entwicklung und Forks ===== | ||
+ | |||
+ | * Bacula Community-Version | ||
+ | * Bacula Enterprise Edition (Firma: Bacula Systems) - [[https:// | ||
+ | * 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:// | ||
+ | |||
+ | Bareos wurde (etwa 2010) von Bacula abgespalten, | ||
+ | |||
+ | Wann braucht man kommerzielle Versionen? | ||
+ | - Web-Oberfläche für Kunden? | ||
+ | - aktueller Windows-Client? | ||
+ | - spezielle plugins (Datenbanken, | ||
+ | - wenn man kein eigenes know-how hat (bzw. aufbauen will) | ||
+ | |||
+ | ==== Bacula 11.x ==== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | ===== Links ===== | ||
+ | |||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[https:// | ||
+ | |||
+ | ==== Vorträge ==== | ||
+ | |||
+ | * [[https:// | ||
+ | |||
+ | ==== Dienstleister ==== | ||
+ | |||
+ | in Deutschland: | ||
+ | * [[http:// | ||
+ | * [[https:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | |||
+ | |||
+ | ===== Komponenten und Begriffe ===== | ||
+ | |||
+ | {{: | ||
+ | |||
+ | * **Catalogue** (SQL-DB): Katalog der gesicherten Dateien und sonstige Daten, unterstützt werden: MySQL ('' | ||
+ | * **Director** (bacula-dir): | ||
+ | * **Storage** (bacula-sd): | ||
+ | * **File-daemon** (bacula-fd): | ||
+ | * **Console**: | ||
+ | |||
+ | Director und Catalog gibts einmal, die anderen Komponenten lassen sich beliebig (oft) verteilen. | ||
+ | |||
+ | * Jobs: Ein Backup-Auftrag enthält/ | ||
+ | * 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:// | ||
+ | |||
+ | |||
+ | ===== 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/ | ||
+ | * All-Drives-Feature (Bareos): in Bacula müssen alle Dateisystem/ | ||
+ | * 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:// | ||
+ | * [[https:// | ||
+ | | ||
+ | TLS-PSK (Pre Shared Keys) | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | |||
+ | ==== Verschlüsselung auf dem fd ==== | ||
+ | |||
+ | Mit dem feature "PKI Encryption" | ||
+ | |||
+ | 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:// | ||
+ | [[https:// | ||
+ | |||
+ | ==== Object storage ==== | ||
+ | |||
+ | S3 Object storage wird nativ in Bacula Enterprise Edition ab Version 8.8 implementiert ([[http:// | ||
+ | |||
+ | In der community-Version geht das nur mit Umwegen: [[https:// | ||
+ | |||
+ | **Bareos**: Rados (Ceph) Storage plugin () [[https:// | ||
+ | |||
+ | ===== Backup ===== | ||
+ | |||
+ | ==== Arten ==== | ||
+ | |||
+ | * vollständig (Vollbackup): | ||
+ | * differenziell: | ||
+ | * inkrementell: | ||
+ | |||
+ | ==== Vorgehensweise ==== | ||
+ | |||
+ | === labeling === | ||
+ | |||
+ | Wenn ein Job den Status "is waiting for an appendable Volume" | ||
+ | |||
+ | |||
+ | === Firewalling und Anbindung von Internethosts === | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | 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 " | ||
+ | |||
+ | * [[http:// | ||
+ | * fd hinter NAT: [[http:// | ||
+ | |||
+ | ===== 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" | ||
+ | |||
+ | 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: | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | jobIds=`echo ' | ||
+ | for i in $jobIds | ||
+ | do | ||
+ | if [ -z `echo " | ||
+ | then | ||
+ | echo " | ||
+ | else | ||
+ | echo " | ||
+ | echo " | ||
+ | fi | ||
+ | done | ||
+ | </ | ||
+ | Quelle: https:// | ||
+ | ====== baculum Webconsole ====== | ||
+ | |||
+ | FIXME | ||
+ | |||
+ | ==== Console bacula-console ==== | ||
+ | |||
+ | Wenn die bacula-console richtig konfiguriert ist kommt bei der Verbindung folgende Meldung: | ||
+ | |||
+ | < | ||
+ | Connecting to Director MY-BACULA: | ||
+ | 1000 OK: bacula-dir Version: 1.38.11 (28 June 2006) | ||
+ | </ | ||
+ | |||
+ | Die möglichen Kommandos bekommt man nach Eingabe von " | ||
+ | |||
+ | < | ||
+ | Command | ||
+ | ======= | ||
+ | add add media to a pool | ||
+ | autodisplay autodisplay [on|off] -- console messages | ||
+ | automount | ||
+ | cancel | ||
+ | </ | ||
+ | |||
+ | ==== bacula-console-qt ==== | ||
+ | |||
+ | Die grafische Konsole aus dem Ubuntu-Paket ('' | ||
+ | |||
+ | ==== Bacula und Nagios ==== | ||
+ | |||
+ | FIXME | ||
+ | |||
+ | ==== BReport ==== | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | ==== Traymonitor ==== | ||
+ | |||
+ | Der Traymonitor wird als " | ||
+ | |||
+ | ===== Konfiguration ===== | ||
+ | |||
+ | ==== abweichende Ports ==== | ||
+ | |||
+ | Achtung: Falls die Standard-ports (TCP 5901 bis 5903) geändert werden, solltes dieses in der ''/ | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ==== 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 " | ||
+ | |||
+ | / | ||
+ | <code bash> | ||
+ | # DirAddress = fqdn.backup.server | ||
+ | # DIRport = 9101 # where we listen for UA connections | ||
+ | DirAddresses = { | ||
+ | ipv4 = { addr = fqdn.backup.server; | ||
+ | ipv6 = { addr = fqdn.backup.server; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | / | ||
+ | <code bash> | ||
+ | # FDAddress = fqdn.backup.server | ||
+ | # FDport = 9102 | ||
+ | FDAddresses = { | ||
+ | ipv4 = { addr = fqdn.backup.server; | ||
+ | ipv6 = { addr = fqdn.backup.server; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | / | ||
+ | <code bash> | ||
+ | # SDAddress = fqdn.backup.server | ||
+ | # SDport = 9103 | ||
+ | SDAddresses = { | ||
+ | ipv4 = { addr = fqdn.backup.server; | ||
+ | ipv6 = { addr = fqdn.backup.server; | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ==== Director: bacula-dir.conf ==== | ||
+ | |||
+ | * Sektionen: | ||
+ | * Director | ||
+ | * Port 9101 | ||
+ | * Password: Passwort für die Console | ||
+ | * JobDefs | ||
+ | |||
+ | Config-Datei per include einbinden (Übersichtlichkeit, | ||
+ | <code bash> | ||
+ | # source everything under "/ | ||
+ | @|"sh -c 'for f in / | ||
+ | </ | ||
+ | |||
+ | ==== 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 ''/ | ||
+ | * 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 | ||
+ | # | ||
+ | # / | ||
+ | # | ||
+ | # Description: | ||
+ | # Used to start the bacula file daemon service (bacula-fd) | ||
+ | # | ||
+ | # enable : systemctl enable bacula-fd | ||
+ | # start : systemctl start bacula-fd | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # from http:// | ||
+ | [Unit] | ||
+ | Description=Bacula File Daemon service | ||
+ | Requires=network.target | ||
+ | After=network.target | ||
+ | RequiresMountsFor=/ | ||
+ | |||
+ | # from http:// | ||
+ | [Service] | ||
+ | Type=simple | ||
+ | User=root | ||
+ | Group=root | ||
+ | Environment=" | ||
+ | EnvironmentFile=-/ | ||
+ | ExecStartPre=/ | ||
+ | ExecStart=/ | ||
+ | ExecReload=/ | ||
+ | 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'' | ||
+ | - Standardmäßig ist hier die Dateiablage unter /tmp angegeben. | ||
+ | |||
+ | ==== Console ==== | ||
+ | |||
+ | - '' | ||
+ | - Hostname (address) des directors eintragen | ||
+ | - Password (password) des directors eintragen | ||
+ | |||
+ | |||
+ | ==== Jobs vor/nach Backup auf Zielhost ausführen ==== | ||
+ | |||
+ | Dies geht über [[http:// | ||
+ | |||
+ | ==== 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/ | ||
+ | |||
+ | Nur Authentifizierung der Partner (keine Verschlüsselung der Nutzdaten!): | ||
+ | < | ||
+ | TLS Authenticate = yes | ||
+ | </ | ||
+ | |||
+ | Vollständige Verschlüsselung (Authentifizierung + Nutzdaten), siehe auch: [[http:// | ||
+ | |||
+ | < | ||
+ | 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 = | ||
+ | </ | ||
+ | Schränkt auf bestimmte Common-Names ein, die Direktive kann mehrfach angegeben werden. | ||
+ | |||
+ | < | ||
+ | TLS CA Certificate File = / | ||
+ | TLS Certificate = / | ||
+ | TLS 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 " | ||
+ | - JobDefs | ||
+ | - Job | ||
+ | - Fileset | ||
+ | |||
+ | ==== Windows ==== | ||
+ | |||
+ | Der file-Daemon (Bezeichnung als " | ||
+ | |||
+ | < | ||
+ | # | ||
+ | # " | ||
+ | # | ||
+ | FileDaemon { # this is me | ||
+ | Name = windowSRV-fd | ||
+ | FDport = 9102 # where we listen for the director | ||
+ | WorkingDirectory = " | ||
+ | Pid Directory = " | ||
+ | Maximum Concurrent Jobs = 2 | ||
+ | } | ||
+ | |||
+ | # | ||
+ | # List Directors who are permitted to contact this File daemon | ||
+ | # | ||
+ | Director { | ||
+ | Name = bacula-dir | ||
+ | Password = " | ||
+ | } | ||
+ | |||
+ | # | ||
+ | # Restricted Director, used by tray-monitor to get the | ||
+ | # | ||
+ | # | ||
+ | Director { | ||
+ | Name = bacula-mon | ||
+ | Password = " | ||
+ | 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 = " | ||
+ | } | ||
+ | |||
+ | # | ||
+ | # Restricted Director, used by tray-monitor to get the | ||
+ | # | ||
+ | # | ||
+ | Director { | ||
+ | Name = bacula-mon | ||
+ | Password = " | ||
+ | Monitor = yes | ||
+ | } | ||
+ | |||
+ | # | ||
+ | # " | ||
+ | # | ||
+ | FileDaemon { # this is me | ||
+ | Name = bacula-fd | ||
+ | FDport = 9102 # where we listen for the director | ||
+ | WorkingDirectory = / | ||
+ | Pid Directory = / | ||
+ | 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 = " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | ====== Problembehebung ====== | ||
+ | |||
+ | Passt die Version des fd zum director/ | ||
+ | |||
+ | |||
+ | ===== Fatal error: Unable to authenticate with File daemon at " | ||
+ | |||
+ | 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 ''/ | ||
+ | - **" | ||
+ | - 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 '' | ||
+ | - 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:// | ||
+ | |||
+ | |||
+ | ===== wartende Jobs canceln ===== | ||
+ | |||
+ | Per [[https:// | ||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | jobIds=`echo ' | ||
+ | for i in $jobIds | ||
+ | do | ||
+ | if [ -z `echo " | ||
+ | then | ||
+ | echo " | ||
+ | else | ||
+ | echo " | ||
+ | echo " | ||
+ | fi | ||
+ | done | ||
+ | </ | ||
+ | |||
+ | Alternativ: [[http:// | ||
+ | |||
+ | Quelle: [[https:// | ||
+ | |||
+ | ===== Volume properties ändern ===== | ||
+ | |||
+ | z.B. falls der Datenträger voll war: | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | |||
+ | for i in $(seq -w 00 68) | ||
+ | do | ||
+ | if [ -z `echo " | ||
+ | then | ||
+ | echo " | ||
+ | else | ||
+ | echo " | ||
+ | fi | ||
+ | done | ||
+ | </ | ||
+ | ===== Fatal error: File daemon at " | ||
+ | |||
+ | |||
+ | 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:// | ||
+ | |||
+ | |||
+ | Aktuelle DB-Version anzeigen: | ||
+ | <code sql> | ||
+ | |||
+ | **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: | ||
+ | <code sql> | ||
+ | -- 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, | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | INDEX (StartTime) | ||
+ | ); | ||
+ | </ | ||
+ | |||
+ | **DB-Upgrade von Bacula 3.x auf 5.0** (Version 11 auf 12): | ||
+ | |||
+ | <code sql> | ||
+ | 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 = ' | ||
+ | UPDATE Status SET Severity = 90 where JobStatus = ' | ||
+ | UPDATE Status SET Severity = 10 where JobStatus = ' | ||
+ | UPDATE Status SET Severity = 20 where JobStatus = ' | ||
+ | UPDATE Status SET Severity = 25 where JobStatus = ' | ||
+ | |||
+ | CREATE TABLE PathHierarchy | ||
+ | ( | ||
+ | | ||
+ | | ||
+ | | ||
+ | ); | ||
+ | |||
+ | 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): | ||
+ | <code sql> | ||
+ | CREATE TABLE RestoreObject ( | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | JobId INTEGER UNSIGNED NOT NULL REFERENCES Job, | ||
+ | | ||
+ | | ||
+ | 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): | ||
+ | <code sql> | ||
+ | INSERT INTO Status (JobStatus, | ||
+ | | ||
+ | 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 | ||
+ | Name | ||
+ | JobId INTEGER UNSIGNED DEFAULT 0, | ||
+ | FileSetId | ||
+ | CreateTDate | ||
+ | CreateDate | ||
+ | ClientId | ||
+ | Volume | ||
+ | Device | ||
+ | Type | ||
+ | Retention | ||
+ | Comment | ||
+ | primary key (SnapshotId) | ||
+ | ); | ||
+ | |||
+ | CREATE UNIQUE INDEX snapshot_idx ON Snapshot (Device(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): | ||
+ | <code sql> | ||
+ | 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 | ||
+ | ALTER TABLE Job ALTER COLUMN StartTime | ||
+ | ALTER TABLE Job ALTER COLUMN EndTime | ||
+ | ALTER TABLE Job ALTER COLUMN RealEndTime | ||
+ | ALTER TABLE JobHisto ALTER COLUMN SchedTime | ||
+ | ALTER TABLE JobHisto ALTER COLUMN StartTime | ||
+ | ALTER TABLE JobHisto ALTER COLUMN EndTime | ||
+ | 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**: | ||
+ | <code sql> | ||
+ | ### this is extracted from src/ | ||
+ | ### Authors comment: | ||
+ | # Update version 16 to be more robust for newer more | ||
+ | # strict MySQLs. | ||
+ | # fix. | ||
+ | |||
+ | ALTER TABLE Device | ||
+ | | ||
+ | ALTER TABLE File | ||
+ | | ||
+ | ALTER TABLE RestoreObject | ||
+ | | ||
+ | ALTER TABLE BaseFiles | ||
+ | | ||
+ | ALTER TABLE Media | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | ALTER TABLE Job | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | ALTER TABLE JobHisto | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | ALTER TABLE LocationLog | ||
+ | | ||
+ | ALTER TABLE CDImages | ||
+ | | ||
+ | |||
+ | # Permit catalog to contain negative FileIndexes | ||
+ | |||
+ | ALTER TABLE File | ||
+ | | ||
+ | ALTER TABLE RestoreObject | ||
+ | | ||
+ | ALTER TABLE BaseFiles | ||
+ | | ||
+ | </ | ||
+ | |||
+ | **DB-Upgrade von Bacula 9.0.x auf 11.x** (Version 17 ?): | ||
+ | |||
+ | FIXME |