SlideShare a Scribd company logo
MySQL Live Migration
- Common Scenarios
Presented by Prasad Nagaraj
About ScaleGrid
● Specialize in Database as a Service(DbaaS) solutions
● Support popular open source databases – MongoDB, MySQL, PostgreSQL,
Redis
● Multi-cloud support – AWS, Azure, GCP, Digital Ocean, Linode and OCI
● DBA friendly!!
○ Fully managed service automating all routine tasks. You will get ssh access to the
underlying machines and root access to the database!
● Developer Friendly!!
○ Slow query analysis, Dev-test clusters, Tools for Online schema changes….
MySQL Live Migration
Use-cases
1. Migrating to cloud from on-premise
2. Changing managed database service providers
3. Migrating to new hardware
4. Upgrading MySQL versions.
MySQL Live Migration
3 step process
1. Do a baseline dump/snapshot on source and restore on destination
2. Setup replication between the nodes for continuous data movement
3. Switchover
MySQL Live Migration
Step-1 : Baseline dump
● Use mysqldump utility to export data from source and import to destination
● Move user accounts and privileges
• Mysqldump does not support exporting users and privileges. Manually dump Show create user
command and Show grants command.
• Mysqlpump utility support importing user
● Move data and stored objects
• Use the mysqldump options --events, --triggers –routines to export the stored objects
● Save the coordinates of the dump for setting up replication
● Binary log file name and log position co-ordinates are generated when using the –master-data
option
MySQL Live Migration
Step-2: Live replication
● Use the snapshot coordinates (binlog file name and position) to setup
replication
● Monitor the replication status on the destination using SHOW SLAVE
STATUS command(seconds_behind_master, sql_thread and io_thread
status)
● Wait for the lag to stabilize close to 5 s or less
MySQL Live Migration
Step-3: Switchover
● Stop writes on the source
● Wait for data to completely sync
● Break the replication from source to destination
● Point your applications to the destination database
MySQL Live Migration
Scenario -1
Ensure Binary logging is enabled on the source.
Use --master-data option as part of the mysqldump command to generate
binary log coordinates using which replication needs to be setup.
MySQL Live Migration
Destination
Source
mysqldump
Replication
Scenario - 2a
Use --master-data option as part of the mysqldump command to generate
binary log coordinates using which replication needs to be setup.
MySQL Live Migration
Source (S) (D)
Destination
Source
mysqldump
Replication
Replica(R)
Scenario - 2b
Use --slave-dump and --include-master-host-port option as part of the mysqldump command
● --slave-dump option provides the binary log coordinates of the ‘source’ of ‘dumped server’ at the time of dump
● --include-master-host-port provides the name and port of the ‘source’ of the ‘dumped server’ to connect to for
setting up the replication
MySQL Live Migration
Source (S) (D)
Destination
Source
mysqldump
Replication
Replica
(R)
Scenario - 3: GTID compatibility between source and
destination
● GTID mode of source and destination servers should be identical
● Example : Replication cannot be setup if source is not using GTID, but
destination is.
● In such cases, GTID can be disabled online on the destination using following
steps: ( Before setting up the replication)
○ SET GLOBAL gtid_mode = 'ON_PERMISSIVE';
○ SET GLOBAL gtid_mode = 'OFF_PERMISSIVE';
○ SET GLOBAL gtid_mode = 'OFF';
○ SET GLOBAL enforce_gtid_consistency = 'OFF';
MySQL Live Migration
Scenario - 4: Migrating subset of databases
● mysqldump can be used to import a single or subset of databases from
source
● However, binary logs from source will contain changes to all databases on the
source including system databases.
● Ensure to set replication filters on the destination so that replication happens
only for the databases you are migrating.
● Example: Replication filters can be set online using the command: CHANGE
REPLICATION FILTER REPLICATE_WILD_DO_TABLE=('test.%’);
MySQL Live Migration
Scenario - 5 Live migration from RDS
● Baseline dump should be done from read replica
● --slave-dump and --include-master-host-port options cannot be used as they need
super privileges which is not available for RDS user
● Replication should be stopped on the read replica before initiating baseline
dump.
● Note down SHOW SLAVE STATUS command - Relay_Master_Log_File and
Exec_Master_Log_Pos
● Replication should be initiated from RDS source node
● https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Proced
ural.Exporting.NonRDSRepl.html
MySQL Live Migration
THANK YOU!
Presented by Prasad Nagaraj

More Related Content

PDF
What is new in MariaDB 10.6?
PDF
MySQL Shell for Database Engineers
PDF
Evolution of MongoDB Replicaset and Its Best Practices
PDF
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
PPTX
Migrate your EOL MySQL servers to HA Complaint GR Cluster / InnoDB Cluster Wi...
PDF
State transfer With Galera
PDF
High Availability With InnoDB Clusters
PDF
Postgres connections at scale
What is new in MariaDB 10.6?
MySQL Shell for Database Engineers
Evolution of MongoDB Replicaset and Its Best Practices
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
Migrate your EOL MySQL servers to HA Complaint GR Cluster / InnoDB Cluster Wi...
State transfer With Galera
High Availability With InnoDB Clusters
Postgres connections at scale

What's hot (20)

PPTX
DMS (Database Migration Service) - Mydbops Team
PDF
MongoDB performance
PDF
PostgreSQL Replication High Availability Methods
PDF
Countdown to PostgreSQL v9.5 - Foriegn Tables can be part of Inheritance Tree
PDF
Parallel Replication in MySQL and MariaDB
PDF
What is new in PostgreSQL 14?
PDF
Extending MariaDB with user-defined functions
PPTX
Percona tool kit for MySQL DBA's
PDF
Supercharging MySQL and MariaDB with Plug-ins (SCaLE 12x)
PDF
Learning postgresql
PDF
Loadays MySQL
PDF
Introduction to Mongodb execution plan and optimizer
PPTX
Inside CynosDB: MariaDB optimized for the cloud at Tencent
PPTX
Running MongoDB 3.0 on AWS
PDF
Postgres & Redis Sitting in a Tree- Rimas Silkaitis, Heroku
PDF
Building Hybrid data cluster using PostgreSQL and MongoDB
PPTX
Building Spark as Service in Cloud
PPTX
How to ensure Presto scalability 
in multi use case
PPTX
One Tool to Rule Them All- Seamless SQL on MongoDB, MySQL and Redis with Apac...
PDF
Case Studies on PostgreSQL
DMS (Database Migration Service) - Mydbops Team
MongoDB performance
PostgreSQL Replication High Availability Methods
Countdown to PostgreSQL v9.5 - Foriegn Tables can be part of Inheritance Tree
Parallel Replication in MySQL and MariaDB
What is new in PostgreSQL 14?
Extending MariaDB with user-defined functions
Percona tool kit for MySQL DBA's
Supercharging MySQL and MariaDB with Plug-ins (SCaLE 12x)
Learning postgresql
Loadays MySQL
Introduction to Mongodb execution plan and optimizer
Inside CynosDB: MariaDB optimized for the cloud at Tencent
Running MongoDB 3.0 on AWS
Postgres & Redis Sitting in a Tree- Rimas Silkaitis, Heroku
Building Hybrid data cluster using PostgreSQL and MongoDB
Building Spark as Service in Cloud
How to ensure Presto scalability 
in multi use case
One Tool to Rule Them All- Seamless SQL on MongoDB, MySQL and Redis with Apac...
Case Studies on PostgreSQL
Ad

Similar to MySQL Live Migration - Common Scenarios (20)

PDF
MySQL database replication
PDF
MySQL Utilities -- PyTexas 2015
PDF
MySQL Workbench for DFW Unix Users Group
PDF
Pg chameleon, mysql to postgresql replica made easy
PDF
MySQL Time Machine by replicating into HBase - Slides from Percona Live Amste...
ODP
MySQL 101 PHPTek 2017
PDF
MySQL Database Replication - A Guide by RapidValue Solutions
PDF
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
PDF
High-level architecture of a complete MariaDB deployment
PDF
MariaDB: Connect Storage Engine
PDF
The Accidental DBA
PDF
MySQL Galera 集群
PPT
Mysql replication @ gnugroup
PDF
AutoDOPandRest
PDF
SUSE Manager with Salt - Deploy and Config Management for MariaDB
PDF
Backing up Wikipedia Databases
PDF
MySQL Backup and Security Best Practices
PDF
Greenplum Overview for Postgres Hackers - Greenplum Summit 2018
PPT
MySQL Cluster Basics
PDF
Upgrade to MySQL 5.6 without downtime
MySQL database replication
MySQL Utilities -- PyTexas 2015
MySQL Workbench for DFW Unix Users Group
Pg chameleon, mysql to postgresql replica made easy
MySQL Time Machine by replicating into HBase - Slides from Percona Live Amste...
MySQL 101 PHPTek 2017
MySQL Database Replication - A Guide by RapidValue Solutions
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
High-level architecture of a complete MariaDB deployment
MariaDB: Connect Storage Engine
The Accidental DBA
MySQL Galera 集群
Mysql replication @ gnugroup
AutoDOPandRest
SUSE Manager with Salt - Deploy and Config Management for MariaDB
Backing up Wikipedia Databases
MySQL Backup and Security Best Practices
Greenplum Overview for Postgres Hackers - Greenplum Summit 2018
MySQL Cluster Basics
Upgrade to MySQL 5.6 without downtime
Ad

More from Mydbops (20)

PDF
Scaling TiDB for Large-Scale Application
PDF
AWS MySQL Showdown - RDS vs RDS Multi AZ vs Aurora vs Serverless - Mydbops...
PDF
Mastering Vector Search with MongoDB Atlas - Manosh Malai - Mydbops MyWebinar 39
PDF
Migration Journey To TiDB - Kabilesh PR - Mydbops MyWebinar 38
PDF
AWS Blue Green Deployment for Databases - Mydbops
PDF
What's New In MySQL 8.4 LTS Mydbops MyWebinar Edition 36
PDF
What's New in PostgreSQL 17? - Mydbops MyWebinar Edition 35
PDF
What's New in MongoDB 8.0 - Mydbops MyWebinar Edition 34
PDF
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
PDF
Read/Write Splitting using MySQL Router - Mydbops Meetup16
PDF
TiDB - From Data to Discovery: Exploring the Intersection of Distributed Dat...
PDF
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
PDF
Demystifying Real time Analytics with TiDB
PDF
Must Know Postgres Extension for DBA and Developer during Migration
PDF
Efficient MySQL Indexing and what's new in MySQL Explain
PDF
Scale your database traffic with Read & Write split using MySQL Router
PDF
PostgreSQL Schema Changes with pg-osc - Mydbops @ PGConf India 2024
PDF
Choosing the Right Database: Exploring MySQL Alternatives for Modern Applicat...
PDF
Mastering Aurora PostgreSQL Clusters for Disaster Recovery
PDF
Navigating Transactions: ACID Complexity in Modern Databases- Mydbops Open So...
Scaling TiDB for Large-Scale Application
AWS MySQL Showdown - RDS vs RDS Multi AZ vs Aurora vs Serverless - Mydbops...
Mastering Vector Search with MongoDB Atlas - Manosh Malai - Mydbops MyWebinar 39
Migration Journey To TiDB - Kabilesh PR - Mydbops MyWebinar 38
AWS Blue Green Deployment for Databases - Mydbops
What's New In MySQL 8.4 LTS Mydbops MyWebinar Edition 36
What's New in PostgreSQL 17? - Mydbops MyWebinar Edition 35
What's New in MongoDB 8.0 - Mydbops MyWebinar Edition 34
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Read/Write Splitting using MySQL Router - Mydbops Meetup16
TiDB - From Data to Discovery: Exploring the Intersection of Distributed Dat...
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
Demystifying Real time Analytics with TiDB
Must Know Postgres Extension for DBA and Developer during Migration
Efficient MySQL Indexing and what's new in MySQL Explain
Scale your database traffic with Read & Write split using MySQL Router
PostgreSQL Schema Changes with pg-osc - Mydbops @ PGConf India 2024
Choosing the Right Database: Exploring MySQL Alternatives for Modern Applicat...
Mastering Aurora PostgreSQL Clusters for Disaster Recovery
Navigating Transactions: ACID Complexity in Modern Databases- Mydbops Open So...

Recently uploaded (20)

PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Approach and Philosophy of On baking technology
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Spectroscopy.pptx food analysis technology
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Big Data Technologies - Introduction.pptx
Understanding_Digital_Forensics_Presentation.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Approach and Philosophy of On baking technology
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Programs and apps: productivity, graphics, security and other tools
Digital-Transformation-Roadmap-for-Companies.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Spectroscopy.pptx food analysis technology
Review of recent advances in non-invasive hemoglobin estimation
Per capita expenditure prediction using model stacking based on satellite ima...
Encapsulation_ Review paper, used for researhc scholars
Network Security Unit 5.pdf for BCA BBA.
MYSQL Presentation for SQL database connectivity
Unlocking AI with Model Context Protocol (MCP)
Big Data Technologies - Introduction.pptx

MySQL Live Migration - Common Scenarios

  • 1. MySQL Live Migration - Common Scenarios Presented by Prasad Nagaraj
  • 2. About ScaleGrid ● Specialize in Database as a Service(DbaaS) solutions ● Support popular open source databases – MongoDB, MySQL, PostgreSQL, Redis ● Multi-cloud support – AWS, Azure, GCP, Digital Ocean, Linode and OCI ● DBA friendly!! ○ Fully managed service automating all routine tasks. You will get ssh access to the underlying machines and root access to the database! ● Developer Friendly!! ○ Slow query analysis, Dev-test clusters, Tools for Online schema changes…. MySQL Live Migration
  • 3. Use-cases 1. Migrating to cloud from on-premise 2. Changing managed database service providers 3. Migrating to new hardware 4. Upgrading MySQL versions. MySQL Live Migration
  • 4. 3 step process 1. Do a baseline dump/snapshot on source and restore on destination 2. Setup replication between the nodes for continuous data movement 3. Switchover MySQL Live Migration
  • 5. Step-1 : Baseline dump ● Use mysqldump utility to export data from source and import to destination ● Move user accounts and privileges • Mysqldump does not support exporting users and privileges. Manually dump Show create user command and Show grants command. • Mysqlpump utility support importing user ● Move data and stored objects • Use the mysqldump options --events, --triggers –routines to export the stored objects ● Save the coordinates of the dump for setting up replication ● Binary log file name and log position co-ordinates are generated when using the –master-data option MySQL Live Migration
  • 6. Step-2: Live replication ● Use the snapshot coordinates (binlog file name and position) to setup replication ● Monitor the replication status on the destination using SHOW SLAVE STATUS command(seconds_behind_master, sql_thread and io_thread status) ● Wait for the lag to stabilize close to 5 s or less MySQL Live Migration
  • 7. Step-3: Switchover ● Stop writes on the source ● Wait for data to completely sync ● Break the replication from source to destination ● Point your applications to the destination database MySQL Live Migration
  • 8. Scenario -1 Ensure Binary logging is enabled on the source. Use --master-data option as part of the mysqldump command to generate binary log coordinates using which replication needs to be setup. MySQL Live Migration Destination Source mysqldump Replication
  • 9. Scenario - 2a Use --master-data option as part of the mysqldump command to generate binary log coordinates using which replication needs to be setup. MySQL Live Migration Source (S) (D) Destination Source mysqldump Replication Replica(R)
  • 10. Scenario - 2b Use --slave-dump and --include-master-host-port option as part of the mysqldump command ● --slave-dump option provides the binary log coordinates of the ‘source’ of ‘dumped server’ at the time of dump ● --include-master-host-port provides the name and port of the ‘source’ of the ‘dumped server’ to connect to for setting up the replication MySQL Live Migration Source (S) (D) Destination Source mysqldump Replication Replica (R)
  • 11. Scenario - 3: GTID compatibility between source and destination ● GTID mode of source and destination servers should be identical ● Example : Replication cannot be setup if source is not using GTID, but destination is. ● In such cases, GTID can be disabled online on the destination using following steps: ( Before setting up the replication) ○ SET GLOBAL gtid_mode = 'ON_PERMISSIVE'; ○ SET GLOBAL gtid_mode = 'OFF_PERMISSIVE'; ○ SET GLOBAL gtid_mode = 'OFF'; ○ SET GLOBAL enforce_gtid_consistency = 'OFF'; MySQL Live Migration
  • 12. Scenario - 4: Migrating subset of databases ● mysqldump can be used to import a single or subset of databases from source ● However, binary logs from source will contain changes to all databases on the source including system databases. ● Ensure to set replication filters on the destination so that replication happens only for the databases you are migrating. ● Example: Replication filters can be set online using the command: CHANGE REPLICATION FILTER REPLICATE_WILD_DO_TABLE=('test.%’); MySQL Live Migration
  • 13. Scenario - 5 Live migration from RDS ● Baseline dump should be done from read replica ● --slave-dump and --include-master-host-port options cannot be used as they need super privileges which is not available for RDS user ● Replication should be stopped on the read replica before initiating baseline dump. ● Note down SHOW SLAVE STATUS command - Relay_Master_Log_File and Exec_Master_Log_Pos ● Replication should be initiated from RDS source node ● https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Proced ural.Exporting.NonRDSRepl.html MySQL Live Migration
  • 14. THANK YOU! Presented by Prasad Nagaraj