Configure an Amazon RDS MySQL database for CDC Stay organized with collections Save and categorize content based on your preferences.
This page describes how to configure change data capture (CDC) tostream data from an Amazon RDS for MySQL database to asupported destination,such as BigQuery or Cloud Storage.
Create a parameter group
Launch your Amazon RDS Dashboard.
In theNavigation Drawer, clickParameter Groups.
ClickCreate Parameter Group. TheCreate Parameter Group page appears.
Select the database family that matches your database, provide a name anddescription for the parameter group.
ClickCreate.
Select the checkbox to the left of your newly created parameter group.
UnderParameter group actions, clickEdit.
Use the following table to set the parameters for your group.
Forbinlog-based replication:
Parameter Value binlog_format ROWlog_bin_use_v1_row_events 1read_only 0net_read_timeout 3600net_write_timeout 3600wait_timeout 86400ForGTID-based replication:
Parameter Value binlog_format ROWlog_bin_use_v1_row_events 1read_only 0net_read_timeout 3600net_write_timeout 3600wait_timeout 86400expire-logs-days 7binlog_row_image FULLmax_allowed_packet 1G(recommended value)log-replica-updates 1enforce-gtid-consistency ONgtid_mode
You can only set thisparameter toONONafter you setenforce-gtid-consistencytoON. In general,gtid_modecan have the followingvalues:OFFOFF_PERMISSIVEON_PERMISSIVEON
gtid_modeparameter onestep at a time. For example, if the current mode is set toOFF,do the following:- Change the setting to
OFF_PERMISSIVE. - Change the setting to
ON_PERMISSIVE. - Change the setting to
ON.
ClickSave Changes.
Create a read replica
Although this is an optional step, we highly recommend using a read replica because it significantly decreases the load of replication on your MySQL database. If you choose to replicate directly from the main server, then proceed to the instructions inConfigure the source database and the read replica.
Launch your Amazon RDS Dashboard.
In theNavigation Drawer, clickDatabases.
Select the main database instance to which you want Datastream toconnect.
Expand theActions button, and then clickCreate read replica.
Configure the read replica, as necessary.
ClickCreate read replica.
Configure the source database and the read replica
If you chose to replicate directly from the main server, configure the sourcedatabase using the steps that follow.
If you chose to use a read replica, configure both the source database and theread replica using the steps that follow.
Launch your Amazon RDS Dashboard.
In theNavigation Drawer, clickDatabases.
Select the instance that you want to configure and then clickModify.
Go to theAdditional configuration section.
Select the parameter group that youcreated.
Set theBackup retention period to7 days.
ClickContinue.
UnderScheduling of modifications, selectApply immediately.
Wait until the changes to your parameter group are appliedbefore proceeding.
Verify that the parameter group is assigned to the database instance
Launch your Amazon RDS Dashboard.
In theNavigation Drawer, clickDatabases, and then select yourdatabase instance.
Click theConfigurations tab.
Verify that you see the parameter group that youcreated,and that its status ispending-reboot.
Reboot your database instance to complete the configuration. To reboot theinstance:
- In theNavigation Drawer, clickInstances.
- Select your database instance.
- From theInstance Actions menu, selectReboot.
Set the binary log retention period
Enter the following MySQL command:
You're entering this command because you want to ensureproper replication by configuring your system to retain binary logs for aminimum of 7 days (or 168 hours).callmysql.rds_set_configuration('binlog retention hours',168);
Restart your MySQL server so that the changes you made can take effect.
Create a Datastream user
Create a Datastream user:
CREATEUSER'datastream'@'%'IDENTIFIEDBY'YOUR_PASSWORD';
Grant the following privileges to them:
GRANTREPLICATIONSLAVE,SELECT,REPLICATIONCLIENTON*.*TO'datastream'@'%';GRANTEXECUTEONPROCEDUREmysql.rds_show_configurationTO'datastream'@'%';FLUSHPRIVILEGES;
What's next
- Learn more about how Datastream works withMySQL sources.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.