I have to migrate from outdated standalone MySQL 5.6.33 to new server with 5.7.41(a separate server) without downtime (or just as short as possible). To accomplish that I'm going to use replication (than switch slave to standalone mode). We have a fleet of not small databases: 300-600GB and with 100-10k requests per second.
To create dumps I'm going to use the following command:
mysqldump -umyuser -ppassowrd --master-data --single-transaction --routines --triggers --databases db_1 db_1 db_1 db_1 > selected_dbs.sql
Question: Should I use "FLUSH TABLES WITH READ LOCK" to be safe and sure that a backup is consistent and usable for a slave if I'm going to use "--master-data --single-transaction"? Or "FLUSH TABLES WITH READ LOCK" isn't necessary?
Thank you for any advice.
--master-data=2simply writes the log file and position as a comment. As mentioned, what you have is adequate. Once you set up replication, any new writes that occurred on the 5.6 Master will be replayed on the 5.7 Replica. – RolandoMySQLDBA Feb 21 '23 at 15:32