DataWorks is an important platform as a service (PaaS) provided by Alibaba Cloud. DataWorks supports multiple computing engines and storage engines. This topic describes how to use DataWorks to migrate offline data from ApsaraDB for MongoDB to LindormTable.
Background information
For more information about DataWorks, see What is DataWorks?.
Precautions
To migrate offline data from ApsaraDB for MongoDB to LindormTable, you need to unnest the nested JSON fields in the offline data. Take note that you do not need to convert the data.
Note Perform the following steps if you want to process data during the migration process. For example, perform the following steps if you want to perform MD5 hashing on the primary key during the migration process:
- Use DataWorks to migrate the data from ApsaraDB for MongoDB to MaxCompute. MaxCompute is also known as ODPS.
- Execute SQL statements to process the data in MaxCompute.
- Use DataWorks to migrate the data from MaxCompute to LindormTable.
Preparations
Before you migrate offline data from ApsaraDB for MongoDB to LindormTable, complete the following tasks:
- Prepare the data to be migrated in ApsaraDB for MongoDB:
{ "id" : ObjectId("624573dd7c0e2eea4cc8****"), "title" : "ApsaraDB for MongoDB tutorial", "description" : "ApsaraDB for MongoDB is a NoSQL database", "by" : "beginner tutorial", "url" : "http://www.runoob.com", "map" : { "a" : "mapa", "b" : "mapb" }, "likes" : 100 }
- Prepare the schema data in LindormTable:
CREATE TABLE t1 ( title varchar not null primary key, desc varchar, by varchar, url varchar, a varchar, b varchar, likes int);
- Use the Data Integration service of DataWorks to configure a DataX task. For more information, see Use DataWorks to configure synchronization tasks in DataX.
Procedure
- Add an ApsaraDB for MongoDB data source in the DataWorks console. For more information, see Add a MongoDB data source.
- Configure a batch synchronization node by using the code editor. For more information, see Configure a batch synchronization node by using the code editor.