Mydumper supports streaming of backups right from version 0.11.3 and the latest version Mydumper 0.12.3 it enabled its support for compressed streaming backup. This was the most awaited feature added to Mydumper, making it a more powerful tool for data migration to RDS or Cloud.
If you are hearing mydumper for the first time, then let’s have a quick catch-up on what Mydumper is and what it does exactly.
Mydumper is a multithread logical backup and restores tool for MySQL and its forks. To know more you can refer to our previous blogs/presentations below.
- https://www.mydbops.com/blog/faster-logical-backup-using-mydumper-presentation/
- https://www.mydbops.com/blog/mysqldump-vs-mysqlpump-vs-mydumper/
In this blog, we will discuss in short how this streaming process works and how to get the required output.
How does this work?
The working of the stream is quite simple
- Mydumper threads read data from the source DB and write to the file system parallels.
- Now mydumper stream thread enqueues these files one by one and pipes them to the stdout.
- Myloader stream reads them and writes to its local filesystem.
- Now myloader threads restore them parallel to the destination by maintaining the thread_id sequence.
How to use it?
Below is the working command which I have used for the production use case to restore a table to RDS using stream.
–stream : mydumper indicates that files created need to be streamed through STDOUT.
–stream : myloader will create a thread to read the stream and creates the file locally
–no-delete : retains the files locally in both source and destination this is optional
By default, once the file is successfully transferred from the source it gets deleted immediately, similarly at the destination once the streamed file is applied it gets deleted from its file system. This avoids high disk utilization during file backup when migrating a high volume of data.
Key Takeaways:
- With a stream, Mydumper is considered an easy and faster method for the migration of data
- Disk utilization is always kept under control with an auto-purge of backup files.