SlideShare una empresa de Scribd logo
1 de 52
DAT308 – Advanced Data Migration
Techniques for Amazon RDS
Shakil Langha, Abdul Sathar Sait, Bharanendra Nallamotu
Amazon Web Services
November 13, 2013

© 2013 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.
Next 60 minutes …
•
•
•
•
•

What is new in RDS
Types of Data Migration
General Considerations
Advanced migration techniques for Oracle
Near zero downtime migration for MySQL
RDS Recent Releases
Oracle Transparent Data Encryption

MySQL 5.6
Amazon
RDS

MySQL Replication to RDS

CR1.8XLarge for MySQL 5.6
Oracle Statspack

Cross-region Snapshot Copy
One-time Migration
Periodic Migration
Ongoing Replication
General Considerations
RDS Pre-migration Steps
•
•
•
•
•
•

Stop applications accessing the DB
Take a snapshot
Disable backups
Use Single AZ instances
Optimum instance for load performance
Configure security for cross-DB traffic
RDS Post-migration Steps
•
•
•
•
•

Turn on Backups
Turn on Multi-AZ
Create Read Replicas
Tighten down security
Notifications via CloudWatch, DBEvents
Data Migration Approaches for

Oracle
Let’s move some data
500 GB
Migration Process
Data Pump Export
expdp demoreinv/demo full=y dumpfile=data_pump_exp1:reinvexp1%U.dmp,
data_pump_exp2:reinvexp2%U.dmp, data_pump_exp3:reinvexp3%U.dmp
filesize=20G parallel=8 logfile=data_pump_exp1:reinvexpdp.log
compression=all job_name=reInvExp
Data Pump Export start
Data Pump Export done
Data Pump Files
Compression makes 500 GB to 175 GB

57+62+56 = 175 GB
Upload files to EC2 using UDP
Install Tsunami on both the source database server and the EC2 instance
Open port 46224 for Tsunami communication
$ yum -y install make
yum -y install automake
yum -y install gcc
yum -y install autoconf
yum -y install cvs
wget http://sourceforge.net/projects/tsunami-udp/files/latest/download?_test=goal
tar -xzf tsunami*gz
cd tsunami-udp*
./recompile.sh
make install
Using UDP tool Tsunami
On the source database server start Tsunami server
$ cd/mnt/expdisk1
$ tsunamid *

On the source database server start Tsunami server
$ cd /mnt/data_files
$ tsunami
$ tsunami> connect source.db.server
$ tsunami> get *
Export and Upload in parallel
• No need to wait till all 18 files are done to start upload
• Start upload as soon as the first set of 3 files are done
Total time to upload175 GB
Transfer files to RDS instance
RDS instance has an externally accessible Oracle Directory Object

DATA_PUMP_DIR
Use a script to move data files to RDS DATA_PUMP_DIR
Perl script to transfer files to RDS instance
# RDS instance info
my $RDS_PORT=4080;
my $RDS_HOST="myrdshost.xxx.us-east-1-devo.rds-dev.amazonaws.com";
my $RDS_LOGIN="orauser/orapwd";
my $RDS_SID="myoradb";
my $dirname = "DATA_PUMP_DIR";
my $fname
= $ARGV[0];

my $data = “dummy";
my $chunk = 8192;
my $sql_open
= "BEGIN perl_global.fh := utl_file.fopen(:dirname, :fname, 'wb', :chunk); END;";
my $sql_write = "BEGIN utl_file.put_raw(perl_global.fh, :data, true); END;";
my $sql_close = "BEGIN utl_file.fclose(perl_global.fh); END;";
my $sql_global = "create or replace package perl_global as fh utl_file.file_type; end;";
my $conn = DBI->connect('dbi:Oracle:host='.$RDS_HOST.';sid='.$RDS_SID.';port='.$RDS_PORT,$RDS_LOGIN, '') ||
die ( $DBI::errstr . "n") ;
my $updated=$conn->do($sql_global);
my $stmt = $conn->prepare ($sql_open);
Perl script to transfer files to RDS instance
$stmt->bind_param_inout(":dirname", $dirname, 12);
$stmt->bind_param_inout(":fname", $fname, 12);
$stmt->bind_param_inout(":chunk", $chunk, 4);
$stmt->execute() || die ( $DBI::errstr . "n");
open (INF, $fname) || die "nCan't open $fname for reading: $!n";
binmode(INF);
$stmt = $conn->prepare ($sql_write);
my %attrib = ('ora_type,24);
my $val=1;
while ($val > 0) {
$val = read (INF, $data, $chunk);
$stmt->bind_param(":data", $data , %attrib);
$stmt->execute() || die ( $DBI::errstr . "n") ; };
die "Problem copying: $!n" if $!;
close INF || die "Can't close $fname: $!n";
$stmt = $conn->prepare ($sql_close);
$stmt->execute() || die ( $DBI::errstr . "n") ;
Transfer files as they are received
• No need to wait till all 18 files are received in the EC2 instance
• Start transfer to RDS instance as soon as the first file is
received.
Total time to transfer files to RDS
Import data into the RDS instance
•
•

Import from within RDS instance using DBMS_DATAPUMP package
Submit a job using PL/SQL script
Import data into the RDS instance
declare
h1
NUMBER;
begin
h1 := dbms_datapump.open (operation => 'IMPORT', job_mode => 'FULL', job_name => 'REINVIMP', version =>
'COMPATIBLE');
dbms_datapump.set_parallel(handle => h1, degree => 8);
dbms_datapump.add_file(handle => h1, filename => 'IMPORT.LOG', directory => 'DATA_PUMP_DIR', filetype => 3);
dbms_datapump.set_parameter(handle => h1, name => 'KEEP_MASTER', value => 0);
dbms_datapump.add_file(handle => h1, filename => 'reinvexp1%U.dmp', directory => 'DATA_PUMP_DIR', filetype =>
1);
dbms_datapump.add_file(handle => h1, filename => 'reinvexp2%U.dmp', directory => 'DATA_PUMP_DIR', filetype =>
1);
dbms_datapump.add_file(handle => h1, filename => 'reinvexp3%U.dmp', directory => 'DATA_PUMP_DIR', filetype =>
1);
dbms_datapump.set_parameter(handle => h1, name => 'INCLUDE_METADATA', value => 1);
dbms_datapump.set_parameter(handle => h1, name => 'DATA_ACCESS_METHOD', value => 'AUTOMATIC');
dbms_datapump.set_parameter(handle => h1, name => 'REUSE_DATAFILES', value => 0);
dbms_datapump.set_parameter(handle => h1, name => 'SKIP_UNUSABLE_INDEXES', value => 0);
dbms_datapump.start_job(handle => h1, skip_current => 0, abort_step => 0);
dbms_datapump.detach(handle => h1);
end;
/
Total import data into RDS database
Time taken to migrate the database
Optimize the Data Pump Export
• Reduce the data set to optimal size, avoid
indexes
• Use compression and Parallel processing
• Use multiple disks with independent IO
Optimize Data Upload
•
•
•
•

Use Tsunami for UDP based file transfer
Use large EC2 instance with SSD or PIOPS volume
Use multiple disks with independent IO
You could use multiple EC2 instances for parallel upload
Optimize Data File upload to RDS
• Use the largest RDS instance possible during the import
process
• Avoid using RDS instance for any other load during this
time
• Provision enough storage in the RDS instance for the
uploaded files and imported data
Periodic Upload
• Oracle Data Pump Network Mode
• Oracle Materialized Views
• Custom triggers
For small data set one time load
• Oracle Import/Export
• Oracle Data Pump Network Mode
• Oracle SQL*Loader
• Oracle Materialized Views
Data Migration Approaches for

MySQL
Importing From a MySQL DB Instance
Application

DB

Application

mysqldump

Staging
area

Load data

scp
Tsunami UDP
Staging server

Replication

AWS Region
Importing From a MySQL DB Instance
Importing From a MySQL DB Instance
Check the size of the master database
Create the backup file
Create RDS for MySQL and EC2
Create RDS for MySQL using AWS Management Console or CLI
PROMPT>rds-create-db-instance mydbinstance -s 1024 -c db.m3.2xlarge -e MySQL - u
<masterawsuser> -p <secretpassword> --backup-retention-period 3

Create EC2 (Staging server) using AWS Management Console or CLI
aws ec2 run-instances --image-id ami-xxxxxxxx --count 1 --instance-type m3.2xlarge --key-name
MyKeyPair --security-groups MySecurityGroup

Create Replication User on the Master
mysql> GRANT SELECT,REPLICATION USER,REPLICATION CLIENT ON *.* TO
repluser@„<RDS Endpoint>' IDENTIFIED BY „<password>';
Update /etc/my.cnf on the master server
Enable MySQL binlog
This enables bin logging which creates a file recording the changes that have
occurred on the Master which the Slave uses to replicate the data.
[mysqld]
server-id = 1
binlog-do-db=mytest
relay-log = /var/lib/mysql/mysql-relay-bin
relay-log-index = /var/lib/mysql/mysql-relay-bin.index
log-error = /var/lib/mysql/mysql.err
master-info-file = /var/lib/mysql/mysql-master.info
relay-log-info-file = /var/lib/mysql/mysql-relay-log.info
log-bin = /var/lib/mysql/mysql-bin
Configure the master database
Restart the master database after /etc/my.cnf is updated
$ sudo /etc/init.d/mysqld start

Record the “File” and the “Position” values.
$ mysql -h localhost -u root -p
mysql> show master statusG
*************************** 1. row ***************************
File: mysql-bin.000023
Position: 107
Binlog_Do_DB: mytest
Binlog_Ignore_DB:
1 row in set (0.00 sec)
Upload files to EC2 using UDP
• Tar and compress MySQL dump file preparation
to ship to EC2 staging server.
• Update the EC2 security group to allow UDP
connection from the server where the dump files
being created to your new mysql client server.
• On the EC2 staging instance untar the tar.tgz
file.
Configure the RDS database
Create the database
mysql> create database bench;

Import the database that you previously exported from the master database.
Mysql> load data local infile '/reinvent/tables/customer_address.txt' into table customer_address
fields terminated by ',';
Mysql> load data local infile '/reinvent/tables/customer.txt' into table customer fields terminated by ',';

Configure the slave RDS for MySQL server and start the slave server
mysql> call mysql.rds_set_external_master(„<master
server>',3306,„<replicationuser>',„<password>','mysql-bin.000013',107,0);
mysql> call mysql.rds_start_replication;
RDS for MySQL replication status
Switch RDS MySQL to the Master
Switch-over the RDS for MySQL
– Stop the service/application that is pointing at the Master
Database
– Once all changes have been applied to New RDS
Database. Stop replication with “call mysql.rds_stop_replication”
– Point the service/application at the New RDS Database.
– Once Migration is complete. “call mysql.
rds_reset_external_master”
Please give us your feedback on this
presentation

DAT308
As a thank you, we will select prize
winners daily for completed surveys!
References
•
•
•
•
•

RDS Home Page
RDS FAQs
RDS Webinars
RDS Best Practices
Data Import Guides
– MySQL
– Oracle
– SQL Server

Más contenido relacionado

La actualidad más candente

Introducing Amazon RDS Using Oracle Database
Introducing Amazon RDS Using Oracle DatabaseIntroducing Amazon RDS Using Oracle Database
Introducing Amazon RDS Using Oracle Database
Jamie Kinney
 
Oracle on aws overview sep 2011
Oracle on aws overview   sep 2011Oracle on aws overview   sep 2011
Oracle on aws overview sep 2011
Jamie Kinney
 
Amazon RDS: Deep dive with Oracle
Amazon RDS: Deep dive with OracleAmazon RDS: Deep dive with Oracle
Amazon RDS: Deep dive with Oracle
Amazon Web Services
 

La actualidad más candente (20)

Introducing Amazon RDS Using Oracle Database
Introducing Amazon RDS Using Oracle DatabaseIntroducing Amazon RDS Using Oracle Database
Introducing Amazon RDS Using Oracle Database
 
Oracle on AWS partner webinar series
Oracle on AWS partner webinar series Oracle on AWS partner webinar series
Oracle on AWS partner webinar series
 
Oracle on aws overview sep 2011
Oracle on aws overview   sep 2011Oracle on aws overview   sep 2011
Oracle on aws overview sep 2011
 
What's New in Amazon RDS for Open Source and Commercial Databases
What's New in Amazon RDS for Open Source and Commercial DatabasesWhat's New in Amazon RDS for Open Source and Commercial Databases
What's New in Amazon RDS for Open Source and Commercial Databases
 
Migrating and Running DBs on Amazon RDS for Oracle
Migrating and Running DBs on Amazon RDS for OracleMigrating and Running DBs on Amazon RDS for Oracle
Migrating and Running DBs on Amazon RDS for Oracle
 
Focus on your app with Amazon RDS
Focus on your app with Amazon RDSFocus on your app with Amazon RDS
Focus on your app with Amazon RDS
 
Day 3 - AWS MySQL Relational Database Service Best Practices for Performance ...
Day 3 - AWS MySQL Relational Database Service Best Practices for Performance ...Day 3 - AWS MySQL Relational Database Service Best Practices for Performance ...
Day 3 - AWS MySQL Relational Database Service Best Practices for Performance ...
 
Deep Dive: Amazon RDS
Deep Dive: Amazon RDSDeep Dive: Amazon RDS
Deep Dive: Amazon RDS
 
SRV401 Deep Dive on Amazon Elastic File System (Amazon EFS)
SRV401 Deep Dive on Amazon Elastic File System (Amazon EFS)SRV401 Deep Dive on Amazon Elastic File System (Amazon EFS)
SRV401 Deep Dive on Amazon Elastic File System (Amazon EFS)
 
Amazon RDS: Deep dive with Oracle
Amazon RDS: Deep dive with OracleAmazon RDS: Deep dive with Oracle
Amazon RDS: Deep dive with Oracle
 
Amazon RDS Deep Dive
Amazon RDS Deep DiveAmazon RDS Deep Dive
Amazon RDS Deep Dive
 
PASS 17 SQL Server on AWS Best Practices
PASS 17 SQL Server on AWS Best PracticesPASS 17 SQL Server on AWS Best Practices
PASS 17 SQL Server on AWS Best Practices
 
Oracle COTS Applications on AWS
Oracle COTS Applications on AWSOracle COTS Applications on AWS
Oracle COTS Applications on AWS
 
Intro to AWS: Database Services
Intro to AWS: Database ServicesIntro to AWS: Database Services
Intro to AWS: Database Services
 
BDA 302 Deep Dive on Migrating Big Data Workloads to Amazon EMR
BDA 302 Deep Dive on Migrating Big Data Workloads to Amazon EMRBDA 302 Deep Dive on Migrating Big Data Workloads to Amazon EMR
BDA 302 Deep Dive on Migrating Big Data Workloads to Amazon EMR
 
Intro to AWS: Database Services
Intro to AWS: Database ServicesIntro to AWS: Database Services
Intro to AWS: Database Services
 
Day 2 - Amazon RDS - Letting AWS run your Low Admin, High Performance Database
Day 2 - Amazon RDS - Letting AWS run your Low Admin, High Performance DatabaseDay 2 - Amazon RDS - Letting AWS run your Low Admin, High Performance Database
Day 2 - Amazon RDS - Letting AWS run your Low Admin, High Performance Database
 
Best Practices running SQL Server on AWS
Best Practices running SQL Server on AWSBest Practices running SQL Server on AWS
Best Practices running SQL Server on AWS
 
Amazon rds
Amazon rdsAmazon rds
Amazon rds
 
AWS Storage Tiering for Enterprise Workloads
AWS Storage Tiering for Enterprise WorkloadsAWS Storage Tiering for Enterprise Workloads
AWS Storage Tiering for Enterprise Workloads
 

Destacado

ERP Data Migration Methodologies
ERP Data Migration MethodologiesERP Data Migration Methodologies
ERP Data Migration Methodologies
Ahmed M. Rafik
 
Migración de Base de Datos con SQL Developer
Migración de Base de Datos con SQL DeveloperMigración de Base de Datos con SQL Developer
Migración de Base de Datos con SQL Developer
Valentin Leonard Tabacaru
 

Destacado (20)

Using Amazon RDS to power enterprise applications (Peoplesoft)
Using Amazon RDS to power enterprise applications (Peoplesoft) Using Amazon RDS to power enterprise applications (Peoplesoft)
Using Amazon RDS to power enterprise applications (Peoplesoft)
 
Oracle Peoplesoft on AWS: A quick introduction
Oracle Peoplesoft on AWS: A quick introductionOracle Peoplesoft on AWS: A quick introduction
Oracle Peoplesoft on AWS: A quick introduction
 
AWS CloudFormation template with single & redundant system
AWS CloudFormation template with single & redundant systemAWS CloudFormation template with single & redundant system
AWS CloudFormation template with single & redundant system
 
Migrating your Databases to Aurora - AWS April 2016 Webinar Series
Migrating your Databases to Aurora - AWS April 2016 Webinar Series Migrating your Databases to Aurora - AWS April 2016 Webinar Series
Migrating your Databases to Aurora - AWS April 2016 Webinar Series
 
AWS Enterprise Day | Running Critical Business Applications on AWS
AWS Enterprise Day | Running Critical Business Applications on AWSAWS Enterprise Day | Running Critical Business Applications on AWS
AWS Enterprise Day | Running Critical Business Applications on AWS
 
AWS Webcast - Introduction to Amazon RDS: Low Admin, High Performance Databas...
AWS Webcast - Introduction to Amazon RDS: Low Admin, High Performance Databas...AWS Webcast - Introduction to Amazon RDS: Low Admin, High Performance Databas...
AWS Webcast - Introduction to Amazon RDS: Low Admin, High Performance Databas...
 
AWS re:Invent 2016: Simplified Data Center Migration—Lessons Learned by Live ...
AWS re:Invent 2016: Simplified Data Center Migration—Lessons Learned by Live ...AWS re:Invent 2016: Simplified Data Center Migration—Lessons Learned by Live ...
AWS re:Invent 2016: Simplified Data Center Migration—Lessons Learned by Live ...
 
Continuous delivery and deployment on AWS
Continuous delivery and deployment on AWSContinuous delivery and deployment on AWS
Continuous delivery and deployment on AWS
 
Configuring MongoDB HA Replica Set on AWS EC2
Configuring MongoDB HA Replica Set on AWS EC2Configuring MongoDB HA Replica Set on AWS EC2
Configuring MongoDB HA Replica Set on AWS EC2
 
ERP Data Migration Methodologies
ERP Data Migration MethodologiesERP Data Migration Methodologies
ERP Data Migration Methodologies
 
AWS re:Invent 2016: Amazon Aurora Best Practices: Getting the Best Out of You...
AWS re:Invent 2016: Amazon Aurora Best Practices: Getting the Best Out of You...AWS re:Invent 2016: Amazon Aurora Best Practices: Getting the Best Out of You...
AWS re:Invent 2016: Amazon Aurora Best Practices: Getting the Best Out of You...
 
Migración de Base de Datos con SQL Developer
Migración de Base de Datos con SQL DeveloperMigración de Base de Datos con SQL Developer
Migración de Base de Datos con SQL Developer
 
AWS re:Invent 2016: Deep Dive on AWS Cloud Data Migration Services (ENT210)
AWS re:Invent 2016: Deep Dive on AWS Cloud Data Migration Services (ENT210)AWS re:Invent 2016: Deep Dive on AWS Cloud Data Migration Services (ENT210)
AWS re:Invent 2016: Deep Dive on AWS Cloud Data Migration Services (ENT210)
 
Getting Started with AWS Database Migration Service
Getting Started with AWS Database Migration ServiceGetting Started with AWS Database Migration Service
Getting Started with AWS Database Migration Service
 
AWS Summit London 2014 - JUST EAT - High Availability and Rapid Change
AWS Summit London 2014 - JUST EAT - High Availability and Rapid ChangeAWS Summit London 2014 - JUST EAT - High Availability and Rapid Change
AWS Summit London 2014 - JUST EAT - High Availability and Rapid Change
 
(PFC305) Embracing Failure: Fault-Injection and Service Reliability | AWS re:...
(PFC305) Embracing Failure: Fault-Injection and Service Reliability | AWS re:...(PFC305) Embracing Failure: Fault-Injection and Service Reliability | AWS re:...
(PFC305) Embracing Failure: Fault-Injection and Service Reliability | AWS re:...
 
AWS re:Invent 2016: Deep Dive on Amazon Relational Database Service (DAT305)
AWS re:Invent 2016: Deep Dive on Amazon Relational Database Service (DAT305)AWS re:Invent 2016: Deep Dive on Amazon Relational Database Service (DAT305)
AWS re:Invent 2016: Deep Dive on Amazon Relational Database Service (DAT305)
 
AWS Webcast - Getting Started with Amazon Web Services
AWS Webcast - Getting Started with Amazon Web ServicesAWS Webcast - Getting Started with Amazon Web Services
AWS Webcast - Getting Started with Amazon Web Services
 
Getting Started with ElastiCache for Redis
Getting Started with ElastiCache for RedisGetting Started with ElastiCache for Redis
Getting Started with ElastiCache for Redis
 
Migrate from SQL Server or Oracle into Amazon Aurora using AWS Database Migra...
Migrate from SQL Server or Oracle into Amazon Aurora using AWS Database Migra...Migrate from SQL Server or Oracle into Amazon Aurora using AWS Database Migra...
Migrate from SQL Server or Oracle into Amazon Aurora using AWS Database Migra...
 

Similar a Advanced data migration techniques for Amazon RDS

Speed Up Your Existing Relational Databases with Hazelcast and Speedment
Speed Up Your Existing Relational Databases with Hazelcast and SpeedmentSpeed Up Your Existing Relational Databases with Hazelcast and Speedment
Speed Up Your Existing Relational Databases with Hazelcast and Speedment
Hazelcast
 

Similar a Advanced data migration techniques for Amazon RDS (20)

Migrate Oracle database to Amazon RDS
Migrate Oracle database to Amazon RDSMigrate Oracle database to Amazon RDS
Migrate Oracle database to Amazon RDS
 
DevOps Meetup ansible
DevOps Meetup   ansibleDevOps Meetup   ansible
DevOps Meetup ansible
 
AWS APAC Webinar Week - AWS MySQL Relational Database Services Best Practices...
AWS APAC Webinar Week - AWS MySQL Relational Database Services Best Practices...AWS APAC Webinar Week - AWS MySQL Relational Database Services Best Practices...
AWS APAC Webinar Week - AWS MySQL Relational Database Services Best Practices...
 
데이터 마이그레이션 AWS와 같이하기 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 Gaming
데이터 마이그레이션 AWS와 같이하기 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 Gaming데이터 마이그레이션 AWS와 같이하기 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 Gaming
데이터 마이그레이션 AWS와 같이하기 - 김일호 솔루션즈 아키텍트:: AWS Cloud Track 3 Gaming
 
Amazon RDS for Microsoft SQL: Performance, Security, Best Practices (DAT303) ...
Amazon RDS for Microsoft SQL: Performance, Security, Best Practices (DAT303) ...Amazon RDS for Microsoft SQL: Performance, Security, Best Practices (DAT303) ...
Amazon RDS for Microsoft SQL: Performance, Security, Best Practices (DAT303) ...
 
Migrate your Data Warehouse to Amazon Redshift - September Webinar Series
Migrate your Data Warehouse to Amazon Redshift - September Webinar SeriesMigrate your Data Warehouse to Amazon Redshift - September Webinar Series
Migrate your Data Warehouse to Amazon Redshift - September Webinar Series
 
AWS Database Services-Philadelphia AWS User Group-4-17-2018
AWS Database Services-Philadelphia AWS User Group-4-17-2018AWS Database Services-Philadelphia AWS User Group-4-17-2018
AWS Database Services-Philadelphia AWS User Group-4-17-2018
 
Speed Up Your Existing Relational Databases with Hazelcast and Speedment
Speed Up Your Existing Relational Databases with Hazelcast and SpeedmentSpeed Up Your Existing Relational Databases with Hazelcast and Speedment
Speed Up Your Existing Relational Databases with Hazelcast and Speedment
 
Convert single instance to RAC
Convert single instance to RACConvert single instance to RAC
Convert single instance to RAC
 
Cloud computing & lamp applications
Cloud computing & lamp applicationsCloud computing & lamp applications
Cloud computing & lamp applications
 
Databases on aws part 1
Databases on aws   part 1Databases on aws   part 1
Databases on aws part 1
 
REPEAT_1_Deep_dive_on_new_features_in_Amazon_RDS_for_SQL_Server_DAT364-R1(1).pdf
REPEAT_1_Deep_dive_on_new_features_in_Amazon_RDS_for_SQL_Server_DAT364-R1(1).pdfREPEAT_1_Deep_dive_on_new_features_in_Amazon_RDS_for_SQL_Server_DAT364-R1(1).pdf
REPEAT_1_Deep_dive_on_new_features_in_Amazon_RDS_for_SQL_Server_DAT364-R1(1).pdf
 
Automating complex infrastructures with Puppet
Automating complex infrastructures with PuppetAutomating complex infrastructures with Puppet
Automating complex infrastructures with Puppet
 
Architecting cloud
Architecting cloudArchitecting cloud
Architecting cloud
 
HadoopCon2015 Multi-Cluster Live Synchronization with Kerberos Federated Hadoop
HadoopCon2015 Multi-Cluster Live Synchronization with Kerberos Federated HadoopHadoopCon2015 Multi-Cluster Live Synchronization with Kerberos Federated Hadoop
HadoopCon2015 Multi-Cluster Live Synchronization with Kerberos Federated Hadoop
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014
 
Scaling an invoicing SaaS from zero to over 350k customers
Scaling an invoicing SaaS from zero to over 350k customersScaling an invoicing SaaS from zero to over 350k customers
Scaling an invoicing SaaS from zero to over 350k customers
 
Deep Dive on Amazon RDS (May 2016)
Deep Dive on Amazon RDS (May 2016)Deep Dive on Amazon RDS (May 2016)
Deep Dive on Amazon RDS (May 2016)
 
Functional Hostnames and Why they are Bad
Functional Hostnames and Why they are BadFunctional Hostnames and Why they are Bad
Functional Hostnames and Why they are Bad
 
Apache Spark Introduction - CloudxLab
Apache Spark Introduction - CloudxLabApache Spark Introduction - CloudxLab
Apache Spark Introduction - CloudxLab
 

Más de Tom Laszewski

AWS Cloud Center Excellence Quick Start Prescriptive Guidance
AWS Cloud Center Excellence Quick Start Prescriptive GuidanceAWS Cloud Center Excellence Quick Start Prescriptive Guidance
AWS Cloud Center Excellence Quick Start Prescriptive Guidance
Tom Laszewski
 

Más de Tom Laszewski (20)

AWS Private Equity Transformation Advisory
AWS Private Equity Transformation AdvisoryAWS Private Equity Transformation Advisory
AWS Private Equity Transformation Advisory
 
Organizing for faster innovation - People, process, culture, and technology
Organizing for faster innovation - People, process, culture, and technologyOrganizing for faster innovation - People, process, culture, and technology
Organizing for faster innovation - People, process, culture, and technology
 
Creating an Operating Model to enable a high frequency organization
Creating an Operating Model to enable a high frequency organizationCreating an Operating Model to enable a high frequency organization
Creating an Operating Model to enable a high frequency organization
 
Technical Due Diligence with AWS
Technical Due Diligence with AWSTechnical Due Diligence with AWS
Technical Due Diligence with AWS
 
AWS Cloud Center Excellence Quick Start Prescriptive Guidance
AWS Cloud Center Excellence Quick Start Prescriptive GuidanceAWS Cloud Center Excellence Quick Start Prescriptive Guidance
AWS Cloud Center Excellence Quick Start Prescriptive Guidance
 
AWS Technical Due Diligence Workshop Session Two
AWS Technical Due Diligence Workshop Session TwoAWS Technical Due Diligence Workshop Session Two
AWS Technical Due Diligence Workshop Session Two
 
AWS Technical Due Diligence Workshop Session One
AWS Technical Due Diligence Workshop Session OneAWS Technical Due Diligence Workshop Session One
AWS Technical Due Diligence Workshop Session One
 
Post transaction cloud value creation
Post transaction cloud value creation Post transaction cloud value creation
Post transaction cloud value creation
 
Private Equity Technical Due Diligence Value Creation
Private Equity Technical Due Diligence Value CreationPrivate Equity Technical Due Diligence Value Creation
Private Equity Technical Due Diligence Value Creation
 
Cloud Enablement Engine Role Definition and Mapping
Cloud Enablement Engine Role Definition and MappingCloud Enablement Engine Role Definition and Mapping
Cloud Enablement Engine Role Definition and Mapping
 
Private Equity Value Creation Carve Outs, Divestitures and mergers
Private Equity Value Creation Carve Outs, Divestitures and mergersPrivate Equity Value Creation Carve Outs, Divestitures and mergers
Private Equity Value Creation Carve Outs, Divestitures and mergers
 
AWS Technical Due Diligence Executive Overview
AWS Technical Due Diligence Executive Overview AWS Technical Due Diligence Executive Overview
AWS Technical Due Diligence Executive Overview
 
AWS Techical Due Diligence to post transaction execution for M&A
AWS Techical Due Diligence to post transaction execution for M&A AWS Techical Due Diligence to post transaction execution for M&A
AWS Techical Due Diligence to post transaction execution for M&A
 
Hybrid Cloud on AWS: Foundational Layers and AWS Services
Hybrid Cloud on AWS: Foundational Layers and AWS ServicesHybrid Cloud on AWS: Foundational Layers and AWS Services
Hybrid Cloud on AWS: Foundational Layers and AWS Services
 
Migrating thousands of workloads to AWS at enterprise scale
Migrating thousands of workloads to AWS at enterprise scaleMigrating thousands of workloads to AWS at enterprise scale
Migrating thousands of workloads to AWS at enterprise scale
 
Operating and Managing Hybrid Cloud on AWS
Operating and Managing Hybrid Cloud on AWSOperating and Managing Hybrid Cloud on AWS
Operating and Managing Hybrid Cloud on AWS
 
Monolithic to Microservices Demystified
Monolithic to Microservices DemystifiedMonolithic to Microservices Demystified
Monolithic to Microservices Demystified
 
AWS Cloud Adoption Framework and Workshops
AWS Cloud Adoption Framework and WorkshopsAWS Cloud Adoption Framework and Workshops
AWS Cloud Adoption Framework and Workshops
 
DevOps, CI/CD, cost management, and security on AWS
DevOps, CI/CD, cost management, and security on AWSDevOps, CI/CD, cost management, and security on AWS
DevOps, CI/CD, cost management, and security on AWS
 
Hybrid Cloud on AWS : Provisioning, Operations, Management, and Monitoring
Hybrid Cloud on AWS : Provisioning, Operations, Management, and Monitoring Hybrid Cloud on AWS : Provisioning, Operations, Management, and Monitoring
Hybrid Cloud on AWS : Provisioning, Operations, Management, and Monitoring
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 

Advanced data migration techniques for Amazon RDS

  • 1. DAT308 – Advanced Data Migration Techniques for Amazon RDS Shakil Langha, Abdul Sathar Sait, Bharanendra Nallamotu Amazon Web Services November 13, 2013 © 2013 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.
  • 2. Next 60 minutes … • • • • • What is new in RDS Types of Data Migration General Considerations Advanced migration techniques for Oracle Near zero downtime migration for MySQL
  • 3. RDS Recent Releases Oracle Transparent Data Encryption MySQL 5.6 Amazon RDS MySQL Replication to RDS CR1.8XLarge for MySQL 5.6 Oracle Statspack Cross-region Snapshot Copy
  • 8. RDS Pre-migration Steps • • • • • • Stop applications accessing the DB Take a snapshot Disable backups Use Single AZ instances Optimum instance for load performance Configure security for cross-DB traffic
  • 9. RDS Post-migration Steps • • • • • Turn on Backups Turn on Multi-AZ Create Read Replicas Tighten down security Notifications via CloudWatch, DBEvents
  • 13.
  • 15. Data Pump Export expdp demoreinv/demo full=y dumpfile=data_pump_exp1:reinvexp1%U.dmp, data_pump_exp2:reinvexp2%U.dmp, data_pump_exp3:reinvexp3%U.dmp filesize=20G parallel=8 logfile=data_pump_exp1:reinvexpdp.log compression=all job_name=reInvExp
  • 19. Compression makes 500 GB to 175 GB 57+62+56 = 175 GB
  • 20. Upload files to EC2 using UDP Install Tsunami on both the source database server and the EC2 instance Open port 46224 for Tsunami communication $ yum -y install make yum -y install automake yum -y install gcc yum -y install autoconf yum -y install cvs wget http://sourceforge.net/projects/tsunami-udp/files/latest/download?_test=goal tar -xzf tsunami*gz cd tsunami-udp* ./recompile.sh make install
  • 21. Using UDP tool Tsunami On the source database server start Tsunami server $ cd/mnt/expdisk1 $ tsunamid * On the source database server start Tsunami server $ cd /mnt/data_files $ tsunami $ tsunami> connect source.db.server $ tsunami> get *
  • 22. Export and Upload in parallel • No need to wait till all 18 files are done to start upload • Start upload as soon as the first set of 3 files are done
  • 23. Total time to upload175 GB
  • 24. Transfer files to RDS instance RDS instance has an externally accessible Oracle Directory Object DATA_PUMP_DIR Use a script to move data files to RDS DATA_PUMP_DIR
  • 25. Perl script to transfer files to RDS instance # RDS instance info my $RDS_PORT=4080; my $RDS_HOST="myrdshost.xxx.us-east-1-devo.rds-dev.amazonaws.com"; my $RDS_LOGIN="orauser/orapwd"; my $RDS_SID="myoradb"; my $dirname = "DATA_PUMP_DIR"; my $fname = $ARGV[0]; my $data = “dummy"; my $chunk = 8192; my $sql_open = "BEGIN perl_global.fh := utl_file.fopen(:dirname, :fname, 'wb', :chunk); END;"; my $sql_write = "BEGIN utl_file.put_raw(perl_global.fh, :data, true); END;"; my $sql_close = "BEGIN utl_file.fclose(perl_global.fh); END;"; my $sql_global = "create or replace package perl_global as fh utl_file.file_type; end;"; my $conn = DBI->connect('dbi:Oracle:host='.$RDS_HOST.';sid='.$RDS_SID.';port='.$RDS_PORT,$RDS_LOGIN, '') || die ( $DBI::errstr . "n") ; my $updated=$conn->do($sql_global); my $stmt = $conn->prepare ($sql_open);
  • 26. Perl script to transfer files to RDS instance $stmt->bind_param_inout(":dirname", $dirname, 12); $stmt->bind_param_inout(":fname", $fname, 12); $stmt->bind_param_inout(":chunk", $chunk, 4); $stmt->execute() || die ( $DBI::errstr . "n"); open (INF, $fname) || die "nCan't open $fname for reading: $!n"; binmode(INF); $stmt = $conn->prepare ($sql_write); my %attrib = ('ora_type,24); my $val=1; while ($val > 0) { $val = read (INF, $data, $chunk); $stmt->bind_param(":data", $data , %attrib); $stmt->execute() || die ( $DBI::errstr . "n") ; }; die "Problem copying: $!n" if $!; close INF || die "Can't close $fname: $!n"; $stmt = $conn->prepare ($sql_close); $stmt->execute() || die ( $DBI::errstr . "n") ;
  • 27. Transfer files as they are received • No need to wait till all 18 files are received in the EC2 instance • Start transfer to RDS instance as soon as the first file is received.
  • 28. Total time to transfer files to RDS
  • 29. Import data into the RDS instance • • Import from within RDS instance using DBMS_DATAPUMP package Submit a job using PL/SQL script
  • 30. Import data into the RDS instance declare h1 NUMBER; begin h1 := dbms_datapump.open (operation => 'IMPORT', job_mode => 'FULL', job_name => 'REINVIMP', version => 'COMPATIBLE'); dbms_datapump.set_parallel(handle => h1, degree => 8); dbms_datapump.add_file(handle => h1, filename => 'IMPORT.LOG', directory => 'DATA_PUMP_DIR', filetype => 3); dbms_datapump.set_parameter(handle => h1, name => 'KEEP_MASTER', value => 0); dbms_datapump.add_file(handle => h1, filename => 'reinvexp1%U.dmp', directory => 'DATA_PUMP_DIR', filetype => 1); dbms_datapump.add_file(handle => h1, filename => 'reinvexp2%U.dmp', directory => 'DATA_PUMP_DIR', filetype => 1); dbms_datapump.add_file(handle => h1, filename => 'reinvexp3%U.dmp', directory => 'DATA_PUMP_DIR', filetype => 1); dbms_datapump.set_parameter(handle => h1, name => 'INCLUDE_METADATA', value => 1); dbms_datapump.set_parameter(handle => h1, name => 'DATA_ACCESS_METHOD', value => 'AUTOMATIC'); dbms_datapump.set_parameter(handle => h1, name => 'REUSE_DATAFILES', value => 0); dbms_datapump.set_parameter(handle => h1, name => 'SKIP_UNUSABLE_INDEXES', value => 0); dbms_datapump.start_job(handle => h1, skip_current => 0, abort_step => 0); dbms_datapump.detach(handle => h1); end; /
  • 31. Total import data into RDS database
  • 32. Time taken to migrate the database
  • 33. Optimize the Data Pump Export • Reduce the data set to optimal size, avoid indexes • Use compression and Parallel processing • Use multiple disks with independent IO
  • 34. Optimize Data Upload • • • • Use Tsunami for UDP based file transfer Use large EC2 instance with SSD or PIOPS volume Use multiple disks with independent IO You could use multiple EC2 instances for parallel upload
  • 35. Optimize Data File upload to RDS • Use the largest RDS instance possible during the import process • Avoid using RDS instance for any other load during this time • Provision enough storage in the RDS instance for the uploaded files and imported data
  • 36. Periodic Upload • Oracle Data Pump Network Mode • Oracle Materialized Views • Custom triggers
  • 37. For small data set one time load • Oracle Import/Export • Oracle Data Pump Network Mode • Oracle SQL*Loader • Oracle Materialized Views
  • 39. Importing From a MySQL DB Instance Application DB Application mysqldump Staging area Load data scp Tsunami UDP Staging server Replication AWS Region
  • 40. Importing From a MySQL DB Instance
  • 41. Importing From a MySQL DB Instance
  • 42. Check the size of the master database
  • 44. Create RDS for MySQL and EC2 Create RDS for MySQL using AWS Management Console or CLI PROMPT>rds-create-db-instance mydbinstance -s 1024 -c db.m3.2xlarge -e MySQL - u <masterawsuser> -p <secretpassword> --backup-retention-period 3 Create EC2 (Staging server) using AWS Management Console or CLI aws ec2 run-instances --image-id ami-xxxxxxxx --count 1 --instance-type m3.2xlarge --key-name MyKeyPair --security-groups MySecurityGroup Create Replication User on the Master mysql> GRANT SELECT,REPLICATION USER,REPLICATION CLIENT ON *.* TO repluser@„<RDS Endpoint>' IDENTIFIED BY „<password>';
  • 45. Update /etc/my.cnf on the master server Enable MySQL binlog This enables bin logging which creates a file recording the changes that have occurred on the Master which the Slave uses to replicate the data. [mysqld] server-id = 1 binlog-do-db=mytest relay-log = /var/lib/mysql/mysql-relay-bin relay-log-index = /var/lib/mysql/mysql-relay-bin.index log-error = /var/lib/mysql/mysql.err master-info-file = /var/lib/mysql/mysql-master.info relay-log-info-file = /var/lib/mysql/mysql-relay-log.info log-bin = /var/lib/mysql/mysql-bin
  • 46. Configure the master database Restart the master database after /etc/my.cnf is updated $ sudo /etc/init.d/mysqld start Record the “File” and the “Position” values. $ mysql -h localhost -u root -p mysql> show master statusG *************************** 1. row *************************** File: mysql-bin.000023 Position: 107 Binlog_Do_DB: mytest Binlog_Ignore_DB: 1 row in set (0.00 sec)
  • 47. Upload files to EC2 using UDP • Tar and compress MySQL dump file preparation to ship to EC2 staging server. • Update the EC2 security group to allow UDP connection from the server where the dump files being created to your new mysql client server. • On the EC2 staging instance untar the tar.tgz file.
  • 48. Configure the RDS database Create the database mysql> create database bench; Import the database that you previously exported from the master database. Mysql> load data local infile '/reinvent/tables/customer_address.txt' into table customer_address fields terminated by ','; Mysql> load data local infile '/reinvent/tables/customer.txt' into table customer fields terminated by ','; Configure the slave RDS for MySQL server and start the slave server mysql> call mysql.rds_set_external_master(„<master server>',3306,„<replicationuser>',„<password>','mysql-bin.000013',107,0); mysql> call mysql.rds_start_replication;
  • 49. RDS for MySQL replication status
  • 50. Switch RDS MySQL to the Master Switch-over the RDS for MySQL – Stop the service/application that is pointing at the Master Database – Once all changes have been applied to New RDS Database. Stop replication with “call mysql.rds_stop_replication” – Point the service/application at the New RDS Database. – Once Migration is complete. “call mysql. rds_reset_external_master”
  • 51. Please give us your feedback on this presentation DAT308 As a thank you, we will select prize winners daily for completed surveys!
  • 52. References • • • • • RDS Home Page RDS FAQs RDS Webinars RDS Best Practices Data Import Guides – MySQL – Oracle – SQL Server

Notas del editor

  1. Why did I say Data SET not Database ?
  2. migrate a 150 GB database to RDS MySQL from on-premise MySQL database with greatly reduced downtime using replication. The idea is to restore a fresh backup to RDS MySQL database, turn on replication on the new server after configuring the old server as the Master for the data to be in sync, switch the Slave to become the Master, then point the DNS to the new server all without downtime.
  3. Replication between servers in MySQL is based on the binary logging mechanism. The MySQL instance operating as the master (the source of the database changes) writes updates and changes as “events” to the binary log. The information in the binary log is stored in different logging formats according to the database changes being recorded. Slaves are configured to read the binary log from the master and to execute the events in the binary log on the slave&apos;s local database.
  4. MYSQL.RDS_SET_EXTERNAL_MASTER procedure designates the RDS server as the slave of our master server,It provides the server the correct login credentials, it lets the slave server know where to start replicating from; the master log file and log position come from the numbers we wrote down previously.
  5. AWS console will show replicating. New RDS replication is caught up with the source instanceAt this point you may want to take a user snapshot.