SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Downloaden Sie, um offline zu lesen
© 2011 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Amazon RDS for MySQL: Best
Practices and Data Migration
Amazon RDS
Amazon RDS
Amazon RDS is simple and fast to deploy
Amazon RDS handles management tasks
DB
Master
App
Backup
AWS Region
Replication
App
scp Load data
Staging server
DB Slave
SQL Flat files
mysql> GRANT SELECT,REPLICATION USER,REPLICATION CLIENT ON *.* TO repluser@‘<RDS
Endpoint>' IDENTIFIED BY ‘<password>';
Create replication user on the master
Record the “File” and the “Position” in the backup
$ mysqldump --databases sampledb --master-data=2 --single-transaction
-r sampledbdump.sql -u mysqluser –p mysqluserpassword
--
-- Position to start replication or point-in-time recovery from
--
-- CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin-changelog.000031', MASTER_LOG_POS=107;
Configure replication target
mysql> call mysql.rds_set_external_master(‘<master
server>',3306,‘<replicationuser>',‘<password>','mysql-bin-changelog.000031',107,0);
mysql> call mysql.rds_start_replication;
Configure the replication target and start replication
Stop the app pointing at the source. Stop replication after target catches up
mysql> call mysql.rds_stop_replication;
Promote target Amazon RDS database instance
mysql> call mysql.rds_reset_external_master;
Point the app at the target Amazon RDS database instance
AWS Region
App
Dump Data
Staging server
scp & load
MasterSlave
mysql> call mysql.rds_set_configuration('binlog retention hours', 48);
Physical
synchronous
replication
AZ1 AZ2
DNS
cname update
Sync
replication
Async replication
[ERROR] Slave I/O: Got fatal error 1236 from master when reading data from binary log:
‘Client requested master to start replication from impossible position;
Source: https://blogs.oracle.com/MySQL/entry/mysql_5_6_replication_performance
AZ1 AZ2 AZ1
Reads10% Reads10% Reads10% Reads10%
Reads10% Reads10% Reads10% Reads10%
Reads10%
Writes10%
Reads10%
Reads10%
Writes10%
Reads10%
Reads10%
Writes10%
Reads10%
Reads10%
Writes10%
Reads10%
Reads10%
Writes10%
Reads10%
Reads10%
Writes10%
Reads10%
Reads10%
Writes10%
Reads10%
Reads10%
Writes10%
Reads10%
Reads10%
Writes10%
Reads10%
Writes10%
Reads10%
Reads
90%
Writes10%
Primary
Writes10%
Replica1
Writes10%
Replica2
Writes10%
Replica3
Writes10%
Replica4
1X2X3X SCALE
Writes 20% Writes 20% Writes 20% Writes 20%
Reads
80%
Reads 20% Reads 20% Reads 20% Reads 20%
Reads 20%
Writes 20%
Reads 20%
Writes 20%
Reads 20%
Writes 20%
Reads 20%
Writes 20%
Writes 20%
Writes20%
Primary Replica1 Replica2 Replica3 Replica4
1X2X SCALE
Series1
Series2
Series3
Series4
Series5
1
2
3
4
5
6
7
8
1 2 3 4 5 6
Scale
Scale based on % Write
4x
Load buffer pool
Dump buffer pool
0
5000
10000
15000
20000
25000
30000
1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
TransactionsperSecond
Time (sec)
Workload with 50/50 R/W ratio
Unwarmed Cache
Warmed Cache
4X
9 min
mysql> CREATE EVENT ‘evt_dump_innodb_cache’
ON SCHEDULE EVERY 1 HOUR STARTS ‘2014-11-06 01:00:00’
DO BEGIN
CALL mysql.rds_innodb_buffer_pool_dump_now();
END
Considerations Options
Read Only
ReplicaPrimary R2MasterR/W
mysql> ALTER TABLE customers_address ADD COLUMN province VARCHAR(100);
pt-online-schema-change --alter
"ADD COLUMN province
VARCHAR(100)" --execute
h=localhost,D=bench,t=customers_
address,u=admin,p=admin
Logging + Storage
SQL
Transactions
Caching
Control PlaneData Plane
Amazon S3
DynamoDB
Amazon SWF
Amazon Route 53
© 2011 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified or distributed in whole or in part without the express consent of Amazon.com, Inc.
Questions?

Weitere ähnliche Inhalte

Andere mochten auch

AWS Enterprise Summit London | Relaxing on Sunday Mornings with the Sunday Ti...
AWS Enterprise Summit London | Relaxing on Sunday Mornings with the Sunday Ti...AWS Enterprise Summit London | Relaxing on Sunday Mornings with the Sunday Ti...
AWS Enterprise Summit London | Relaxing on Sunday Mornings with the Sunday Ti...
Amazon Web Services
 
Build Next Generation Real-time Applications with SAP HANA on AWS (BDT211) | ...
Build Next Generation Real-time Applications with SAP HANA on AWS (BDT211) | ...Build Next Generation Real-time Applications with SAP HANA on AWS (BDT211) | ...
Build Next Generation Real-time Applications with SAP HANA on AWS (BDT211) | ...
Amazon Web Services
 
AWS Partner Presentation - Suse Linux Proven Cloud Success
AWS Partner Presentation - Suse Linux Proven Cloud SuccessAWS Partner Presentation - Suse Linux Proven Cloud Success
AWS Partner Presentation - Suse Linux Proven Cloud Success
Amazon Web Services
 

Andere mochten auch (19)

AWS Enterprise Summit London | Relaxing on Sunday Mornings with the Sunday Ti...
AWS Enterprise Summit London | Relaxing on Sunday Mornings with the Sunday Ti...AWS Enterprise Summit London | Relaxing on Sunday Mornings with the Sunday Ti...
AWS Enterprise Summit London | Relaxing on Sunday Mornings with the Sunday Ti...
 
AWS Summit 2013 | India - Running High Churn Development & Test Environments,...
AWS Summit 2013 | India - Running High Churn Development & Test Environments,...AWS Summit 2013 | India - Running High Churn Development & Test Environments,...
AWS Summit 2013 | India - Running High Churn Development & Test Environments,...
 
Getting to MVP
Getting to MVPGetting to MVP
Getting to MVP
 
AWS Summit Sydney 2014 | Secure Hadoop as a Service - Session Sponsored by Intel
AWS Summit Sydney 2014 | Secure Hadoop as a Service - Session Sponsored by IntelAWS Summit Sydney 2014 | Secure Hadoop as a Service - Session Sponsored by Intel
AWS Summit Sydney 2014 | Secure Hadoop as a Service - Session Sponsored by Intel
 
Analytics in the Cloud
Analytics in the CloudAnalytics in the Cloud
Analytics in the Cloud
 
Application Portfolio Migration
Application Portfolio MigrationApplication Portfolio Migration
Application Portfolio Migration
 
Build Next Generation Real-time Applications with SAP HANA on AWS (BDT211) | ...
Build Next Generation Real-time Applications with SAP HANA on AWS (BDT211) | ...Build Next Generation Real-time Applications with SAP HANA on AWS (BDT211) | ...
Build Next Generation Real-time Applications with SAP HANA on AWS (BDT211) | ...
 
(DEV303) Practical DynamoDB Programming in Java
(DEV303) Practical DynamoDB Programming in Java(DEV303) Practical DynamoDB Programming in Java
(DEV303) Practical DynamoDB Programming in Java
 
Scalability and Availability
Scalability and AvailabilityScalability and Availability
Scalability and Availability
 
AWS Partner Presentation - Sonian
AWS Partner Presentation - SonianAWS Partner Presentation - Sonian
AWS Partner Presentation - Sonian
 
AWS Partner Webcast - Make Decisions Faster with AWS and SAP on HANA
AWS Partner Webcast - Make Decisions Faster with AWS and SAP on HANAAWS Partner Webcast - Make Decisions Faster with AWS and SAP on HANA
AWS Partner Webcast - Make Decisions Faster with AWS and SAP on HANA
 
CPN202 More for Less - AWS re: Invent 2012
CPN202 More for Less - AWS re: Invent 2012CPN202 More for Less - AWS re: Invent 2012
CPN202 More for Less - AWS re: Invent 2012
 
Webinar: Delivering Static and Dynamic Content Using CloudFront
Webinar: Delivering Static and Dynamic Content Using CloudFrontWebinar: Delivering Static and Dynamic Content Using CloudFront
Webinar: Delivering Static and Dynamic Content Using CloudFront
 
Managing an Enterprise Class Hybrid Architecture
Managing an Enterprise Class Hybrid ArchitectureManaging an Enterprise Class Hybrid Architecture
Managing an Enterprise Class Hybrid Architecture
 
Creating a Virtual Data Center
Creating a Virtual Data CenterCreating a Virtual Data Center
Creating a Virtual Data Center
 
善用分析與推播訊息增加及留住用戶
善用分析與推播訊息增加及留住用戶善用分析與推播訊息增加及留住用戶
善用分析與推播訊息增加及留住用戶
 
AWS Webcast - Accelerating Application Performance Using In-Memory Caching in...
AWS Webcast - Accelerating Application Performance Using In-Memory Caching in...AWS Webcast - Accelerating Application Performance Using In-Memory Caching in...
AWS Webcast - Accelerating Application Performance Using In-Memory Caching in...
 
AWS Partner Presentation - Suse Linux Proven Cloud Success
AWS Partner Presentation - Suse Linux Proven Cloud SuccessAWS Partner Presentation - Suse Linux Proven Cloud Success
AWS Partner Presentation - Suse Linux Proven Cloud Success
 
Accelerating DevOps Pipelines with AWS
Accelerating DevOps Pipelines with AWSAccelerating DevOps Pipelines with AWS
Accelerating DevOps Pipelines with AWS
 

Mehr von Amazon Web Services

Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
Amazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
Amazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
Amazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
Amazon Web Services
 

Mehr von Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Amazon RDS for MySQL: Best Practices and Migration