Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Le sezioni seguenti descrivono come configurare CDC per un database Amazon RDS per MySQL.
Crea un gruppo di parametri
Avvia la dashboard di Amazon RDS.
Nel riquadro di navigazione a scomparsa, fai clic su Gruppi di parametri.
Fai clic su Crea gruppo di parametri. Viene visualizzata la pagina Crea gruppo di parametri.
Seleziona la famiglia di database che corrisponde al tuo database, fornisci un nome e una descrizione per il gruppo di parametri.
Fai clic su Crea.
Seleziona la casella di controllo a sinistra del gruppo di parametri appena creato.
In Azioni del gruppo di parametri, fai clic su Modifica.
Utilizza la tabella seguente per impostare i parametri del gruppo.
Per la replica basata su binlog:
Parametro
Valore
binlog_format
ROW
log_bin_use_v1_row_events
1
sola_lettura
0
net_read_timeout
3600
net_write_timeout
3600
wait_timeout
86400
Per la replica basata su GTID:
Parametro
Valore
binlog_format
ROW
log_bin_use_v1_row_events
1
sola_lettura
0
net_read_timeout
3600
net_write_timeout
3600
wait_timeout
86400
expire-logs-days
7
binlog_row_image
FULL
max_allowed_packet
1G (valore consigliato)
log-replica-updates
1
enforce-gtid-consistency
ON
gtid_mode
ON
Puoi impostare questo parametro su ON solo dopo aver impostato enforce-gtid-consistency su ON. In generale, gtid_mode può avere i seguenti valori:
OFF
OFF_PERMISSIVE
ON_PERMISSIVE
ON
Puoi modificare i valori del parametro gtid_mode solo un
passaggio alla volta. Ad esempio, se la modalità corrente è impostata su OFF,
esegui i seguenti passaggi:
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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)."]]