Mysql – How to backup MySQL accross multiple servers

MySQL

I have a few questions related to MySQL security.

  • How do we backup the data in MySQL database? I know there's an output function where you can export your data in the db as sql statements. Is this the only way that we can backup the data?

  • Is there a way where we can backup the data automatically without manually does what I mentioned above?

  • What if I have two different servers. Let's call A and B. And A is the main server, B is the backup server. And how can I transfer my CRUD requests to the B server when A is down?

Best Answer

Backup Solution: There are several tools and methods to perform Backup & restore operations. You can refer official documents for more information. If you want to use third party tool then Percona XtraBackup is the most popular tool.

Automatic Backup: You need to create schedulers to take backup by executing the backup scripts. If you are using the linux based servers then it is recommended to create incremental backup scripts, executed by CRON jobs on scheduled interval.

Failover Handling: To take care of failover event ( i.e. main server is down ) you need to prepare high availability configuration, so that backup server can take place of main server. You can read official guide about it.

I prefer clustering based solution to take care of High Availability: enter image description here