Database Migration using AWS Database Migration Service
- In the previous session we have create a vm and installed the mysql db
- We have the following users in mysql database
select user from mysql.user;
* To do the the migration we need some database to be present with tables and records in mysql
* Lets configure the employees database Refer Here
* Steps:
git clone https://github.com/datacharmer/test_db.git
cd test_db
sudo mysql -t < employees.sql
* Now lets use the following commands
create user 'migration'@'%' Identified by 'MotherIndia@123';
GRANT ALL PRIVILEGES ON employees.* TO 'migration'@'%';
- Now lets test the connectivity from other machine
- To fix the connectivity change the bind address from 127.0.0.1 to 0.0.0.0
/etc/mysql/mysql.conf.d/mysqld.cnf
- Restart the mysql service
sudo systemctl daemon-reload
sudo service mysql restart
- Now test the connection from mysql command line or mysql workbench
- Refer Here for installing mysql shell on windows
- Refer Here to download workbench
Migration Approaches
- Our aim is to migrate the database from on-premises to AWS RDS
- Data in the database will be constantly updated by applications, so database is constantly changing.
- One approach for migration is to take the downtime (Offline Approach)
- Export the data from database into some format
- Create an RDS Instance and import the exported data
- Not possible if the database size is huge
- Second approach is online migration:
- Here we migrate the data using DMS to RDS in incremental fashion
- Then we will validate the data and run some comparision tests
- when everything is fine, we announce a cut over date and migrate