แชร์ผ่าน


เพิ่มฐานข้อมูล MySQL CDC เป็นแหล่งข้อมูลในฮับเรียลไทม์

บทความนี้อธิบายวิธีการเพิ่ม MySQL Database Change Data Capture (CDC) เป็นแหล่งข้อมูลเหตุการณ์ใน Fabric Real-Time hub

ตัวเชื่อมต่อ Azure MySQL Database Change Data Capture (CDC) ช่วยให้คุณสามารถจับภาพสแนปช็อตของข้อมูลปัจจุบันในฐานข้อมูล Azure MySQL ได้ คุณระบุตารางที่จะตรวจสอบและรับการแจ้งเตือนเมื่อมีการเปลี่ยนแปลงระดับแถวต่อมาใดๆ กับตาราง เมื่อการเปลี่ยนแปลงถูกบันทึกไว้ในสตรีม คุณสามารถประมวลผลข้อมูล CDC นี้ในแบบเรียลไทม์ และส่งไปยังปลายทางอื่นภายใน Fabric เพื่อประมวลผลหรือวิเคราะห์เพิ่มเติม

Prerequisites

  • เข้าถึงพื้นที่ทํางานในโหมดสิทธิ์การใช้งาน Fabric capacity (หรือ) โหมดสิทธิ์การใช้งานรุ่นทดลองใช้ที่มีสิทธิ์ผู้สนับสนุนหรือสูงกว่า
  • สร้างอินสแตนซ์ของ ฐานข้อมูล Azure สําหรับ MySQL – เซิร์ฟเวอร์ที่ยืดหยุ่น

ตั้งค่าฐานข้อมูล MySQL

ตัวเชื่อมต่อฐานข้อมูล Azure MySQL ใช้ตัวเชื่อมต่อ Debezium MySQL เพื่อจับการเปลี่ยนแปลงในฐานข้อมูล MySQL ของคุณ คุณต้องกําหนดผู้ใช้ MySQL ที่มีสิทธิ์บนฐานข้อมูลทั้งหมดที่ตัวเชื่อมต่อตรวจสอบ สําหรับคําแนะนําทีละขั้นตอน ดู ตั้งค่าฐานข้อมูล MySQL (DB)

เปิดใช้งาน binlog

คุณต้องเปิดใช้งานการบันทึกไบนารีสําหรับการจําลอง MySQL แฟ้มบันทึกไบนารีบันทึกการปรับปรุงทรานแซคชันสําหรับเครื่องมือการจําลองแบบเพื่อเผยแพร่การเปลี่ยนแปลง ตัวอย่างเช่น ฐานข้อมูล Azure สําหรับ MySQL

  1. In the Azure portal, navigate to your Azure MySQL database.

  2. On the left navigation menu, select Server parameters.

  3. กําหนดค่าเซิร์ฟเวอร์ MySQL ของคุณด้วยคุณสมบัติต่อไปนี้

    • binlog_row_image: Set the value to full.
    • binlog_expire_logs_seconds: The number of seconds for automatic binlog file removal. ตั้งค่าเพื่อให้ตรงกับความต้องการของสภาพแวดล้อมของคุณ For example, 86400.

    สกรีนช็อตที่แสดงหน้าพารามิเตอร์เซิร์ฟเวอร์สําหรับฐานข้อมูล Azure MySQL

รับเหตุการณ์จาก Azure MySQL Database (CDC)

คุณสามารถรับเหตุการณ์จาก CDC ฐานข้อมูล Azure MySQL ลงในฮับเรียลไทม์ด้วยหนึ่งในวิธีต่อไปนี้:

หน้าแหล่งข้อมูล

  1. Sign in to Microsoft Fabric.

  2. If you see Power BI at the bottom-left of the page, switch to the Fabric workload by selecting Power BI and then by selecting Fabric.

    สกรีนช็อตที่แสดงวิธีการสลับไปยังปริมาณงาน Fabric

  3. Select Real-Time on the left navigation bar.

    สกรีนช็อตที่แสดงวิธีการเปิดใช้งานการเชื่อมต่อกับแหล่งข้อมูล

  4. On the Real-Time hub page, select + Data sources under Connect to on the left navigation menu.

    สกรีนช็อตที่แสดงหน้าแหล่งข้อมูลในฮับ Real-Time

    You can also get to the Data sources page from the Real-Time hub page by selecting the + Add data button in the top-right corner.

    สกรีนช็อตที่แสดงปุ่มเชื่อมต่อแหล่งข้อมูล

  1. On the Data sources page, select Database CDC category at the top, and then select Connect on the MySQL DB (CDC) tile.

    สกรีนช็อตที่แสดงการเลือก MySQL DB (CDC) บนหน้าแหล่งข้อมูล

    ใช้คําแนะนําจากเพิ่ม Azure MySQL Database CDC เป็นส่วนแหล่งที่มา

หน้าแหล่งที่มาของ Microsoft

  1. In Real-Time hub, select Microsoft sources.

  2. In the Source drop-down list, select Azure MySQL DB (CDC).

  3. For Subscription, select an Azure subscription that has the resource group with your Azure MySQL Database account.

  4. For Resource group, select a resource group that has the database.

  5. For Region, select a location where your database is located.

  6. Now, move the mouse over the name of the Azure MySQL DB CDC source that you want to connect to Real-Time hub in the list of databases, and select the Connect button, or select ... (ellipsis), and then select the Connect button.

    สกรีนช็อตที่แสดงหน้าแหล่งข้อมูลของ Microsoft พร้อมตัวกรองเพื่อแสดง Azure MySQL CDC และปุ่มเชื่อมต่อ

    หากต้องการกําหนดค่าข้อมูลการเชื่อมต่อ ให้ใช้ขั้นตอนจากเพิ่ม Azure MySQL DB CDC เป็นส่วนต้นทาง

เพิ่ม CDC ฐานข้อมูล Azure MySQL เป็นแหล่งข้อมูล

  1. On the Connect page, select New connection.

    สกรีนช็อตที่แสดงหน้าเชื่อมต่อของตัวช่วยสร้างการเพิ่มแหล่งข้อมูลพร้อมลิงก์ **การเชื่อมต่อใหม่** ที่เน้น

  2. In the Connection settings section, do these steps:

    1. For Server, enter the URI for your Azure MySQL server.

    2. For Database, enter the name of your database.

      สกรีนช็อตที่แสดงส่วนการตั้งค่าการเชื่อมต่อ

  3. In the Connection credentials section, do these steps:

    1. For Connection, select if there's an existing connection to the MySQL database. หากไม่เป็นเช่นนั้น ให้เก็บค่าเริ่มต้นไว้: สร้างการเชื่อมต่อใหม่

    2. For Authentication kind, select Basic. Currently, only Basic authentication is supported.

    3. Enter values for User name and Password.

    4. ระบุว่าคุณต้องการ ใช้การเชื่อมต่อที่เข้ารหัสลับหรือไม่

    5. Select Connect.

      สกรีนช็อตที่แสดงส่วนข้อมูลประจําตัวการเชื่อมต่อ

  4. Back on the Connect page, do these steps:

    1. Enter the table name.
    2. Enter the server ID.
    3. Enter the port number or keep the default value.
  5. In the Stream details section to the right, do these steps:

    1. Select Fabric workspace where you want to save this connection and the eventstream that the wizard creates.

    2. ใส่ชื่อสําหรับเหตุการณ์สตรีม

    3. ชื่อของสตรีมในฮับเวลาจริงจะถูกสร้างขึ้นสําหรับคุณโดยอัตโนมัติ

      สกรีนช็อตที่แสดงหน้าเชื่อมต่อพร้อมเขตข้อมูลที่จําเป็นทั้งหมดที่ระบุ

  6. Now, select Next at the bottom of the page.

  7. บน ตรวจสอบ + เชื่อมต่อ ให้ตรวจสอบการตั้งค่า และเลือก สร้างแหล่งข้อมูล

    สกรีนช็อตที่แสดงหน้าตรวจสอบ + เชื่อมต่อพร้อมเขตข้อมูลที่จําเป็นทั้งหมดที่ระบุ

  8. On the Connect page, select Go to resource to navigate to the Azure PostgreSQL database. Take a note of the server name on the Overview page. ซึ่งอยู่ในรูปแบบต่อไปนี้: mysqlserver.mysql.database.azure.com

    สกรีนช็อตที่แสดงหน้าเชื่อมต่อพร้อมลิงก์ไปยังทรัพยากรที่ถูกเน้น

ดูรายละเอียดสตรีมข้อมูล

  1. บนหน้า ตรวจสอบ + เชื่อมต่อ ถ้าคุณเลือก เปิดเหตุการณ์สตรีม ตัวช่วยสร้างจะเปิดเหตุการณ์ที่สร้างขึ้นให้คุณด้วย Azure MySQL DB CDC ที่เลือกเป็นแหล่งข้อมูล To close the wizard, select Finish or X* in the top-right corner of the page.

    สกรีนช็อตที่แสดงหน้าตรวจสอบ + เชื่อมต่อหลังจากการสร้างแหล่งข้อมูลสําเร็จ

  2. คุณควรเห็นสตรีมในส่วนข้อมูลการสตรีมล่าสุดของโฮมเพจฮับReal-Time สําหรับขั้นตอนโดยละเอียด ดูรายละเอียดของสตรีมข้อมูลใน Fabric Real-Time hub

.

หากต้องการเรียนรู้เกี่ยวกับการใช้สตรีมข้อมูล โปรดดูบทความต่อไปนี้: