Различия
Здесь показаны различия между двумя версиями данной страницы.
Предыдущая версия справа и слева Предыдущая версия Следующая версия | Предыдущая версия | ||
wiki:руководство_по_ubuntu_server:резервное_копирование:bacula [2012/09/21 12:59] |
wiki:руководство_по_ubuntu_server:резервное_копирование:bacula [2017/12/12 11:35] (текущий) ссылка на русскоязычную документацию |
||
---|---|---|---|
Строка 12: | Строка 12: | ||
====Обзор==== | ====Обзор==== | ||
- | Bacula is made up of several components and services used to manage which files to backup and backup locations: | + | Bacula состоит из нескольких компонентов и сервисов для управления тем, какие файлы сохранять и где хранить резервные копии: |
- | Bacula Director: a service that controls all backup, restore, verify, and archive operations. | + | ~~ **Bacula Director**: сервис, который управляет всеми операциями резервного копирования, восстановления, проверки и архивации. |
+ | ~~ **Bacula Console**: приложение, позволяющее взаимодействовать с **Director**. Существует три версии **Console**: | ||
+ | ~~ текстовая версия, основанная на командной строке. | ||
+ | ~~ графический пользовательский интерфейс (GUI) для **Gnome**, основанный на GTK+. | ||
+ | ~~ графический интерфейс на базе wxWidgets. | ||
+ | ~~ **Bacula File**: она же программа **Bacula Client**. Это приложение устанавливается на машине, на которой производится резервное копирование, и оно отвечает на данные, отправленные по запросу **Director**. | ||
+ | ~~ **Bacula Storage**: программа, которая выполняет хранение и восстановление данных на физических носителях. | ||
+ | ~~ **Bacula Catalog**: отвечает за поддержку файловых индексов и томов баз данных для всех сохраняемых фалов, допуская быстрое нахождение и восстановление сохраненных файлов. **Catalog** поддерживает три различных базы данных: MySQL, PostgreSQL и SQLite. | ||
+ | ~~ **Bacula Monitor**: позволяет отслеживать работу **Director** и сервисов **File** и **Storage**. На данный момент **Monitor** доступен только в виде GTK+ GUI приложения. | ||
- | Bacula Console: an application allowing communication with the Director. There are three versions of the Console: | + | Эти сервисы и приложения могут быть запущены на разных серверах и клиентах или их можно установить на одной машине, если требуется резервное копирование одного диска или тома. |
- | + | ||
- | Text based command line version. | + | |
- | + | ||
- | Gnome based GTK+ Graphical User Interface (GUI) interface. | + | |
- | + | ||
- | wxWidgets GUI interface. | + | |
- | + | ||
- | Bacula File: also known as the Bacula Client program. This application is installed on machines to be backed up, and is responsible for the data requested by the Director. | + | |
- | + | ||
- | Bacula Storage: the programs that perform the storage and recovery of data to the physical media. | + | |
- | + | ||
- | Bacula Catalog: is responsible for maintaining the file indexes and volume databases for all files backed up, enabling quick location and restoration of archived files. The Catalog supports three different databases MySQL, PostgreSQL, and SQLite. | + | |
- | + | ||
- | Bacula Monitor: allows the monitoring of the Director, File daemons, and Storage daemons. Currently the Monitor is only available as a GTK+ GUI application. | + | |
- | + | ||
- | These services and applications can be run on multiple servers and clients, or they can be installed on one machine if backing up a single disk or volume. | + | |
====Установка==== | ====Установка==== | ||
- | If using MySQL or PostgreSQL as your database, you should already have the services available. Bacula will not install them for you. | + | <note>При использовании MySQL или PostgreSQL в качестве базы данных, вам уже должны быть доступны эти сервисы. Bacula не будет устанавливать их для вас.</note> |
- | There are multiple packages containing the different Bacula components. To install Bacula, from a terminal prompt enter: | + | Существует несколько пакетов, содержащих различные компоненты Bacula. Для установки Bacula введите в терминале: |
+ | <code>sudo apt-get install bacula</code> | ||
- | sudo apt-get install bacula | + | При установке по умолчанию пакет **bacula** будет использовать базу данных MySQL для **Catalog**. Если вы хотите использовать SQLite или PostgreSQL, установите соответственно пакет **bacula-director-sqlite3** или **bacula-director-pgsql**. |
- | By default installing the bacula package will use a MySQL database for the Catalog. If you want to use SQLite or PostgreSQL, for the Catalog, install bacula-director-sqlite3 or bacula-director-pgsql respectively. | + | В процессе установки у вас спросят данные об администраторе базы данных и владельце базы данных bacula. Администратор базы данных требуется для получения необходимых прав на создание базы данных. Дополнительную информацию смотрите в разделе [[wiki:руководство_по_ubuntu_server:базы_данных:mysql|MySQL]]. |
- | + | ||
- | During the install process you will be asked to supply credentials for the database administrator and the bacula database owner. The database administrator will need to have the appropriate rights to create a database, see MySQL for more information. | + | |
====Настройка==== | ====Настройка==== | ||
- | Bacula configuration files are formatted based on resources comprising of directives surrounded by “{}” braces. Each Bacula component has an individual file in the /etc/bacula directory. | + | Файлы настройки Bacula форматированы на основе ресурсов, включающих директивы, обрамленные фигурными скобками %%"{}"%%. Каждый компонент Bacula имеет индивидуальный файл в каталоге /etc/bacula. |
- | + | ||
- | The various Bacula components must authorize themselves to each other. This is accomplished using the password directive. For example, the Storage resource password in the /etc/bacula/bacula-dir.conf file must match the Director resource password in /etc/bacula/bacula-sd.conf. | + | |
- | By default the backup job named Client1 is configured to archive the Bacula Catalog. If you plan on using the server to backup more than one client you should change the name of this job to something more descriptive. To change the name edit /etc/bacula/bacula-dir.conf: | + | Различные компоненты Bacula должны авторизовывать себя друг для друга. Это решается использованием директивы **password**. Например, пароль в ресурсе **Storage** файла /etc/bacula/bacula-dir.conf должен соответствовать паролю ресурса **Director** файла /etc/bacula/bacula-sd.conf. |
+ | По умолчанию настраивается задание резервного копирования **Client1** для архивирования **Bacula Catalog**. Если вы планируете использовать сервер для резервного копирования более чем на одном клиенте, вам потребуется изменить имя этого задания на что-то более осмысленное. Для переименования отредактируйте файл /etc/bacula/bacula-dir.conf: | ||
+ | <code> | ||
# | # | ||
# Define the main nightly save backup job | # Define the main nightly save backup job | ||
Строка 62: | Строка 53: | ||
Write Bootstrap = "/var/lib/bacula/Client1.bsr" | Write Bootstrap = "/var/lib/bacula/Client1.bsr" | ||
} | } | ||
+ | </code> | ||
+ | <note>В примере имя задания изменено на **BackupServer** в соответствии с сетевым именем машины. Можете заменить %%"BackupServer"%% на соответствующее сетевое имя вашего сервера или другое описательное название.</note> | ||
- | The example above changes the job name to BackupServer matching the machine's host name. Replace “BackupServer” with your appropriate hostname, or other descriptive name. | + | Требуется использовать **Console** для запросов к **Director** по поводу заданий, но чтобы обычный пользователь мог использовать Console, он должен быть включен в группу **bacula**. Чтобы добавить пользователя в группу **bacula** введите следующую команду в терминале: |
- | + | <code>sudo adduser $username bacula</code> | |
- | The Console can be used to query the Director about jobs, but to use the Console with a non-root user, the user needs to be in the bacula group. To add a user to the bacula group enter the following from a terminal: | + | <note>Замените **//$username//** на актуальное имя пользователя. Также, если вы добавили в группу текущего пользователя, вам придется выйти из системы и зайти снова, чтобы применились новые права доступа.</note> |
- | + | ||
- | sudo adduser $username bacula | + | |
- | + | ||
- | Replace $username with the actual username. Also, if you are adding the current user to the group you should log out and back in for the new permissions to take effect. | + | |
====Резервное копирование локальной системы==== | ====Резервное копирование локальной системы==== | ||
- | This section describes how to backup specified directories on a single host to a local tape drive. | + | Эта секция описывает как сделать резервную копию определенных каталогов на единственном сервере на локальное ленточное устройство. |
- | First, the Storage device needs to be configured. Edit /etc/bacula/bacula-sd.conf add: | + | 1. Для начала требуется настроить устройство хранения. Отредактируйте /etc/bacula/bacula-sd.conf, добавив: |
+ | <code> | ||
+ | Device { | ||
+ | Name = "Tape Drive" | ||
+ | Device Type = tape | ||
+ | Media Type = DDS-4 | ||
+ | Archive Device = /dev/st0 | ||
+ | Hardware end of medium = No; | ||
+ | AutomaticMount = yes; # when device opened, read it | ||
+ | AlwaysOpen = Yes; | ||
+ | RemovableMedia = yes; | ||
+ | RandomAccess = no; | ||
+ | Alert Command = "sh -c 'tapeinfo -f %c | grep TapeAlert'" | ||
+ | } | ||
+ | </code> | ||
+ | Этот пример для ленточного устройства **//DDS-4//**. Измените **%%"Media Type"%%** и **%%"Archive Device"%%** в соответствии с вашим оборудованием. | ||
- | Device { | + | Вы также можете раскомментировать один из примеров в этом файле. |
- | Name = "Tape Drive" | + | |
- | Device Type = tape | + | |
- | Media Type = DDS-4 | + | |
- | Archive Device = /dev/st0 | + | |
- | Hardware end of medium = No; | + | |
- | AutomaticMount = yes; # when device opened, read it | + | |
- | AlwaysOpen = Yes; | + | |
- | RemovableMedia = yes; | + | |
- | RandomAccess = no; | + | |
- | Alert Command = "sh -c 'tapeinfo -f %c | grep TapeAlert'" | + | |
- | } | + | |
- | The example is for a DDS-4 tape drive. Adjust the “Media Type” and “Archive Device” to match your hardware. | + | 2. После редактирования файла /etc/bacula/bacula-sd.conf сервис **Storage** требуется перезагрузить: |
+ | <code>sudo /etc/init.d/bacula-sd restart</code> | ||
- | You could also uncomment one of the other examples in the file. | + | 3. Теперь добавьте ресурс **Storage** в файл /etc/bacula/bacula-dir.conf для использования нового устройства: |
+ | <code> | ||
+ | # Definition of "Tape Drive" storage device | ||
+ | Storage { | ||
+ | Name = TapeDrive | ||
+ | # Do not use "localhost" here | ||
+ | Address = backupserver # N.B. Use a fully qualified name here | ||
+ | SDPort = 9103 | ||
+ | Password = "Cv70F6pf1t6pBopT4vQOnigDrR0v3LT3Cgkiyjc" | ||
+ | Device = "Tape Drive" | ||
+ | Media Type = tape | ||
+ | } | ||
+ | </code> | ||
+ | Директива **Address** должна быть полностью квалифицированным доменным именем (FQDN) сервера. Замените **backupserver** на актуальное сетевое имя. | ||
- | After editing /etc/bacula/bacula-sd.conf the Storage daemon will need to be restarted: | + | Также убедитесь, что директива **Password** соответствует строке пароля в /etc/bacula/bacula-sd.conf. |
- | sudo /etc/init.d/bacula-sd restart | + | 4. Создайте новый **FileSet**, который будет определять какие каталоги копировать, добавив: |
- | + | <code> | |
- | Now add a Storage resource in /etc/bacula/bacula-dir.conf to use the new Device: | + | # LocalhostBacup FileSet. |
- | + | FileSet { | |
- | # Definition of "Tape Drive" storage device | + | Name = "LocalhostFiles" |
- | Storage { | + | Include { |
- | Name = TapeDrive | + | Options { |
- | # Do not use "localhost" here | + | signature = MD5 |
- | Address = backupserver # N.B. Use a fully qualified name here | + | compression=GZIP |
- | SDPort = 9103 | + | |
- | Password = "Cv70F6pf1t6pBopT4vQOnigDrR0v3LT3Cgkiyjc" | + | |
- | Device = "Tape Drive" | + | |
- | Media Type = tape | + | |
} | } | ||
+ | File = /etc | ||
+ | File = /home | ||
+ | } | ||
+ | } | ||
+ | </code> | ||
+ | Этот **FileSet** задает резервное копирование для каталогов **/etc** и **/home**. Директивы ресурса **Options** настраивают FileSet на создание контрольных сумм MD5 для каждого сохраненного файла и сжатие файлов с использованием GZIP. | ||
- | The Address directive needs to be the Fully Qualified Domain Name (FQDN) of the server. Change backupserver to the actual host name. | + | 5. Далее создайте новое расписание **Schedule** для задачи резервного копирования: |
+ | <code> | ||
+ | # LocalhostBackup Schedule -- Daily. | ||
+ | Schedule { | ||
+ | Name = "LocalhostDaily" | ||
+ | Run = Full daily at 00:01 | ||
+ | } | ||
+ | </code> | ||
+ | Задание будет запускаться каждый день в 00:01. Существует множество других доступных опций расписаний. | ||
- | Also, make sure the Password directive matches the password string in /etc/bacula/bacula-sd.conf. | + | 6. Наконец, создадим задание: |
+ | <code> | ||
+ | # Localhost backup. | ||
+ | Job { | ||
+ | Name = "LocalhostBackup" | ||
+ | JobDefs = "DefaultJob" | ||
+ | Enabled = yes | ||
+ | Level = Full | ||
+ | FileSet = "LocalhostFiles" | ||
+ | Schedule = "LocalhostDaily" | ||
+ | Storage = TapeDrive | ||
+ | Write Bootstrap = "/var/lib/bacula/LocalhostBackup.bsr" | ||
+ | } | ||
+ | </code> | ||
+ | Задание будет выполнять полную резервную копию каждый день на ленту. | ||
- | Create a new FileSet, which will determine what directories to backup, by adding: | + | 7. Каждая используемая лента должна иметь метку. Если текущая лента метки не имеет, Bacula отправит email с оповещением. Чтобы установить метку на ленту с помощью **Console**, введите в терминале: |
+ | <code>bconsole</code> | ||
- | # LocalhostBacup FileSet. | + | 8. В командной строке **Bacula Console** введите: |
- | FileSet { | + | <code>label</code> |
- | Name = "LocalhostFiles" | + | |
- | Include { | + | |
- | Options { | + | |
- | signature = MD5 | + | |
- | compression=GZIP | + | |
- | } | + | |
- | File = /etc | + | |
- | File = /home | + | |
- | } | + | |
- | } | + | |
- | This FileSet will backup the /etc and /home directories. The Options resource directives configure the FileSet to create an MD5 signature for each file backed up, and to compress the files using GZIP. | + | 9. Вам предложат выбрать один из ресурсов **Storage**: |
+ | <code> | ||
+ | Automatically selected Catalog: MyCatalog | ||
+ | Using Catalog "MyCatalog" | ||
+ | The defined Storage resources are: | ||
+ | 1: File | ||
+ | 2: TapeDrive | ||
+ | Select Storage resource (1-2):2 | ||
+ | </code> | ||
- | Next, create a new Schedule for the backup job: | + | 10. Введите новое имя тома: |
+ | <code> | ||
+ | Enter new Volume name: Sunday | ||
+ | Defined Pools: | ||
+ | 1: Default | ||
+ | 2: Scratch | ||
+ | </code> | ||
+ | Замените **//Sunday//** на соответствующую метку. | ||
- | # LocalhostBackup Schedule -- Daily. | + | 11. Теперь выберите накопитель: |
- | Schedule { | + | <code> |
- | Name = "LocalhostDaily" | + | Select the Pool (1-2): 1 |
- | Run = Full daily at 00:01 | + | Connecting to Storage daemon TapeDrive at backupserver:9103 ... |
- | } | + | Sending label command for Volume "Sunday" Slot 0 ... |
+ | </code> | ||
- | The job will run every day at 00:01 or 12:01 am. There are many other scheduling options available. | + | Поздравляем! Вы настроили Bacula на резервное копирование локального сервера на подключенное ленточное устройство. |
- | + | ||
- | Finally create the Job: | + | |
- | + | ||
- | # Localhost backup. | + | |
- | Job { | + | |
- | Name = "LocalhostBackup" | + | |
- | JobDefs = "DefaultJob" | + | |
- | Enabled = yes | + | |
- | Level = Full | + | |
- | FileSet = "LocalhostFiles" | + | |
- | Schedule = "LocalhostDaily" | + | |
- | Storage = TapeDrive | + | |
- | Write Bootstrap = "/var/lib/bacula/LocalhostBackup.bsr" | + | |
- | } | + | |
- | + | ||
- | The job will do a Full backup every day to the tape drive. | + | |
- | + | ||
- | Each tape used will need to have a Label. If the current tape does not have a label Bacula will send an email letting you know. To label a tape using the Console enter the following from a terminal: | + | |
- | + | ||
- | bconsole | + | |
- | + | ||
- | At the Bacula Console prompt enter: | + | |
- | + | ||
- | label | + | |
- | + | ||
- | You will then be prompted for the Storage resource: | + | |
- | + | ||
- | + | ||
- | Automatically selected Catalog: MyCatalog | + | |
- | Using Catalog "MyCatalog" | + | |
- | The defined Storage resources are: | + | |
- | 1: File | + | |
- | 2: TapeDrive | + | |
- | Select Storage resource (1-2):2 | + | |
- | + | ||
- | Enter the new Volume name: | + | |
- | + | ||
- | + | ||
- | Enter new Volume name: Sunday | + | |
- | Defined Pools: | + | |
- | 1: Default | + | |
- | 2: Scratch | + | |
- | + | ||
- | Replace Sunday with the desired label. | + | |
- | + | ||
- | Now, select the Pool: | + | |
- | + | ||
- | + | ||
- | Select the Pool (1-2): 1 | + | |
- | Connecting to Storage daemon TapeDrive at backupserver:9103 ... | + | |
- | Sending label command for Volume "Sunday" Slot 0 ... | + | |
- | + | ||
- | Congratulations, you have now configured Bacula to backup the localhost to an attached tape drive. | + | |
====Ссылки==== | ====Ссылки==== | ||
- | For more Bacula configuration options refer to the Bacula User's Manual | + | -- Дополнительные опции настройки Bacula смотрите в руководстве [[http://www.bacula.org/en/rel-manual/index.html|Bacula User's Manual]]. |
- | + | -- [[http://www.bacula.org/|Домашняя страница Bacula]] содержит последние новости и доработки по Bacula. | |
- | The Bacula Home Page contains the latest Bacula news and developments. | + | -- [[https://www.backup-solutions.ru/chto-takoe-bacula-enterprise/|Bacula в РФ]] содержит документацию Bacula на русском языке. |
- | + | -- Также посетите страницу [[https://help.ubuntu.com/community/Bacula|Bacula Ubuntu Wiki]]. | |
- | Also, see the Bacula Ubuntu Wiki page. | + | |
---- | ---- |