Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Bagian berikut membahas cara mengonfigurasi CDC untuk database Amazon RDS for MySQL.
Membuat grup parameter
Luncurkan Dasbor Amazon RDS Anda.
Di Navigation Drawer, klik Parameter Groups.
Klik Create Parameter Group. Halaman Create Parameter Group akan muncul.
Pilih keluarga database yang cocok dengan database Anda, berikan nama dan
deskripsi untuk grup parameter.
Klik Buat.
Pilih kotak centang di sebelah kiri grup parameter yang baru dibuat.
Di bagian Tindakan grup parameter, klik Edit.
Gunakan tabel berikut untuk menetapkan parameter untuk grup Anda.
Untuk replikasi berbasis binlog:
Parameter
Nilai
binlog_format
ROW
log_bin_use_v1_row_events
1
read_only
0
net_read_timeout
3600
net_write_timeout
3600
wait_timeout
86400
Untuk replikasi berbasis GTID:
Parameter
Nilai
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 (nilai yang direkomendasikan)
log-replica-updates
1
enforce-gtid-consistency
ON
gtid_mode
ON
Anda hanya dapat menetapkan parameter ini
ke ON setelah menetapkan enforce-gtid-consistency
ke ON. Secara umum, gtid_mode dapat memiliki nilai
berikut:
OFF
OFF_PERMISSIVE
ON_PERMISSIVE
ON
Anda hanya dapat mengubah nilai parameter gtid_mode satu
langkah pada satu waktu. Misalnya, jika mode saat ini ditetapkan ke OFF,
lakukan tindakan berikut:
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-12 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)."]]