Amazon RDS Aurora (MySQL) provides its own low latency replication. Nevertheless, there are cases where it can be beneficial to set up replication from Aurora to an external MySQL server, as Amazon RDS Aurora is based on MySQL and supports native MySQL replication. Here are some examples of when replicating from Amazon RDS Aurora to an external MySQL server can make good sense:
In this blog post I will share simple step by step instructions on how to do it.
|
1 |
Binlog position from crash recovery is mysql-bin-changelog.000708 31278857 |
|
1 |
# mysql_tzinfo_to_sql /usr/share/zoneinfo/|mysql |
|
1 2 3 4 5 6 7 8 9 10 11 |
[mysqld] log-bin=log-bin log-slave-updates binlog-format=MIXED server-id=1000 relay-log=relay-bin innodb_log_file_size=1G innodb_buffer_pool_size=2G innodb_flush_method=O_DIRECT innodb_flush_log_at_trx_commit=0 # as this is replication slave |
|
1 |
pt-show-grants -h myhost...amazonaws.com -u percona > grants.sql |
|
1 |
mysql -f < grants.sql |
|
1 2 3 4 5 |
host="my-snapshot...amazonaws.com" mysqldump --single-transaction -h $host -u percona --triggers --routines --databases `mysql -u percona -h $host -NBe "select group_concat(schema_name separator ' ') from information_schema.schemata where schema_name not in ('mysql', 'information_schema', 'performance_schema')"` > all.sql |
|
1 |
mysql -h localhost < all.sql |
|
1 |
mysql -f < grants.sql |
|
1 2 3 |
# cd /etc/ssl # wget 'https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem' # chown mysql.mysql rds-combined-ca-bundle.pem |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# mysql -h localhost ... mysql> CHANGE MASTER TO MASTER_HOST='dev01-aws-1...', MASTER_USER='awsreplication', MASTER_PASSWORD='<pass>', MASTER_LOG_FILE = 'mysql-bin-changelog.000708', MASTER_LOG_POS = 31278857, MASTER_SSL_CA = '/etc/ssl/rds-combined-ca-bundle.pem', MASTER_SSL_CAPATH = '', MASTER_SSL_VERIFY_SERVER_CERT=1; mysql> start slave; |
I hope those steps will be helpful for setting up an external MySQL replica.
Grow Your Business with an AWS RDS MySQL Environment. This solution brief outlines setting up MySQL Amazon RDS instances to meet your company’s growing needs.
Resources
RELATED POSTS
mysqldump with terabytes of data, how we can optimise it ?
‘@khurram you may want to try mydumper (https://github.com/maxbube/mydumper)
Is Amazon supporting external replicas for all RDS instances or is this just an Aurora thing?
Out of interest do you have a guide to do the reverse of this? On prem MySQL to Aurora?
aws supports restoring xtrabackup backups for mysql 5.6 compatible Aurora, it doesn’t support mysql 5.7 yet.