MySQL database backup policy and recovery

Source: Internet
Author: User
Tags drupal mysql backup
Database Backup is crucial. previous articles also explained how to back up MySQL and how to set up the master-slave synchronization policy, synchronization and backup of MySQL, we often think that master-slave synchronization can also be used as a MySQL backup policy. Therefore, we also emphasize that master-slave synchronization cannot replace database backup.

Database Backup is crucial. previous articles also explained how to back up MySQL and how to set up the master-slave synchronization policy, synchronization and backup of MySQL, we often think that master-slave synchronization can also be used as a MySQL backup policy. Therefore, we also emphasize that master-slave synchronization cannot replace database backup.

Database Backup is crucial. previous articles also explained how to back up MySQL and how to set up the master-slave synchronization policy, synchronization and backup of MySQL, we often think that master-slave synchronization can also be used as a MySQL backup policy. Therefore, we also emphasize one point here:
Master-slave synchronization cannot replace Database Backup

For example, if a table is accidentally deleted from the master database, the slave database also performs corresponding operations. If no backup is available, the deleted data cannot be retrieved. (Even if binary logs are rolled back, they cannot be retrieved because the storage of binary logs is time-limited and it is very complicated to roll back binary logs ).

Therefore, full backup and Incremental backup of databases are crucial.


Backup Policy
1. Back up the database every day.

mysqldump --master-data --single-transaction -R --databases [db1] [db2] [db3] | gzip -9 - | pv >all-db-with-master-data-$(date +%Y%m%d).sql.gz

2. Synchronize the daily backup to the slave server so that you can build the slave database at any time.

Database Restoration
1. Restore the primary database.
Comment out the slave database information produced by master-data and restore it.
2. Restore the slave database.
Use the backup data file, restore the data from the database, and then start slave.

start slave;

Cloud backup
Regularly transmits the backed up database to Baidu cloud or other cloud disks to ensure data storage, in case the server crashes.
PS: Baidu cloud's synchronization script can be found online or uploaded to the windows Server mounted to Baidu's network disk, so that Baidu's Network Disk can be automatically synchronized.

Related links:
Drupal database backup and MySQL backup policy
MySQL InnoDB database backup and Restoration
How to add a new database to the MySQL master-slave copy list
Apply MySQL Master/Slave at the database layer of Drupal

Original article address: MySQL database backup policy and recovery. Thanks to the original author for sharing.

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.