Amazon RDS for MariaDB
  • 24 Apr 2024
  • 10 Minutes to read
  • Contributors
  • Dark
    Light

Amazon RDS for MariaDB

  • Dark
    Light

Article Summary

This page provides essential information for setting up replications using Amazon RDS for MariaDB as a source or target database for Refresh, Mirroring, and synchronization. The setup process for a refresh replication can usually be completed using Syniti Replicate without additional documentation, as it does not involve access to the MariaDB logs. This page also describes the setup process using either the Log Reader or Log Server Agent options for one-way mirroring and synchronization when replicating data from a MariaDB database.

For mirroring replications using Amazon RDS for MariaDB as a source, Syniti Replicate offers the following approaches:

  • Log Reader: Queries the MariaDB Log directly.

  • Log Server Agent: Uses a Windows service and a Log Server component to query the MariaDB Log for increased performance when dealing with large amounts of data.

  • Triggers: Uses Syniti Replicate triggers installed in the MariaDB database to log changes.

For synchronization replications using Amazon RDS for MariaDB as a source, Syniti Replicate offers the Triggers approach.

Versions Supported

Amazon RDS for MariaDB is supported as source and target systems in Refresh, Mirroring, and Synchronization modes with the following versions:

  • Amazon RDS for MariaDB version 10.4 through 10.6

  • Amazon RDS for MariaDB version 10.11

Prerequisites

  • Ensure that you download the appropriate MySQL .NET Data Provider from MySQL Community Downloads.

    Note

    Log- and trigger-based transactional replications are supported for v 10.4 and later.

  • Ensure that you have the MySql.Data (file name: MySql.Data.dll) assembly in your path name. For example, C:\MySQL\Connector-net-5.0.3\Driver\bin\net2.0\release\MySql.Data.dll

  • MariaDB Log-based Replications: If you are planning to set up replications using the MariaDB (MySQL) binary log, contact Syniti Support to obtain an additional component (DBMySqlUtil.zip). Ensure that you state whether you are using the 32-bit or 64-bit version of Syniti Replicate.

    Note

    When you receive the .zip file, unzip it and place the contents in the Syniti Replicate installation folder (usually C:\Program Files\Syniti\Data Replication) .

User Permissions

When setting up replications that use Amazon RDS for MariaDB as either a source or target database, you need to ensure that the User ID used for establishing connections to the database has sufficient privileges to complete all the operations required for Syniti Replicate to perform a replication.

This section is organized by the type of replication you want to perform. It describes all the user authorities that will be required during the setup and execution of replications.

Refresh with Amazon RDS for MariaDB as Either Source or Target Database

Permission

Description

Command Syntax

Sample Command

Authorize to Connect the Database

This permission must be granted already when the user is created. However, if the user is not authorized to establish a connection, you can use the below command to create a new user and granting basic privileges. Privileges must be assigned to both the local host and the percent character (%) is used to give access remotely from any client machine. For more information, refer to MySQL Documentation.

The FLUSH PRIVILEGES command make the changes immediately available without restarting the MySQL service.

USE <SCHEMA>;
 GRANT USAGE ON *.* TO '<UID>'@'localhost' IDENTIFIED BY '<PWD>';
 GRANT USAGE ON *.* TO '<UID>'@'%' IDENTIFIED BY '<PWD>';
 FLUSH PRIVILEGES;

USE mysql;
 GRANT USAGE ON *.* TO 'sdruser'@'localhost' IDENTIFIED BY 'sdruser';
 GRANT USAGE ON *.* TO 'sdruser'@'%' IDENTIFIED BY 'sdruser';
 FLUSH PRIVILEGES;

where sdruser is the User ID and mysql is the schema.

Authorize to Select Catalog

No additional permissions required.

Not applicable

Not applicable

Authorize to Select Tables

Required for schemas other than the one for which the CONNECT_DB permission has been granted (the user has the Read permission already).

GRANT SELECT ON <SCHEMA>.<TABLE> TO '<UID>'@'localhost';
 GRANT SELECT ON <SCHEMA>.<TABLE> TO '<UID>'@'%';
 FLUSH PRIVILEGES;

GRANT SELECT ON mysql.Table1 TO 'sdruser'@'localhost';
 GRANT SELECT ON mysql.Table1 TO 'sdruser'@'%';
 FLUSH PRIVILEGES;

where sdruser is the User ID and mysql is the schema.

Authorize to Create Tables

To create a target table in the Management Center (as part of the Create Table Wizard), Syniti Replicate requires permissions to modify the database schema. MySQL allows you to grant privileges even on database objects that do not exist. In such cases, the privileges to be granted must include the CREATE privilege.

This behavior is designed to enable the database administrator to prepare user accounts and privileges for database objects that are to be created at a later time. For more information. refer to MySQL: Grant Statement.

GRANT CREATE ON <SCHEMA>.<TABLE> TO '<UID>'@'localhost';
 GRANT CREATE ON <SCHEMA>.<TABLE> TO '<UID>'@'%';
 FLUSH PRIVILEGES;

Alternatively, you can run the following command using the asterisk (*) wildcard:

GRANT CREATE ON <SCHEMA>.* TO '<UID>'@'localhost';
 GRANT CREATE ON <SCHEMA>.* TO '<UID>'@'%';
 FLUSH PRIVILEGES;

GRANT CREATE ON mysql.Table1 TO 'sdruser'@'localhost';
 GRANT CREATE ON mysql.Table1.* TO 'sdruser'@'%';
 FLUSH PRIVILEGES;

where sdruser is the User ID and mysql is the schema.

Authorize to Update Tables

To create a target table in the Management Center (as part of the Create Table Wizard), Syniti Replicate requires write permissions to the database. This command is needed for schemas other than the one on which the CONNECT_DB permission has been granted (where the user has the Write permission already).

GRANT INSERT, UPDATE, DELETE ON <SCHEMA>.<TABLE> TO '<UID>'@'localhost';
 GRANT INSERT, UPDATE, DELETE ON <SCHEMA>.<TABLE> TO '<UID>'@'%';
 FLUSH PRIVILEGES;

GRANT INSERT, UPDATE, DELETE ON mysql.Table1 TO 'sdruser'@'localhost';
 GRANT INSERT, UPDATE, DELETE ON mysql.Table1 TO 'sdruser'@'%';
 FLUSH PRIVILEGES;

where sdruser is the User ID and mysql is the schema.

Authorize to Drop or Alter Tables (Optional)

The use of these commands in Syniti Replicate is entirely optional (not necessary for running a refresh replication).

They are used if you choose to remove a table from MySQL or change the table via the Management Center SQL Query tab. This syntax can be used for schemas other than the one for which the CONNECT_DB permission has been granted (where the user has the Drop Table permission already).

GRANT DROP ON <SCHEMA>.<TABLE> TO '<UID>'@'localhost';
 GRANT DROP ON <SCHEMA>.<TABLE> TO '<UID>'@'%';
 FLUSH PRIVILEGES;

GRANT DROP ON mysql.Table1 TO 'sdruser'@'localhost';
 GRANT DROP ON mysql.Table1 TO 'sdruser'@'%';
 FLUSH PRIVILEGES;

where sdruser is the User ID and mysql is the schema.

Transactional Replications or Refresh with MariaDB as Either Source or Target Database

This section includes information for Mirroring, where MariaDB (MySQL) is the Source data source, and for synchronization, where MariaDB can be either the Source or Target data source.

Important

Complete the authorizations mentioned in the above table before you perform the below authorization.

Authorize to Set Up Transactional Replications and Access Log

For transactional replications using triggers, the following authorities are needed:

  • Read-Write access

  • Create and Drop access to _dbm__trg_objs and _dbm__masterlog

  • Read-Write access to the single log files

Authority is needed for schemas other than the one for which CONNECT_DB permission has been granted (where the user has already all authorities). Log files do not have a fixed name but are generated during execution. Therefore, the authority needs to be granted on a schema level. Notice that the last GRANT command also covers the GRANT assigned to the _dbm__trg_objs and to _dbm__masterlog tables. <SCHEMA> in all cases below should be the schema where the master table is defined.

Command Syntax

GRANT SELECT, INSERT, UPDATE, DELETE ON <SCHEMA>._dbm__trg_objs TO '<UID>'@'localhost';
GRANT SELECT, INSERT, UPDATE, DELETE ON <SCHEMA>._dbm__trg_objs TO '<UID>'@'%';
GRANT SELECT, INSERT, UPDATE, DELETE ON <SCHEMA>._dbm__masterlog TO '<UID>'@'localhost';
GRANT SELECT, INSERT, UPDATE, DELETE ON <SCHEMA>._dbm__masterlog TO '<UID>'@'%';
GRANT SELECT, INSERT, UPDATE, DELETE ON <SCHEMA>.* TO '<UID>'@'localhost';
GRANT SELECT, INSERT, UPDATE, DELETE ON <SCHEMA>.* TO '<UID>'@'%';
FLUSH PRIVILEGES;

For MySQL versions 5.1.6 and above, trigger-based replications, you need to execute the following command along with the above commands:

GRANT TRIGGER ON <SCHEMA>.* TO '<UID>'@'%';
FLUSH PRIVILEGES;

For transactional replications using the MySQL binary log, you need to grant REPLICATION SLAVE privilege to the Syniti Replicate MySQL user ID that will connect to the database.

GRANT SELECT, PROCESS, REPLICATION CLIENT, REPLICATION SLAVE, RELOAD ON *.* TO '<UID>'@'%';
FLUSH PRIVILEGES;

Note

If using MySQL versions 5.5 and earlier, you also need to grant the following privileges: FILE, SUPER

GRANT SELECT, PROCESS, FILE, SUPER, REPLICATION CLIENT, REPLICATION SLAVE, RELOAD ON *.* TO sdruser@'%';
FLUSH PRIVILEGES;

Amazon RDS for MariaDB System Settings

If you are using MariaDB version 10.4 or above as your source database for Mirroring via the MariaDB binary log, you need to configure MariaDB so that Syniti Replicate can read the database's binary log. Follow the instructions provided on AmazonRDS Help for configuring MariaDB binary logging.

To configure the system settings:

  1. Create a Parameter Group dedicated to replication.

  2. Set the Parameter Group to binarylog_format=row.

  3. Save your changes.

    Note

    binlog_format parameter is dynamic; you don't need to reboot the DB instance for the changes to apply.

Add Source Connection Wizard

Select Provider Screen

  1. Select RDS for MySQL as the database from the list.

  2. The MySQL .NET Driver value is provided automatically. You do not need to change this value.

  3. The pathname to the .NET Assembly MySql.Data.dll. If the value is not available, Syniti Replicate displays a message when you continue in the Source Connection wizard, allowing you to go back and enter the path.

    • Search the location of the assembly in your environment by searching for the file name, and then enter the path and the assembly file name.

Connection Properties - Required Information

Property

Description

Data Source

The name of network address of the instance of RDS for MariaDB to connect

User ID

Database User ID

Password

User password

Connection Properties - Optional Information

Property

Description

Database

The name of the database to use initially.

Connect Timeout

The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error.

Protocol

Specifies the type of connection to make to the server. Values can be socket or tcp for a socket connection, pipe for a named pipe connection, unix for a Unix socket connection, or memory to use MySQL shared memory.

Port

The MySQL port is used to listen for connections. Specify -1 for this value to use a named pipe connection (windows only). This value is ignored if Unix socket is used.

Shared Memory Name

The name of the shared memory object to use for communication if the connection protocol is set to memory.

Pipe Name

When set to the name of a named pipe, the MySqlConnection will attempt to connect to MySQL on that name pipe.

Character Set

Specifies the character set that should be used to encode all queries sent to the server. Resultsets are still returned in the character set of the data returned.

Logging

When True, various pieces of information is output to any configured TraceListener.

Allow Batch

When True, multiple SQL statements can be set with one command execution.

Allow Zero Datetime

True to have MySqlDataReader.Getvalue() return a MySqlDateTime for date or datetime columns that have illegal values.

False will cause a DataTime object to be returned for legal values and an exception will be thrown for illegal values.

Covert Zero Datetime

True to have MySqlDataReader.Getvalue() and MySqlDataReader.GetDataTime() return DateTime.MinValue for date or datetime columns that have disallowed values. For this property to be effective you need Allow Zero Datetime property set to True as well.

AllowLoadLocalInfile

If set to True, the server permits local data loading by clients that request local data loading (used in Syniti Replicate during bulk operations).

If set to False, the refresh bulk and the mirroring bulk operations using this connection as target will not be allowed.

Connection Lifetime

When a connection is returned to the pool, its creation time is compared with the current time, and the connection is destroyed if that time span (in seconds) exceeds the values specified by Connection Lifetime. This is useful in clustered configurations to force load balancing between a running server and a server just brought online. A value of zero (0) causes pooled connections to have the maximum connection timeout.

Pooling

When True, the SQLConnection object is drawn from the appropriate pool, or if necessary, is created and added to appropriate pool.

Max Pool Size

The maximum number of connections allowed in the pool.

Min Pool Size

The minimum number of connections allowed in the pool.

ExtendedProperties

Additional properties no listed in the grid. Enter the properties as a list of "property = value" string separated by (;).

Enable Transactional Replication Wizard

For transactional replications (mirroring and synchronization), use the Enable Transactional Replication wizard after setting up a source connection. The following fields require specific information for MySQL:

  • Log Type Screen: Select whether you plan to perform replications using the Log Reader (default) or Log Server Agent.

  • Log Settings Screen: Select the Case Sensitive Table Names option to manage databases with case-sensitive table names.

Limitations

  • Data Masking is not supported for this database in Syniti Replicate.

  • Databases, schemas, and tables names containing special characters like slash (/) or backslash (\) are not supported.

Data Type Mapping

When Amazon RDS for MariaDB is used as a target system, the mapping of Syniti Replicate data types to the corresponding data type in Amazon RDS for MariaDB is listed in the following table:

Syniti ReplicateMapping

Amazon RDS for MariaDB

Bit

bit

Smallint

smallint, tinyint, year

Tinyint

tinyint

Integer

int, integer, mediumint

Bigint

bigint

Float

float

Double

double, double precision

Real

real

Numeric

numeric

Decimal

decimal

Char

char, enum

Varchar

varchar, tinytext, set

LongVarchar

text, mediumtext

Clob

longtext

Varbinary maxVersion="4.0001.0001"

tinyblob

Varbinary

varbinary, tinyblob

Binary maxVersion="4.0001.0001"

tinyblob

Binary

binary, tinyblob

LongVarbinary

blob, mediumblob

Blob

longblob

Date

date

Time

time

Smalldatetime

datetime

Timestamp

datetime, timestamp

AutoDecimal

double

AutoNumeric

double

AutoTinyint

tinyint

AutoInteger

int

AutoSmallint

smallint

NChar

char

NVarchar

varchar

NText

longtext

Sysname

varchar(128)

Money

double

Smallmoney

decimal(10,2)

GUID

varchar(40)

Number

double

TimestampZ

timestamp

TimeInterval

datetime

Set

varchar(1024)

Xml

longtext

Json maxVersion="5.0007.0007"

longtext

Json minVersion="5.0007.0008"

json

Further Resources


Was this article helpful?