Coder Social home page Coder Social logo

bacula-backup-mysql's Introduction

NAME

bacula-backup-mysql - A hook for Bacula to backup mysql databases using mysqlhotcopy or mysqldump.

SYNOPSIS

Job {
  Name = "example.org-mysql"
  ...
  # This prepares the backup
  Client Run Before Job = "/usr/sbin/bacula-backup-mysql"
  # This deletes the copy of the catalog
  Client Run After Job = "/usr/sbin/bacula-backup-mysql -cleanup"
}

DESCRIPTION

This is a script to be setup as Client Run Before Job in Bacula.

CONFIGURATION

Config starts with <clusters> block, which you can define several database instances to be backed up.

Each cluster should define connection dsn and databases to be backed up.

To define connection dsn, you can also define common options in <client> section, those options would be shared for each cluster which has not overriden the specific option.

In <cluster> sections, you should list databases to be backed up. You can use include_database options to explicitly list which databases should be backed up, and exclude_database options to explicitly list those that should not.

Additionally include_database supports table regexp, which is passed directly to mysqlhotcopy(1). This allows you to include or exclude tables from each database backup.

Unless you only specify include_database options, all databases which can be seen with a show tables query are considered for backup; any exclude_database options will reduce this list.

Since v0.6 it's possible to do SQL dump backups with mysqldump(1). Use this if you want to backup InnoDB databases. Option name is dump_type, which takes values mysqlhotcopy (default) and mysqldump.

Since v0.7 you can pass arbitary options to mysqlhotcopy or mysqldump using mysqlhotcopy_options or mysqldump_options respectively. Use this to pass options like --old_server.

Ordinarily, using include_database and exclude database options in the same cluster cause the include_database option to be unnecessary, as the existence of any exclude_database options implicitly includes all available databases obtained from show databases. However, when using a dump_type of mysqlhotcopy, the include_database option can be further configured to specify the exact tables to be backed up, giving the user far more control over the process.

Dump type mysqlhotcopy allows you to pass --record_log_pos log-pos-table option to mysqlhotcopy. The log-pos-table table must already exist, see perldoc mysqlhotcopy for the table schema. Please note that this option is not safe to use when backing up more than one database, because current operation backs up each database with separate mysqlhotcopy call and so the log pos is saved with each call overwriting the previous.

EXAMPLE CONFIGURATION

# clusters to backup
# there is nothing special about name "mysql", name just picked as convience
<clusters>
  cluster mysql
  cluster eventum
  cluster forums
  cluster selected_dbs
</clusters>

# client connection parameters, can be overriden per cluster
<client>
  user mysql
  password secret
</client>

# global options, can be overriden per cluster
<options>
  tmpdir /srv/bacula/tmp
  outdir /srv/bacula/mysql
</options>

# mysql cluster: backup all but mysql database
<cluster mysql>
  socket /var/lib/mysql/mysql.sock
  exclude_database mysql
</cluster>

# forums cluster: exclude phorum_forums and phorum_users tables
<cluster forums>
  user mysql
  socket /var/lib/mysql/mysql.sock

  # include_database can also support table regexp for mysqlhotcopy:
  include_database teensForum5./~(phorum_forums|phorum_users)/
</cluster>

# selected_dbs cluster: backup all except mysql, and be specific about tables
# in the teensForum5 database
<cluster selected_dbs>
  socket /var/lib/mysql/mysql.sock
  exclude_database mysql

  # can be specific about tables when using mysqlhotcopy:
  include_database teensForum5./~(phorum_forums|phorum_users)/
</cluster>

BUGS

If you find bugs in bacula-backup-mysql(1), file the reports into Bugtracker or even better, send Pull Request with a fix.

There are also bugs in mysqlhotcopy(1), see from Wiki if your version nees patching.

In mysqlhotcopy mode record_log_pos option is useless if cluster contains more than one database.

AUTHOR

Copyright (C) 2009-2016, Elan Ruusamäe <[email protected]>

SEE ALSO

http://www.bacula.org/, Bacula wiki: Application specific backups: mysql

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.