Setting up mysql replication to Amazon RDS


If you want to set up a replication between an RDS and an existing mysql server environment, you might encounter privilege errors, when trying to execute commands like "change master to…" or "stop slave;" on the RDS.

Amazon RDS comes with a bunch of stored procedures that you have to use instead:

MySQL Command Stored Procedure
change master to mysql.rds_set_external_master
start slave mysql.rds_start_replication
stop slave mysql.rds_stop_replication
reset master mysql.rds_reset_external_master

Changing master host example:

CALL mysql.rds_set_external_master ('111.222.333.4', 3306, 'repl-user', 'password', 'master.003063', 951672216, 0);

Whereas master.003063 is an example master log file and 951672216 an example master log position.

Starting your slave:

CALL mysql.rds_start_replication;

Verify that it's running:

SHOW SLAVE STATUS \G;

Stopping / Resetting your slave:

CALL mysql.rds_stop_replication;
CALL mysql.rds_reset_external_master;