Using a MySQL compatible database as a source for homogeneous data migrations in Amazon DMS
You can use a MySQL-compatible database (MySQL or MariaDB) as a source for Homogeneous data migrations in Amazon DMS. In this case, your source data provider can be an on-premises, Amazon EC2, or RDS for MySQL or MariaDB database.
To run homogeneous data migrations, you must use a database user with the SELECT
privileges for the all source tables and secondary objects for replication.
For change data capture (CDC) tasks, this user must also have the REPLICATION CLIENT
(BINLOG MONITOR
for MariaDB versions later than 10.5.2)
and REPLICATION SLAVE
privileges. For a full load data migration, you don't need these
two privileges.
Use the following script to create a database user with the required permissions in your
MySQL database. Run the GRANT
queries for all databases that you migrate to Amazon.
CREATE USER '
your_user
'@'%' IDENTIFIED BY 'your_password
'; GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'your_user
'@'%'; GRANT SELECT, RELOAD, LOCK TABLES, SHOW VIEW, EVENT, TRIGGER ON *.* TO 'your_user
'@'%'; GRANT BACKUP_ADMIN ON *.* TO 'your_user
'@'%';
In the preceding example, replace each user input placeholder
with your own information. If your source MySQL database version is lower than 8.0, then you
can skip the GRANT BACKUP_ADMIN
command.
Use the following script to create a database user with the required permissions in your MariaDB database. Run the GRANT queries for all databases that you migrate to Amazon.
CREATE USER '
your_user
'@'%' IDENTIFIED BY 'your_password
'; GRANT SELECT, RELOAD, LOCK TABLES, REPLICATION SLAVE, BINLOG MONITOR, SHOW VIEW ON *.* TO 'your_user'@'%';
In the preceding example, replace each user input placeholder
with your own information.
The following sections describe specific configuration prerequisites for self-managed and Amazon-managed MySQL databases.
Topics
Using a self-managed MySQL compatible database as a source for homogeneous data migrations
This section describes how to configure your MySQL compatible databases that are hosted on-premises or on Amazon EC2 instances.
Check the version of your source MySQL or MariaDB database. Make sure that Amazon DMS supports your source MySQL or MariaDB database version as described in Sources for DMS homogeneous data migrations.
To use CDC, make sure to enable binary logging. To enable binary logging, configure the
following parameters in the my.ini
(Windows) or
my.cnf
(UNIX) file of your MySQL or MariaDB database.
Parameter |
Value |
---|---|
|
Set this parameter to a value of 1 or greater. |
|
Set the path to the binary log file, such as
|
|
Set this parameter to |
|
Set this parameter to a value of 1 or greater. To prevent overuse of disk space, we recommend that you don't use the default value of 0. |
|
Set this parameter to |
|
Set this parameter to |
|
Set this parameter to |
Using an Amazon-managed MySQL compatible database as a source for homogeneous data migrations in Amazon DMS
This section describes how to configure your Amazon RDS for MySQL and Amazon RDS for MariaDB database instances.
When you use an Amazon-managed MySQL or MariaDB database as a source for homogeneous data migrations in Amazon DMS, make sure that you have the following prerequisites for CDC:
-
To enable binary logs for RDS for MySQL and MariaDB, enable automatic backups at the instance level. To enable binary logs for an Aurora MySQL cluster, change the variable
binlog_format
in the parameter group. You don't need to enable automatic backups for an Aurora MySQL cluster.Next, set the
binlog_format
parameter toROW
.For more information about setting up automatic backups, see Enabling automated backups in the Amazon RDS User Guide.
For more information about setting up binary logging for an Amazon RDS for MySQL or MariaDB database, see Setting the binary logging format in the Amazon RDS User Guide.
For more information about setting up binary logging for an Aurora MySQL cluster, see How do I turn on binary logging for my Amazon Aurora MySQL cluster?
. -
Ensure that the binary logs are available to Amazon DMS. Because Amazon-managed MySQL and MariaDB databases purge the binary logs as soon as possible, you should increase the length of time that the logs remain available. For example, to increase log retention to 24 hours, run the following command.
call mysql.rds_set_configuration('binlog retention hours', 24);
-
Set the
binlog_row_image
parameter toFull
. -
Set the
binlog_checksum
parameter toNONE
. -
If you are using an Amazon RDS MySQL or MariaDB replica as a source, enable backups on the read replica, and ensure the
log_slave_updates
parameter is set toTRUE
.
Limitations for using a MySQL compatible database as a source for homogeneous data migrations
The following limitations apply when using a MySQL compatible database as a source for homogeneous data migrations:
MariaDB objects such as sequences are not supported in homogeneous migration tasks.
Migration from MariaDB to Amazon RDS MySQL/Aurora MySQL might fail due to incompatible object differences.
The username you use to connect to your data source has the following limitations:
Can be 2 to 64 characters in length.
Can't have spaces.
Can include the following characters: a-z, A-Z, 0-9, underscore (_).
Must start with a-z or A-Z.
The password you use to connect to your data source has the following limitations:
Can be 1 to 128 characters in length.
Can't contain any of the following: single quote ('), double quote ("), semicolon (;) or space.
Amazon DMS homogeneous data migrations creates unencrypted MySQL and MariaDB objects on the target Amazon RDS instances even if the source objects were encrypted. RDS for MySQL doesn't support the MySQL keyring_aws Amazon Keyring Plugin required for encrypted objects. Refer to the MySQL Keyring Plugin not supported documentation in the Amazon RDS User Guide