Manual installation of Automysqlbackup

Source: Internet
Author: User
Tags chmod mysql backup

1 Preface

The company's predecessors use the Automysqlbackup script to back up the database, go to the official learning, find it is really a good thing, you can simplify the MySQL backup, and then organize it to share.

Because it is a personal arrangement, the following is not guaranteed to be completely correct, so the English is good or suggest to look at official documents, this article only for reference. Of course, it is very welcome to correct it.

2 Practice Section

2.1 Download and unzip the backup program

wget https://svwh.dl.sourceforge.net/project/automysqlbackup/AutoMySQLBackup/AutoMySQLBackup%20VER%203.0/ AUTOMYSQLBACKUP-V3.0_RC6.TAR.GZTAR-XF automysqlbackup-v3.0_rc6.tar.gz

2.2 Creating a program directory

Mkdir/etc/automysqlbackup

2.3 Deployment of automatic backup software configuration files

CP automysqlbackup.conf/etc/automysqlbackup/cp/etc/automysqlbackup/automysqlbackup.conf/etc/automysqlbackup/ Myserver.conf

2.4 Deployment of automatic backup executable files

CP automysqlbackup/usr/local/bin/

2.5 Defining configuration Tasks

2.5.1 Configuration file Location

Vim/etc/automysqlbackup/myserver.conf

2.5.2 MySQL and mysqldump executable location (optional)

Querying MySQL and mysqldump program paths

Whereis MySQL; Whereis mysqldump

Shown below:

MySQL:/usr/bin/mysql/usr/lib64/mysql/usr/include/mysql/usr/share/mysql/usr/share/man/man1/mysql.1.gzmysqldump: /usr/bin/mysqldump/usr/share/man/man1/mysqldump.1.gz

So the parameters are configured as follows:

Path=${path}:/usr/bin

Note: If you do not query using Whereis, the description does not have an environment variable, you need to specify the actual location of the program.

2.5.3 Basic Configuration

# Database backup user config_mysql_dump_username= ' root ' # database backup user password config_mysql_dump_password= ' # database server name or IP address config_mysql_ dump_host= ' localhost ' # database server is more suitable for human identification (not configured defaults to config_mysql_dump_host specified value) config_mysql_dump_host_friendly= ' # Location of database backup config_backup_dir= '/var/backup/db ' # Multiple compression methods # Pigz, gzip# pbzip2, bzip2config_multicore= ' yes ' # Multithreading (the number of cores should be less than the number of cores, not equal to) config_multicore_threads=2

2.5.4 Configuring the database to be backed up

# Configure backup database, default is all, specific database please write (' DB1 ' DB2 ' DB3 ' ...) Config_db_names= () # Month BACKUP Database list, empty automatically reads config_db_month_names= () # excluded databases from the INFORMATION_SCHEMA database, using wildcard methods, such as ' mydb.a* ' # Config_table_exclude= ()

2.5.5 Advanced Configuration

# define the day of the month backup, using 01 to 31, 0 means to turn off month backup #config_do_monthly= "01" # define the day of the week backup, using 1 to 7, 0 means close weekly backup config_do_weekly= "5" # Configure the number of days the backup file is retained, minimum unit 1 days (24 hours) config_rotation_daily=6# configuration Zhou Bei file retention days, Min. 1 days (24 hours) config_rotation_weekly=35# Configure the number of days a month backup file is retained, minimum unit 1 days (24 hours) config_rotation_monthly=150

2.5.6 Server connection Settings

# define the day of the month backup, using 01 to 31, 0 means to turn off month backup #config_do_monthly= "01" # define the day of the week backup, using 1 to 7, 0 means close weekly backup config_do_weekly= "5" # Configure the number of days the backup file is retained, minimum unit 1 days (24 hours) config_rotation_daily=6# configuration Zhou Bei file retention days, Min. 1 days (24 hours) config_rotation_weekly=35# Configure the number of days a month backup file is retained, minimum unit 1 days (24 hours) config_rotation_monthly=150

2.5.7 Server Connection Configuration

# The port of the database connection config_mysql_dump_port=3306# the communication between the compressed server and the MySQL database config_mysql_dump_commcomp= ' no ' # using SSL encryption Mysqldumpconfig _mysql_dump_usessl= ' yes ' # connection to database using UNIX socket file #config_mysql_dump_socket= ' # Client-server communication buffer size (max. 1GB) Config_ mysql_dump_max_allowed_packet= ' # Using transactions to guarantee backup consistency #config_mysql_dump_single_transaction= ' no ' # http://dev.mysql.com/ doc/refman/5.0/en/mysqldump.html#option_mysqldump_master-data#config_mysql_dump_master_data=# Load the contents of the Mysql.proc table directly config_mysql_dump_full_schema= the table backup status in the ' Yes ' # text file config_mysql_dump_dbstatus= ' yes '

2.5.8 Backup Dump Settings

# Backup includes create databaseconfig_mysql_dump_create_database= ' No ' # to split backup directories and files for each database config_mysql_dump_use_separate_dirs= ' Yes ' # Select the type of compression (gzip or bzip2) config_mysql_dump_compression= ' gzip ' # to store the latest additional copy in the standard location #config_mysql_dump_latest= ' no ' # Remove all date and time information from the file name in the most recent folder #config_mysql_dump_latest_clean_filenames= ' No ' # using differential backup #config_mysql_dump_differential= ' No

2.5.9 Notification Settings

# Configure message Contents #-log: Send log File #-Files: Send log file and SQL as attachment #-stdout: If you run manually, you will simply output the log to the screen #-quiet: Send the log only if there is an error in the mail address Config_mai Lcontent= ' stdout ' # sets the maximum message size (unit k) #CONFIG_mail_maxattsize =4000# allows you to package config_mail_splitandtar= ' yes ' with tar split # Use uuencoded to send mail config_mail_use_uuencoded_attachments= ' no ' # incoming email ([email protected]) #CONFIG_mail_address = ' root '

2.5.10 Encryption Settings

# Use OpenSSL to encrypt backup config_encrypt= ' No ' # Encrypt backup with password #config_encrypt_password= ' password0123 '

2.5.11 Other Settings

# Specify a local file to be backed up, such as my.cnfconfig_backup_local_files= () # command run before backup starts config_prebackup= "/etc/mysql-backup-pre" # Command run after backup config_postbackup= "/etc/mysql-backup-post" # Configure permissions for the backed-up folders and files Umask 0077# show execution Status Config_dryrun=1

2.6 Calling programs and configuring

2.6.1 creating a scheduled task for the call

Vim/etc/cron.daily/runmysqlbackup

Enter the following content:

#!/bin/sh/usr/local/bin/automysqlbackup/etc/automysqlbackup/myserver.confchown root.root/var/backup/db*-Rfind/ var/backup/db*-type f-exec chmod {} \;find/var/backup/db*-type d-exec chmod 700 {} \;

2.6.2 Authorization Scheduled Task script

chmod +x/etc/cron.daily/runmysqlbackup

2.6.3 Creating a backup directory

Mkdir-p/var/backup/db

2.6.4 Performing tests manually

Automysqlbackup/etc/automysqlbackup/myserver.conf

2.6.5 Confirm Backup

Gunzip/var/backup/db/daily/mysql/daily_mysql_2017-02-28_19h27m_tuesday.sql.gz


See Address:

=======================================

http://sourceforge.net/projects/automysqlbackup/


This article is from the "Old Tan Linux Cluster blog" blog, please be sure to keep this source http://cmdschool.blog.51cto.com/2420395/1902311

Manual installation of Automysqlbackup

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.