Forge Home

surrogate

Puppet module to install Surrogate, an xtrabackup script

9,965 downloads

9,749 latest version

4.1 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

  • 1.0.1 (latest)
  • 1.0.0
released Oct 2nd 2014
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 'jlondon-surrogate', '1.0.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add jlondon-surrogate
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install jlondon-surrogate --version 1.0.1

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

jlondon/surrogate — version 1.0.1 Oct 2nd 2014

Puppet Surrogate

Table of Contents

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

Overview

This module allows you to install a modified version of Surrogate backup. Surrogate is an xtrabackup based script for backing up mysql databases in a hot-backup fashion. This means no downtime or slowdown for your database server!

Support most debian and redhat based Linux distributions and any 5.5+ version of MySQL!

For support please open an issue through the project: https://github.com/justicel/puppet-surrogate/issues

Module Description

Implements a custom version of Surrogate backup, which was originally written from:

https://github.com/sixninetynine/surrogate

Additionally uses Percona Innobackup/Xtrabackup ( http://www.percona.com/doc/percona-xtrabackup/2.2/ ). Xtrabackup allows you to do no downtime/slowdown backups for current version MySQL servers, regardless of if they are based upon Percona code or not.

Setup

What surrogate affects

  • Install Surrogate scripts
  • Installs xtrabackup and qpress (qpress used for backup compression)
  • Needs a local mysql server to run backups.

Beginning with surrogate

Module setup simply requires installation on a puppet server or local machine with a copy of puppetlabs-stdlib and vcsrepo modules. Additionally you'll need the percona repository, but that is installed as needed by the module.

Usage

Setup is very simple. Example below for a very basic installation (You'll really want to read through full options):

node 'mysql-slave' {
  class { 'surrogate':
    backup_user   => 'backup_user',
    backup_pass   => 'mysecurepassword',
    backup_folder => '/var/backups/mysql',
  }
}

Additionally you will need to create a mysql user (DON'T USE ROOT!!!!) for backups. The backup user needs the following perms:

SELECT
RELOAD
SHOW DATABASES
LOCK TABLES
SHOW VIEW
REPLICATION CLIENT

You can create a user like this as needed:

use mysql;
GRANT SELECT, RELOAD, SHOW DATABASES, LOCK TABLES, SHOW VIEW, REPLICATION CLIENT on *.* to 'dbbackup'@'localhost' IDENTIFIED BY '<password>';

Then make sure to run a flush privileges:

flush privileges;

Your sql server should now be ready to go

Reference

  • surrogate: Main installation class which governs configuration variables and source download/install
  • surrogate::cron: Class to build out all of the cron-jobs for backups. Generally not client facing.
  • surrogate::params: Parameters for OS specific configuration variables.

Limitations

Currently known to support:

  • Ubuntu Precise/Trusty
  • Debian Woody/Jessie
  • Redhat 6/7
  • CentOS 6/7

Development

Feel free to modify, fork or otherwise the module but please keep attribution for the original code to myself:

Copyright 2014, Justice London jlondon@syrussystems.com

Release Notes

There is still some future work to be done:

  • Enable .my.cnf support instead of only user/password
  • Fix the underlying code for Surrogate to be cleaner/more modular (It works fine though)
  • Build tests