Forge Home

xtrabackup

Install Percona xtrabackup / innobackupx and schedules automated backups of MySQL, MariaDB, Percona-Server and other MySQL derivitives.

15,263 downloads

9,175 latest version

4.5 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 0.3.0 (latest)
  • 0.2.2
  • 0.2.1
  • 0.2.0
  • 0.1.0
released Nov 28th 2017
This version is compatible with:
  • , , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'johnlawerance-xtrabackup', '0.3.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add johnlawerance-xtrabackup
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install johnlawerance-xtrabackup --version 0.3.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

johnlawerance/xtrabackup — version 0.3.0 Nov 28th 2017

xtrabackup

Puppet Forge Build Status

Table of Contents

  1. Description
  2. Setup - The basics of getting started with xtrabackup
  3. Usage - Configuration options and additional functionality
  4. Reference - An under-the-hood peek at what the module is doing and how
  5. Limitations - OS compatibility, etc.
  6. Development - Guide for contributing to the module

Description

This module installs Percona xtrabackup / innobackupx and schedules automated backups of MySQL, MariaDB, Percona-Server and other MySQL derivitives.

Setup

What xtrabackup affects

  • Percona repository
  • xtrabackup / innobackupx installations
  • cronjob for scheduling backups / retention period

Beginning with xtrabackup

Basic install with required paramaters and default settings.

class { ::xtrabackup:
  backup_dir => '/mnt/backup/', 
  mysql_user => 'backup_user',
  mysql_pass => 'backup_password'
}

Usage

All interactions with the xtrabackup module can be performed through the main ::xtrabackup class.

Minimal installation using default settings:

class { ::xtrabackup:
  backup_dir => '/mnt/backup/', 
  mysql_user => 'backup_user',
  mysql_pass => 'backup_password'
}

Install xtrabackup version 2.3.4-1.el7 and the backup script but don't schedule cronjob.

class { ::xtrabackup:
  package_version => '2.3.4-1.el7',
  enable_cron     => false,
  backup_dir      => '/mnt/backup/', 
  mysql_user      => 'backup_user',
  mysql_pass      => 'backup_password'
}

Schedule backup for weekly Friday night's at 11PM, set the backup retention to 30 days, and don't install the xtrabackup packages, and don't install the Percona repo:

class { ::xtrabackup:
  backup_retention       => '30',
  cron_hour              => '22',
  cron_weekday           => '5',
  install_xtrabackup_bin => false,
  manage_repo            => false,
  backup_dir             => '/mnt/backup/', 
  mysql_user             => 'backup_user',
  mysql_pass             => 'backup_password'
}

Schedule backup with custom xtrabackup options to use 2 threads and compress the output:

class { ::xtrabackup:
  xtrabackup_options => '--parallel=2 --compress',
  backup_dir         => '/mnt/backup/', 
  mysql_user         => 'backup_user',
  mysql_pass         => 'backup_password'
}

Schedule backup using innobackupx with custom options to save slave data:

class { ::xtrabackup:
  use_innobackupx     => true,
  innobackupx_options => '--slave-info',
  backup_dir          => '/mnt/backup/', 
  mysql_user          => 'backup_user',
  mysql_pass          => 'backup_password'
}

Reference

Public Classes

  • xtrabackup: Main class, includes all other classes.

Private Classes

  • xtrabackup::repo: Installs and manages the percona repo.
  • xtrabackup::install: Installs the packages and backup script.
  • xtrabackup::cron: Schedules the cronjob.

Required Module Parameters

backup_dir

Location to store the backup files (default: '') [REQUIRED]

mysql_user

User that should perform the backup (default: '') [REQUIRED]

mysql_pass

Password that should perform the backup (default: '') [REQUIRED]

Complete Module Parameters

package_version

Which version of xtrabackup binaries to install (default: latest)

install_xtrabackup_bin

Should the module install the Percona xtrabackup packages? (default: true)

manage_repo

Should the module install the Percona repo? (default: true)

prune_backups

Should the module manage backup retention? (default: true)

backup_retention

Time in days the module should keep old backups around (default: 7)

backup_dir

Location to store the backup files (default: '') [REQUIRED]

use_innobackupx

Should the module use the innobackupx command instead of xtrabackup? (default: false)

backup_script_location

Where should the backup shell script be installed? (default: '/usr/local/bin/')

mysql_user

User that should perform the backup (default: '') [REQUIRED]

mysql_pass

Password that should perform the backup (default: '') [REQUIRED]

enable_cron

Should the module manage the cronjob to perform the backups? (default: true)

cron_hour

Hour(s) to schedule the backup (default: '1') # Cronjob defaults for daily at 1AM

cron_minute

Minute(s) to schedule the backup (default: '0')

cron_weekday

Weekday(s) to schedule the backup (default: '*')

cron_month

Month(s) to schedule the backup (default: '*')

cron_monthday

Monthday(s) to schedule the backup (default: '*')

xtrabackup_options

Extra options to pass to the xtrabackup command (default: '')

innobackupx_options

Extra options to pass to the innobackupx command (default: '')

logfile

Location where the shell script output should be logged (default: '/var/log/xtrabackup.log')

Limitations

OSes Supported:

  • RHEL/CentOS 6, 7
  • Ubuntu 12.04, 14.04

Dependencies:

  • puppetlabs-stdlib >= 3.0.0
  • puppetlabs-apt >= 2.0.0 (Only required for Ubuntu)

This module has only been tested on CentOS7 and Ubuntu 14.04 using Puppet Enterprise 2015.3

Development

Please feel free to ask (or submit PRs) for feature requests, improvements, etc!