Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Les sections suivantes expliquent comment configurer la capture des données modifiées pour une base de données Amazon RDS pour MySQL.
Créer un groupe de paramètres
Lancez votre tableau de bord Amazon RDS.
Dans le panneau de navigation, cliquez sur Groupes de paramètres.
Cliquez sur Créer un groupe de paramètres. La page Créer un groupe de paramètres s'affiche.
Sélectionnez la famille de base de données qui correspond à votre base de données, saisissez un nom et une description pour le groupe de paramètres.
Cliquez sur Créer.
Cochez la case à gauche du groupe de paramètres que vous venez de créer.
Sous Actions associées au groupe de paramètres, cliquez sur Modifier.
Définissez les paramètres du groupe à l'aide de la table suivante.
Pour la réplication basée sur le binlog:
Paramètre
Valeur
binlog_format
ROW
log_bin_use_v1_row_events
1
read_only
0
net_read_timeout
3600
net_write_timeout
3600
wait_timeout
86400
Pour la réplication basée sur GTID:
Paramètre
Valeur
binlog_format
ROW
log_bin_use_v1_row_events
1
read_only
0
net_read_timeout
3600
net_write_timeout
3600
wait_timeout
86400
expire-logs-days
7
binlog_row_image
FULL
max_allowed_packet
1G (valeur recommandée)
log-replica-updates
1
enforce-gtid-consistency
ON
gtid_mode
ON
Vous ne pouvez définir ce paramètre sur ON qu'après avoir défini enforce-gtid-consistency sur ON. En règle générale, gtid_mode peut avoir les valeurs suivantes :
OFF
OFF_PERMISSIVE
ON_PERMISSIVE
ON
Vous ne pouvez modifier les valeurs du paramètre gtid_mode qu'une étape à la fois. Par exemple, si le mode actuel est défini sur OFF, procédez comme suit :
Découvrez comment Datastream fonctionne avec les sources MySQL.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eThis guide explains how to configure Change Data Capture (CDC) for an Amazon RDS for MySQL database, involving creating a parameter group and a read replica.\u003c/p\u003e\n"],["\u003cp\u003eConfiguring the parameter group requires setting specific values for binlog format, timeouts, and other parameters, with options for both binlog-based and GTID-based replication, and ensuring the correct settings are applied.\u003c/p\u003e\n"],["\u003cp\u003eCreating and using a read replica is highly recommended to reduce the replication load on the main database, and after its creation, the read replica's parameter group and backup retention period should be configured.\u003c/p\u003e\n"],["\u003cp\u003eAfter assigning the parameter group to the database instance and verifying its status, a reboot is required for the changes to take effect, with a status update to \u003ccode\u003ein-sync\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe process also involves setting the binary log retention period to a minimum of 7 days (168 hours) and creating a Datastream user with the necessary privileges for replication and data access.\u003c/p\u003e\n"]]],[],null,["# Configure an Amazon RDS MySQL database\n\nThe following sections cover how to configure CDC for an Amazon RDS for MySQL\ndatabase.\n\nCreate a parameter group\n------------------------\n\n1. Launch your Amazon RDS Dashboard.\n\n2. In the **Navigation Drawer** , click **Parameter Groups**.\n\n3. Click **Create Parameter Group** . The **Create Parameter Group** page appears.\n\n4. Select the database family that matches your database, provide a name and\n description for the parameter group.\n\n5. Click **Create**.\n\n6. Select the checkbox to the left of your newly created parameter group.\n\n7. Under **Parameter group actions** , click **Edit**.\n\n8. Use the following table to set the parameters for your group.\n\n - For **binlog-based** replication:\n\n - For **GTID-based** replication:\n\n9. Click **Save Changes**.\n\nCreate a read replica\n---------------------\n\n\u003cbr /\u003e\n\n| Although this is officially an optional step, we\n| highly recommend using a read replica because it will lessen the load of\n| replication on your MySQL database significantly.\n|\n| If you choose to replicate directly from the main server, then follow the\n| instructions in [Configure the read\n| replica (or source database)](#configure-the-read-replica-rds).\n\n\u003cbr /\u003e\n\n1. Launch your Amazon RDS Dashboard.\n\n2. In the **Navigation Drawer** , click **Databases**.\n\n3. Select the main database instance to which you want Datastream to\n connect.\n\n4. Expand the **Actions** button, and then click **Create read replica**.\n\n5. Configure the read replica, as necessary.\n\n6. Click **Create read replica**.\n\nConfigure the read replica (or source database)\n-----------------------------------------------\n\n1. Launch your Amazon RDS Dashboard.\n\n2. In the **Navigation Drawer** , click **Databases**.\n\n3. Select the read replica that you [created](#create-a-read-replica-rds), and\n then click **Modify**.\n\n4. Go to the **Additional configuration** section.\n\n5. Select the parameter group that you [created](/datastream/docs/create-a-parameter-group-rds).\n\n6. Set the **Backup retention period** to **7 days**.\n\n7. Click **Continue**.\n\n8. Under **Scheduling of modifications** , select **Apply immediately**.\n\n | Because you modified your read replica, you must wait until the changes to your parameter group are applied before proceeding.\n\nVerify that the parameter group is assigned to the database instance\n--------------------------------------------------------------------\n\n1. Launch your Amazon RDS Dashboard.\n\n2. In the **Navigation Drawer** , click **Databases**, and then select your\n database instance.\n\n3. Click the **Configurations** tab.\n\n4. Verify that you see the parameter group that you [created](#create-a-parameter-group-rds),\n and that its status is **pending-reboot**.\n\n5. Reboot your database instance to complete the configuration. To reboot the\n instance:\n\n 1. In the **Navigation Drawer** , click **Instances**.\n 2. Select your database instance.\n 3. From the **Instance Actions** menu, select **Reboot**.\n\n | After you reboot your database instance, its status changes to \\*\\*in-sync\\*\\*.\n\nSet the binary log retention period\n-----------------------------------\n\n1. Enter the following MySQL command:\n\n ```sql\n call mysql.rds_set_configuration('binlog retention hours', 168);\n ```\n | You're entering this command because you want to ensure proper replication by configuring your system to retain binary logs for a minimum of 7 days (or 168 hours).\n2. Restart your MySQL server so that the changes you made can take effect.\n\nCreate a Datastream user\n------------------------\n\n1. Create a Datastream user:\n\n ```sql\n CREATE USER 'datastream'@'%' IDENTIFIED BY '\u003cvar translate=\"no\"\u003eYOUR_PASSWORD\u003c/var\u003e';\n ```\n2. Grant the following privileges to them:\n\n ```sql\n GRANT REPLICATION SLAVE, SELECT, REPLICATION CLIENT ON *.* TO 'datastream'@'%';\n GRANT EXECUTE ON PROCEDURE mysql.rds_show_configuration TO 'datastream'@'%';\n FLUSH PRIVILEGES;\n ```\n\nWhat's next\n-----------\n\n- Learn more about how Datastream works with [MySQL sources](/datastream/docs/sources-mysql)."]]