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 |
[mysqld]<br>log-bin=log-bin<br>log-slave-updates<br>binlog-format=MIXED<br>server-id=1000<br>relay-log=relay-bin<br><br>innodb_log_file_size=1G<br>innodb_buffer_pool_size=2G<br>innodb_flush_method=O_DIRECT<br>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 |
host="my-snapshot...amazonaws.com"<br>mysqldump --single-transaction -h $host -u percona <br>--triggers --routines <br>--databases `mysql -u percona -h $host -NBe <br>"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 |
# cd /etc/ssl<br># wget 'https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem'<br># chown mysql.mysql rds-combined-ca-bundle.pem |
|
1 |
# mysql -h localhost<br><br>...<br><br>mysql> CHANGE MASTER TO<br>MASTER_HOST='dev01-aws-1...',<br>MASTER_USER='awsreplication',<br>MASTER_PASSWORD='<pass>',<br>MASTER_LOG_FILE = 'mysql-bin-changelog.000708',<br>MASTER_LOG_POS = 31278857,<br>MASTER_SSL_CA = '/etc/ssl/rds-combined-ca-bundle.pem',<br>MASTER_SSL_CAPATH = '',<br>MASTER_SSL_VERIFY_SERVER_CERT=1;<br><br>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