Skip to content

Puppet module to install, configure, and run backups using Percona Xtrabackup for mysql, percona-server, mariadb

Notifications You must be signed in to change notification settings

johnlawerance/xtrabackup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!

About

Puppet module to install, configure, and run backups using Percona Xtrabackup for mysql, percona-server, mariadb

Resources

Stars

Watchers

Forks

Packages

No packages published