Skip to contentManaged Kafka is live: Apache Kafka on AWS for half the cost of MSK

Sources

Connect MariaDB as a source

Create a MariaDB service account, turn on row-based binary logging, and connect the database in Artie so your pipeline replicates its changes.

Artie connects to MariaDB with its MySQL connector. The connector detects MariaDB from the server version and switches to MariaDB’s binlog and GTID handling, so the dashboard has no MariaDB-specific settings.

Prerequisites

  • MariaDB 10.6, 10.11 or 11. Amazon RDS for MariaDB uses the same setup.
  • The host and port of the MariaDB server
  • A database admin user to run the setup SQL
  • A database restart, if binary logging is off
  • At least 24 hours of binlog retention

Set up MariaDB

These three steps prepare the MariaDB server that Artie connects to.

1. Create a service account

Run this SQL on your MariaDB server to create the user Artie signs in with:

setup.sql
CREATE USER 'artie' IDENTIFIED BY 'YOUR_PASSWORD';
-- SELECT is required for backfills.
-- REPLICATION CLIENT and REPLICATION SLAVE are required for Artie to read the binary log.
GRANT SELECT, REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO 'artie';

Replace YOUR_PASSWORD with the password for this user.

On MariaDB 10.5.2 and later, REPLICATION CLIENT is an alias for BINLOG MONITOR, so the same statement works on every supported version.

2. Enable binary logging in ROW format

Artie reads row-level changes from the binary log, so binlog_format must be ROW.

  1. Create a parameter group

    In the AWS console, go to RDS > Parameter groups > Create parameter group. Select the MariaDB family that matches your version.

  2. Set binlog_format to ROW

    Open the new parameter group, search for binlog_format, and set it to ROW.

  3. Apply the parameter group

    Associate the parameter group with your RDS instance, then reboot the database for the change to take effect.

RDS only writes binary logs when automated backups are enabled. Set the backup retention period to a value greater than 0.

Check the result on your MariaDB server:

SQL
SHOW VARIABLES LIKE 'log_bin';
SHOW VARIABLES LIKE 'binlog_format';
SHOW MASTER STATUS;

log_bin is ON, binlog_format is ROW, and SHOW MASTER STATUS returns the current binlog file and position.

3. Set binlog retention

Keep binary logs for at least 24 hours. If MariaDB purges a binlog before Artie reads it, Artie can’t resume from where it stopped. Without gtid_strict_mode, Artie restarts from the oldest binlog left and skips the changes in between. To recover them, backfill the affected tables.

Set the retention to 24 hours:

SQL
CALL mysql.rds_set_configuration('binlog retention hours', 24);

Add MariaDB in Artie

Complete these steps in the pipeline setup flow in the Artie dashboard.

  1. Choose MySQL

    On Choose your source, select MySQL, then select Continue. The source list has no MariaDB entry.

  2. Choose a network method

    On How would you like to connect your source?, select Allowlist Artie IPs, SSH tunnel or PrivateLink.

    PrivateLink needs an Enterprise plan. Connection options describes each method.

  3. Confirm the database changes

    On Prepare MySQL, set Hosting provider to Amazon Aurora / RDS for Amazon RDS, or Self-hosted / other. The list has no MariaDB option.

    The step shows the service account SQL. For Amazon Aurora / RDS, it adds the rds_set_configuration call for binlog retention. Select Continue.

  4. Enter the host and port

    On Connect MySQL, enter your MariaDB Host and Port. The port defaults to 3306.

  5. Enter the service account

    Keep Authentication method set to Static credentials, then enter the User and Password of your service account.

  6. Select a TLS mode

    In TLS mode, select Disabled, TLS (preferred) or TLS (required). The default is Disabled.

    TLS (preferred) uses TLS when the server offers it and falls back to an unencrypted connection.

Artie creates a MySQL connector, so the dashboard lists this source as MySQL.

Verify the connection

On Connect MySQL, select Verify source. Artie checks that it can reach the server and sign in. The step shows Source verified, and the button changes to Continue.

If the check fails, the step shows Couldn’t verify source and the button reads Try again. To continue without the check, select Verify later.

Artie checks the binary log and the service account’s grants on the next step, Which tables do you want to stream? Select your tables, then select Verify selected tables. The step shows Tables verified.

Optional settings

A pipeline replicates without either of these settings.

Resume replication from GTIDs

Without gtid_strict_mode, Artie resumes MariaDB replication from a binlog file and position. With it on, Artie resumes from global transaction IDs (GTIDs) instead.

MariaDB writes GTIDs to the binary log by default. Artie uses them only with strict mode on, because strict mode guarantees that sequence numbers only increase within each replication domain.

Turn on strict mode:

SQL
SET GLOBAL gtid_strict_mode = ON;

Add gtid_strict_mode = ON to your configuration file as well. On Amazon RDS, set it in the parameter group.

Check both settings:

SQL
SHOW VARIABLES LIKE 'gtid_strict_mode';
SELECT @@gtid_binlog_pos;

gtid_strict_mode is ON and gtid_binlog_pos is not empty.

Artie detects strict mode on its next restart and switches to GTID-based replication. The dashboard has no setting for it.

Replicate from a read replica

To stream changes from a replica, enter the replica as the Host on Connect MySQL. Artie reads the replica’s own binary log, never its relay log. The replica must write the changes it replicates to that binary log.

Configure the replica with these settings:

  • log_bin enabled
  • binlog_format = ROW
  • log_slave_updates = ON
  • A healthy replication connection
  • At least 24 hours of local binlog retention

Run these queries on the replica to check its configuration:

SQL
SHOW VARIABLES WHERE variable_name IN ('log_bin', 'binlog_format', 'log_slave_updates');
SHOW SLAVE STATUS;
SHOW BINARY LOGS;

When Host is a replica, Verify selected tables checks that both replication threads are running with no error and that log_slave_updates is ON.

To keep change capture on the primary and read only backfills from a replica, turn on Use a read replica for backfill? on Connect MySQL. Then enter the Replica host and Replica port. Change capture still reads the primary’s binary log, so the replica settings in this section apply only when the replica is the Host.

Troubleshooting

Verify selected tables on Which tables do you want to stream? reports these errors when a setup step on the MariaDB server is incomplete. Verify source doesn’t check for them.

Binary logging is off

Verify selected tables shows this message:

Text
Binary logging is off. Self-hosted MySQL: set log_bin. RDS: set backup retention above 0. Aurora: set binlog_format to ROW on the writer. Cloud SQL: turn on point-in-time recovery.

Cause: SHOW MASTER STATUS returns no rows, because the MariaDB server writes no binary log.

Fix: On self-hosted MariaDB, set log_bin and restart the server. On Amazon RDS for MariaDB, set the backup retention period to a value greater than 0. Both are in Enable binary logging in ROW format.

Verify: Select Try again. The step shows Tables verified.

binlog_format must be set to ROW

Verify selected tables shows Couldn’t verify tables. Your database returned an error. See its message under Details. Under Details, the error reads:

Text
binlog_format must be set to 'ROW', current value is "MIXED"

If you selected Verify later, the pipeline fails to start replication with this error instead:

Text
'binlog_format' must be set to 'ROW', current value is 'MIXED'

Cause: The MariaDB server’s binlog_format is MIXED or STATEMENT. Artie checks the value before it reads the binary log.

Fix: Set binlog_format to ROW, as in Enable binary logging in ROW format.

Verify: SHOW VARIABLES LIKE 'binlog_format'; returns ROW.

The Artie user needs REPLICATION CLIENT and REPLICATION SLAVE

Verify selected tables shows this message:

Text
The Artie user needs REPLICATION CLIENT and REPLICATION SLAVE. Grant both as shown in Prepare source.

Cause: MariaDB denied access when Artie read the binlog position. The denial names REPLICATION CLIENT, REPLICATION SLAVE or BINLOG MONITOR.

Fix: Run the GRANT statement from Create a service account for your Artie user.

Verify: Select Try again. The step shows Tables verified.

Next steps

  • MySQL source setup covers the connector that MariaDB sources run on.
  • Connection options lists Artie’s IP addresses and covers SSH tunnels and PrivateLink.
  • Tables describes the table settings for your pipeline.

Was this page helpful?