Skip to content

Commit

Permalink
percona_xtrabackup: renamed percona to perona_xtrabackup
Browse files Browse the repository at this point in the history
also put all docs into plugins.rst
  • Loading branch information
pstorz committed Jan 10, 2020
1 parent f6b8a2c commit 31fc810
Show file tree
Hide file tree
Showing 41 changed files with 110 additions and 249 deletions.
24 changes: 12 additions & 12 deletions core/platforms/packaging/bareos.spec
Expand Up @@ -577,7 +577,7 @@ Requires: python-pycurl
Requires: python-lxml
Requires: python-ovirt-engine-sdk4

%package filedaemon-percona-python-plugin
%package filedaemon-percona_xtrabackup-python-plugin
Summary: LDAP Python plugin for Bareos File daemon
Group: Productivity/Archiving/Backup
Requires: bareos-filedaemon = %{version}
Expand Down Expand Up @@ -609,7 +609,7 @@ This package contains the LDAP python plugin for the file daemon

This package contains the Ovirt python plugin for the file daemon

%description filedaemon-percona-python-plugin
%description filedaemon-percona_xtrabackup-python-plugin
%{dscr}

This package contains the Percona python plugin for the file daemon
Expand Down Expand Up @@ -1399,13 +1399,13 @@ echo "This is a meta package to install a full bareos system" > %{buildroot}%{_d
%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/fileset/plugin-ovirt.conf.example
%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/job/backup-ovirt.conf.example

%files filedaemon-percona-python-plugin
%files filedaemon-percona_xtrabackup-python-plugin
%defattr(-, root, root)
%{plugin_dir}/bareos-fd-percona.py*
%{plugin_dir}/BareosFdPluginPercona.py*
#%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/fileset/plugin-percona.conf.example
#%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/job/backup-percona.conf.example
#%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/job/restore-percona.conf.example
%{plugin_dir}/bareos-fd-percona_xtrabackup.py*
%{plugin_dir}/BareosFdPluginPerconaXtraBackup.py*
#%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/fileset/plugin-percona_xtrabackup.conf.example
#%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/job/backup-percona_xtrabackup.conf.example
#%attr(0640, %{director_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-dir.d/job/restore-percona_xtrabackup.conf.example

%files director-python-plugin
%defattr(-, root, root)
Expand Down Expand Up @@ -1670,10 +1670,10 @@ fi; \
%posttrans filedaemon-ldap-python-plugin
%posttrans_restore_file /etc/%{name}/bareos-dir.d/plugin-python-ldap.conf

#post filedaemon-percona-python-plugin
#post_backup_file /etc/#{name}/bareos-dir.d/plugin-python-percona.conf
#posttrans filedaemon-percona-python-plugin
#posttrans_restore_file /etc/#{name}/bareos-dir.d/plugin-python-percona.conf
#post filedaemon-percona_xtrabackup-python-plugin
#post_backup_file /etc/#{name}/bareos-dir.d/plugin-python-percona_xtrabackup.conf
#posttrans filedaemon-percona_xtrabackup-python-plugin
#posttrans_restore_file /etc/#{name}/bareos-dir.d/plugin-python-percona_xtrabackup.conf

%endif

Expand Down
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2015-2016 Bareos GmbH & Co. KG
# Copyright (C) 2015-2020 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down
4 changes: 2 additions & 2 deletions core/src/plugins/filed/CMakeLists.txt
Expand Up @@ -143,8 +143,8 @@ set(PYFILES
bareos-fd-ovirt.py
BareosFdPluginOvirt.py

bareos-fd-percona.py
BareosFdPluginPercona.py
bareos-fd-percona_xtrabackup.py
BareosFdPluginPerconaXtraBackup.py
)

install(
Expand Down
Expand Up @@ -27,7 +27,7 @@
from BareosFdWrapper import *

# This module contains the used plugin class
from BareosFdPluginPercona import *
from BareosFdPluginPerconaXtraBackup import *


def load_bareos_plugin(context, plugindef):
Expand Down
99 changes: 0 additions & 99 deletions docs/manuals/source/Appendix/Howtos.rst
Expand Up @@ -754,105 +754,6 @@ Backup of a MySQL Database
In this section, we describe different methods to do a full backup of a MySQL database.


.. _backup-mysql-xtrabackup:

Backup of MySQL Databases using the Bareos MySQL Percona xtrabackup Plugin
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

:index:`\ <single: Plugin; MySQL Backup>`
:index:`\ <single: Percona xtrabackup>`
:index:`\ <single: xtrabackup>`

This plugin is available since :sinceVersion:`16.2.4: MySQL Incremental Backup Plugin for using Percona xtrabackup`, it uses the :command:`xtrabackup` tool from Percona to perform full and incremental hot-backups of MySQL / MariaDB tables of type InnoDB. It can also backup MyISAM tables but only as full backups. On restore it requires a preparation using the xtrabackup tools, before the tables can be restored. If you simply want to backup full dumps, then using
:ref:`backup-mysql-python` is the easier way.

Prerequisites
'''''''''''''

Install the xtrabackup tool from Percona. Documentation and packages are available here: https://www.percona.com/software/mysql-database/percona-xtrabackup. The plugin was successfully tested with xtrabackup versions 2.3.5 and 2.4.4.

As it is a Python plugin, it will also require to have the package **bareos-filedaemon-python-plugin** installed on the |fd|, where you run it.

For authentication the :file:`.mycnf` file of the user running the |fd|. Before proceeding, make sure that xtrabackup can connect to the database and create backups.

Installation
''''''''''''

Make sure you have met the prerequisites. Install the files :file:`BareosFdPercona.py` and :file:`bareos-fd-percona.py` in your Bareos plugin directory (usually :file:`/usr/lib64/bareos/plugins`). These files are available in the Git repository https://github.com/bareos/bareos-contrib/tree/master/fd-plugins/bareos_percona.

Configuration
'''''''''''''

Activate your plugin directory in the |fd| configuration. See :ref:`fdPlugins` for more about plugins in general.

.. code-block:: bareosconfig
:caption: bareos-fd.d/client/myself.conf
Client {
...
Plugin Directory = /usr/lib64/bareos/plugins
Plugin Names = "python"
}
Now include the plugin as command-plugin in the Fileset resource:

.. code-block:: bareosconfig
:caption: bareos-dir.d/fileset/mysql.conf
FileSet {
Name = "mysql"
Include {
Options {
compression=GZIP
signature = MD5
}
File = /etc
#...
Plugin = "python:module_path=/usr/lib64/bareos/plugins:module_name=bareos-fd-percona:mycnf=/root/.my.cnf"
}
}
If used this way, the plugin will call xtrabackup to create a backup of all databases in the xbstream format. This stream will be processed by Bareos. If job level is incremental, xtrabackup will perform an incremental backup since the last backup – for InnoDB tables. If you have MyISAM tables, you will get a full backup of those.

You can append options to the plugin call as key=value pairs, separated by ’:’. The following options are available:

- With :strong:`mycnf` you can make xtrabackup use a special mycnf-file with login credentials.

- :strong:`dumpbinary` lets you modify the default command xtrabackup.

- :strong:`dumpoptions` to modify the options for xtrabackup. Default setting is: :command:`--backup --datadir=/var/lib/mysql/ --stream=xbstream --extra-lsndir=/tmp/individual_tempdir`

- :strong:`restorecommand` to modify the command for restore. Default setting is: :command:`xbstream -x -C`

- :strong:`strictIncremental`: By default (false), an incremental backup will create data, even if the Log Sequence Number (LSN) wasn’t increased since last backup. This is to ensure, that eventual changes to MYISAM tables get into the backup. MYISAM does not support incremental backups, you will always get a full bakcup of these tables. If set to true, no data will be written into backup, if the LSN wasn’t changed.

Restore
'''''''

With the usual Bareos restore mechanism a file-hierarchy will be created on the restore client under the default restore location:

:file:`/tmp/bareos-restores/_percona/`

Each restore job gets an own subdirectory, because Percona expects an empty directory. In that subdirectory, a new directory is created for every backup job that was part of the Full-Incremental sequence.

The naming scheme is: :file:`fromLSN_toLSN_jobid`

Example:

::

/tmp/bareos-restores/_percona/351/
|-- 00000000000000000000_00000000000010129154_0000000334
|-- 00000000000010129154_00000000000010142295_0000000335
|-- 00000000000010142295_00000000000010201260_0000000338

This example shows the restore tree for restore job with ID 351. First subdirectory has all files from the first full backup job with ID 334. It starts at LSN 0 and goes until LSN 10129154.

Next line is the first incremental job with ID 335, starting at LSN 10129154 until 10142295. The third line is the 2nd incremental job with ID 338.

To further prepare the restored files, use the :command:`xtrabackup --prepare` command. Read https://www.percona.com/doc/percona-xtrabackup/2.4/xtrabackup_bin/incremental_backups.html for more information.


.. _backup-mysql-python:

Backup of MySQL Databases using the Python MySQL plugin
Expand Down

0 comments on commit 31fc810

Please sign in to comment.