It creates a replication between MySQL and Cassandra to have instant backup of all MySQL data.
How normal backup works?
In MySQL, there is a command, “mysqldump –h [hostIP] –P port –u [username] -p [password] [db_name] –single-transaction --quick > [filename.sql]”.
This command will be run periodically in all the MySQL clusters from a remote machine where all the back ups will be stored.
Problems in Existing Backup
- Mysqldump command just takes a snapshot of the entire DB at the time of running.
- Duplicate copy of each back up.
- Necessity of increased storage space.
- Restore can be done only to particular date of backup.
- Not anytime restore is possible.
How this works?
- MySQL writes all the commands to binlog file through which the data is replicated to the slaves.
- We are tapping into MySQL replication stream and store all the command being executed in Master in Cassandra in the same order of execution along with timestamp.
- Now, given any time, we will be able to restore to that point by sequentially executing all the commands.
- Also, it doesn’t occupy much space as we store only the command and not the actual data. Plus, there is no duplicate.