Hiển thị các bài đăng có nhãn Backups. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn Backups. Hiển thị tất cả bài đăng

Thứ Tư, 14 tháng 12, 2016

MySQL Enterprise Backup & Restore - Full and Incrimental

1. Create bash script 


#!/bin/bash

#creates and maintains MySQL Enterprise Backup (MEB) backups

#prints usage
usage()
{
    echo "$VERSION"
    echo "
Usage: `basename $0` [command] [MEB options]

Commands:
    full                                make full backup
    incremental                         make incremental backup
    incremental-with-redo-log-only      make incremental backup with redo log only
    verify-to-tape                      verify backup images, then copy to tape
    prepare                             prepare backups
    remove-old                          remove old backups
    "
}

Thứ Ba, 13 tháng 12, 2016

Full Backup using MySQL Enterprise Backup

Install the software

Before we can configure backups and the like, you’ll need to install the MySQL Enterprise Backup software:
$ tar xvzf meb-3.9.0-linux2.6-x86-64bit.tar.gz 
meb-3.9.0-linux2.6-x86-64bit/
meb-3.9.0-linux2.6-x86-64bit/bin/
meb-3.9.0-linux2.6-x86-64bit/bin/mysqlbackup
meb-3.9.0-linux2.6-x86-64bit/README.txt
meb-3.9.0-linux2.6-x86-64bit/LICENSE.mysql
meb-3.9.0-linux2.6-x86-64bit/manual.html
meb-3.9.0-linux2.6-x86-64bit/mysql-html.css
I then placed the mysqlbackup binary in my MySQL “bin” directory :
$ cp meb-3.9.0-linux2.6-x86-64bit/bin/mysqlbackup /usr/local/mysql/bin/
$ which mysqlbackup 
/usr/local/mysql/bin/mysqlbackup
Now we’ve installed the software, we can go on and prepare our database for backup.

How to Back Up MySQL Server using MySQL Enterprise Backup (MEB)

 In order to be able to use MySQL Enterprise Backup to perform a backup of a MySQL Server instance, the following MySQL options must be specified in the configuration file of the server instance, under the [mysqld] section (substitute ... with any valid values):

datadir=...
innodb_data_home_dir=...
innodb_data_file_path=...
innodb_log_group_home_dir=...
innodb_log_files_in_group=...
innodb_log_file_size=...


Alternately you can use a new configuration file, that contains just the options above, and pass it to MySQL Enterprise Backup.

How to Automate Backups on Linux/UNIX Using MySQL Enterprise Backup (MEB)


Goal

Backups should be made regularly.  The easiest way to do so on Linux/UNIX is to write a cron job. In this article MEB users will find two crontab templates: one for weekly full backups and another for daily incremental backups.

Solution

Although MEB allows for the creation of incremental backups, it is still best practice to run full backups periodically.   Below you will find a schedule which makes weekly full backups and daily incremental backups.

Weekly full backup can be done using following crontab command: