简体   繁体   English

MySQL 数据库到 BigQuery 的传输

[英]MySQL database to BigQuery transfer

I want to create connector (something like Debezium in Kafka-Connect) to reflect every change in MySQL source database in BigQuery tables.我想创建连接器(类似于 Kafka-Connect 中的 Debezium)来反映 BigQuery 表中 MySQL 源数据库中的每一个变化。

There is one problem - source database is dropped every 10mins and re-created - some of rows are the same, some are updated and some are totally new.有一个问题 - 源数据库每 10 分钟删除一次并重新创建 - 有些行是相同的,有些是更新的,有些是全新的。 So I cannot do it via Debezium, because every 10min I would have all records in Kafka.所以我不能通过 Debezium 做到这一点,因为每 10 分钟我就会有 Kafka 中的所有记录。

I want migrate to BQ tables just new or updated values.我想迁移到 BQ 表只是新的或更新的值。 The mechanism to "copy" the whole source database but to deduplicate records (which not be excatly the same because this will be a new database). “复制”整个源数据库但对记录进行重复数据删除的机制(这并不完全相同,因为这将是一个新数据库)。 So for example create hash from every record and check - if hash is already in BQ - pass and if there is not add it.因此,例如从每条记录中创建 hash 并检查 - 如果 hash 已经在 BQ 中 - 通过并且如果没有添加它。

I think it should be this:我认为应该是这样的:

Best effort de-duplication 尽力去重

but how to create the whole pipeline with MySQL as a source.但是如何以 MySQL 作为源来创建整个管道。

Cloud Data Fusion Replication lets you replicate your data continuously and in real time from operational data stores, such as SQL Server and MySQL, into BigQuery. Cloud Data Fusion Replication可让您将数据从操作数据存储(例如 SQL 服务器和 MySQL)连续实时复制到 BigQuery。
To use Replication, you create a new instance of Cloud Data Fusion and add the Replication app.要使用 Replication,您需要创建一个新的 Cloud Data Fusion 实例并添加 Replication 应用程序。

In short you do below简而言之,你在下面做

  1. Set up your MySQL database to enable replication.设置您的 MySQL 数据库以启用复制。
  2. Create and run a Cloud Data Fusion Replication pipeline.创建并运行 Cloud Data Fusion Replication 管道。
  3. View the results in BigQuery.在 BigQuery 中查看结果。

Yu can see more at Replicating data from MySQL to BigQuery Yu 可以在将数据从 MySQL 复制到 BigQuery中查看更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM