Configura una base de datos de MySQL de Amazon RDS
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
En las siguientes secciones, se explica cómo configurar la CDC para una base de datos de Amazon RDS para MySQL.
Crea un grupo de parámetros
Inicia el panel de Amazon RDS.
En el panel lateral de navegación, haz clic en Grupos de parámetros.
Haz clic en Crear grupo de parámetros. Aparecerá la página Create Parameter Group.
Selecciona la familia de base de datos que coincida con tu base de datos, proporciona un nombre y una descripción para el grupo de parámetros.
Haz clic en Crear.
Selecciona la casilla de verificación que se encuentra a la izquierda del grupo de parámetros recién creado.
En Acciones del grupo de parámetros, haz clic en Editar.
Usa la siguiente tabla para configurar los parámetros de tu grupo.
Para la replicación basada en registros binarios, haz lo siguiente:
Parámetro
Valor
binlog_format
ROW
log_bin_use_v1_row_events
1
read_only
0
net_read_timeout
3600
net_write_timeout
3600
wait_timeout
86400
Para la replicación basada en GTID, haz lo siguiente:
Parámetro
Valor
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 (valor recomendado)
log-replica-updates
1
enforce-gtid-consistency
ON
gtid_mode
ON
Solo puedes configurar este parámetro en ON después de establecer enforce-gtid-consistency en ON. En general, gtid_mode puede tener los siguientes valores:
OFF
OFF_PERMISSIVE
ON_PERMISSIVE
ON
Solo puedes cambiar los valores del parámetro gtid_mode un
paso a la vez. Por ejemplo, si el modo actual está configurado como OFF, haz lo siguiente:
Cambia el parámetro de configuración a OFF_PERMISSIVE.
Cambia el parámetro de configuración a ON_PERMISSIVE.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 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)."]]