Closed Bug 1248747 Opened 8 years ago Closed 8 years ago

Migrate database to RDS

Categories

(Release Engineering Graveyard :: Applications: Balrog (backend), defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mostlygeek, Assigned: mostlygeek)

References

Details

Determine the requirements and process for migrating the database to RDS. 

Things to look at: 

- size of database (what to keep/leave behind) 
- security requirements around the data
- migration process
- RDS sizing requirements (how much load the DB handles)
- MySQL version requirements
Assignee: nobody → bwong
Blocks: 1248748
No longer blocks: 1248748
If it helps, the db server sends lots of data to New Relic. I can pull the stats if you don't have access to it.
One thing I realized last night is that we don't need to bother with a database import for dev - we can start fresh there and add what little data we need. If we still want to a dev db import as a way of making sure it'll work for production, that's fine with me, but it's not necessary from my standpoint.
It's mainly for the production data which I assume we need to move. 

Do you have any information on the MySQL version of the database? 
Does Balrog have any specific MySQL requirements?
Sorry - missed this comment.

(In reply to Benson Wong [:mostlygeek] from comment #3)
> It's mainly for the production data which I assume we need to move. 
> 
> Do you have any information on the MySQL version of the database? 

I'm not sure which version we're running...probably should check with the Data team.

> Does Balrog have any specific MySQL requirements?

We don't use anything in the way of fancy features AFAIK. However, we do have migration scripts that we use to change the schema. I assume we'll be able to run those against RDS still? All they need is to be able to connect through a mysql:/// URI.
Flags: needinfo?(bwong)
Migration scripts can still be run like normal. RDS is really just managed MySQL, for the most part nothing will change.
Flags: needinfo?(bwong)
For the migration plan we will try to use Amazon's recommended process [1] for reduced downtime. In a nutshell this is: 

 - create an RDS instance, seed it w/ mysqldump
 - set up replication between RDS and the main DB 
 - run SHOW SLAVE STATUS, wait until Seconds_behind_master is 0

At that point all data will be kept in sync and we will be able repoint services to AWS and maintain a consistent database state. 

[1] http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Procedural.Importing.NonRDSRepl.html
https://aws.amazon.com/blogs/aws/aws-database-migration-service/ seems to be a newly-available wrapper around that process.
RDS stack is up and running in stage.
To enable SSL, I downloaded the certificate authority - rds-ca-2015-root.pem

copied it to /usr/local/etc on aus4-1 and aus4-2.db.phx1.mozilla.com.

added the following to /etc/my.cnf:
ssl-ca=/usr/local/etc/rds-ca-2015-root.pem

took aus4-1 out of the load balancer (it's the slave) and restarted MySQL, and all is good.
[root@aus4-2.db.phx1 ~]# date; /etc/init.d/mysqld restart; date
Wed Jun  1 17:04:28 UTC 2016
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
Wed Jun  1 17:04:46 UTC 2016


mysql> show variables like '%ssl%';
+---------------+-------------------------------------+
| Variable_name | Value                               |
+---------------+-------------------------------------+
| have_openssl  | YES                                 |
| have_ssl      | YES                                 |
| ssl_ca        | /usr/local/etc/rds-ca-2015-root.pem |

aus4-2 has certificates now.
This work has been completed.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
It has *not* been completed. Reopening.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Database has been migrated to AWS. We're not rolling back.
Status: REOPENED → RESOLVED
Closed: 8 years ago8 years ago
Resolution: --- → FIXED
Product: Release Engineering → Release Engineering Graveyard
You need to log in before you can comment on or make changes to this bug.