Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Cloud Data Migration/ Best Practices/ Enabling Incremental Data Migration Through DataArts Factory

Enabling Incremental Data Migration Through DataArts Factory

Updated on 2024-08-30 GMT+08:00

The DataArts Factory module of DataArts Studio is a one-stop, collaborative big data development platform. You can enable incremental data migration through online script editing in DataArts Factory and periodic scheduling of CDM jobs.

This section describes how to use DataArts Factory together with CDM to migrate incremental data from GaussDB(DWS) to OBS.
  1. Obtaining the CDM Job JSON
  2. Modifying JSON
  3. Creating a Job in DataArts Factory

Obtaining the CDM Job JSON

  1. On the CDM console, create a table/file migration job from GaussDB(DWS) to OBS.
  2. On the Table/File Migration tab page of the Job Management page, locate the created job, click More in the Operation column, and select View Job JSON from the drop-down list.

    You can also view JSON of any other CDM job.

    Figure 1 Viewing job JSON
  3. The job JSON is the request body template for creating a CDM job. Replace [Endpoint], {project_id}, and {cluster_id} in the URL with the actual values.
    • [Endpoint]: indicates the endpoint.

      An endpoint is the request address for calling an API. Endpoints vary depending on services and regions. You can obtain the endpoints of the service from Regions and Endpoints.

    • {project_id}: indicates the project ID.
    • {cluster_id}: Indicates the cluster ID. You can click the cluster name on the Cluster Management page to view the cluster ID.

Modifying JSON

You can modify the JSON body as required. In this example, the period is one day, and the WHERE clause is used for filtering the incremental data to be migrated (generally, the time range is used for filtering data). The data generated on the previous day is migrated every day.
  1. Modify the WHERE clause to add incremental data in a certain period.
         {
            "name": "fromJobConfig.whereClause",
            "value": "_timestamp >= '${startTime}' and _timestamp < '${currentTime}'"
         }
    NOTE:
    • If the source database is DWS or MySQL, the value can be set to:
      _timestamp >= '2018-10-10 00:00:00' and _timestamp < '2018-10-11 00:00:00'
      Or
      _timestamp between '2018-10-10 00:00:00' and '2018-10-11 00:00:00'
    • If the source database is Oracle, the value should be set to:
      _timestamp >= to_date (2018-10-10 00:00:00' , 'yyyy-mm-dd hh24:mi:ss' ) and _timestamp < to_date (2018-10-10 00:00:00' , 'yyyy-mm-dd hh24:mi:ss' )
  2. Import incremental data in each period to different directories.
         {
            "name": "toJobConfig.outputDirectory",
            "value": "dws2obs/${currentTime}"
         }
  3. Change the job name to a dynamic one. Otherwise, the job cannot be created because the job name is duplicate.
        "to-connector-name": "obs-connector",
        "from-link-name": "dws_link",
        "name": "dws2obs-${currentTime}"
For details about how to modify more parameters, see Cloud Data Migration API Reference. The following is an example of the modified JSON file:
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
{
  "jobs": [
    {
      "job_type": "NORMAL_JOB",
      "to-config-values": {
        "configs": [
          {
            "inputs": [
              {
                "name": "toJobConfig.bucketName",
                "value": "cdm-test"
              },
              {
                "name": "toJobConfig.outputDirectory",
                "value": "dws2obs/${currentTime}"
              },
              {
                "name": "toJobConfig.outputFormat",
                "value": "CSV_FILE"
              },
              {
                "name": "toJobConfig.fieldSeparator",
                "value": ","
              },
              {
                "name": "toJobConfig.writeToTempFile",
                "value": "false"
              },
              {
                "name": "toJobConfig.validateMD5",
                "value": "false"
              },
              {
                "name": "toJobConfig.encodeType",
                "value": "UTF-8"
              },
              {
                "name": "toJobConfig.duplicateFileOpType",
                "value": "REPLACE"
              },
              {
                "name": "toJobConfig.kmsEncryption",
                "value": "false"
              }
            ],
            "name": "toJobConfig"
          }
        ]
      },
      "from-config-values": {
        "configs": [
          {
            "inputs": [
              {
                "name": "fromJobConfig.schemaName",
                "value": "dws_database"
              },
              {
                "name": "fromJobConfig.tableName",
                "value": "dws_from"
              },
              {
                "name": "fromJobConfig.whereClause",
                "value": "_timestamp >= '${startTime}' and _timestamp < '${currentTime}'"
              },
              {
                "name": "fromJobConfig.columnList",
                "value": "_tiny&_small&_int&_integer&_bigint&_float&_double&_date&_timestamp&_char&_varchar&_text"
              }
            ],
            "name": "fromJobConfig"
          }
        ]
      },
      "from-connector-name": "generic-jdbc-connector",
      "to-link-name": "obs_link",
      "driver-config-values": {
        "configs": [
          {
            "inputs": [
              {
                "name": "throttlingConfig.numExtractors",
                "value": "1"
              },
              {
                "name": "throttlingConfig.submitToCluster",
                "value": "false"
              },
              {
                "name": "throttlingConfig.numLoaders",
                "value": "1"
              },
              {
                "name": "throttlingConfig.recordDirtyData",
                "value": "false"
              },
              {
                "name": "throttlingConfig.writeToLink",
                "value": "obs_link"
              }
            ],
            "name": "throttlingConfig"
          },
          {
            "inputs": [],
            "name": "jarConfig"
          },
          {
            "inputs": [],
            "name": "schedulerConfig"
          },
          {
            "inputs": [],
            "name": "transformConfig"
          },
          {
            "inputs": [],
            "name": "smnConfig"
          },
          {
            "inputs": [],
            "name": "retryJobConfig"
          }
        ]
      },
      "to-connector-name": "obs-connector",
      "from-link-name": "dws_link",
      "name": "dws2obs-${currentTime}"
    }
  ]
}

Creating a Job in DataArts Factory

  1. On the DataArts Factory console, create a data development job with Rest Client nodes shown in Figure 2. For details, see Creating a Job in DataArts Studio User Guide.
    For details about how to configure the nodes and the job, see the following steps.
    Figure 2 DataArts Factory job
  2. Configure the CreatingJob node.
    DataArts Factory uses a Rest Client node to call a RESTful API to create a CDM migration job. Configure the properties of the Rest Client node.
    1. Node Name: Enter a custom name, for example, CreatingJob. Note that the CDM job is only used as a node in the DataArts Factory job.
    2. URL Address: Set it to the URL obtained in Obtaining the CDM Job JSON. The format is https://{Endpoint}/cdm/v1.0/{project_id}/clusters/{cluster_id}/cdm/job.
    3. HTTP Method: Enter POST.
    4. Add the following request headers:
      • Content-Type = application/json
      • X-Language = en-us
    5. Request Body: Enter the modified JSON of the CDM job in Modifying JSON.
    Figure 3 Properties of the node for creating the CDM job

  3. Configure the StartingJob node.
    After configuring the RESTful API node for creating a CDM job, you must add the RESTful API node for running the CDM job. For details, see section "Starting a Job" in Cloud Data Migration API Reference. Configure the properties of the RestAPI node.
    1. Node Name: Enter the name of the node where the job is to be run.
    2. URL Address: Keep the values of project_id and cluster_id consistent with those in 2. Set the job name to dws2obs-${currentTime}. The format is https://{Endpoint}/cdm/v1.0/{project_id}/clusters/{cluster_id}/cdm/job/{job_name}/start.
    3. HTTP Method: Enter PUT.
    4. Request Header:
      • Content-Type = application/json
      • X-Language = en-us
    Figure 4 Properties of the node for running the CDM job

  4. Configure the WaitingJobCompletion node.

    CDM jobs are run asynchronously. Therefore, even if the REST request for running the job returns 200, it does not mean that the data has been migrated successfully. If a computing job depends on the CDM job, a RestAPI node is required to periodically check whether the migration is successful. Computing is performed only when the migration is successful. For details about the API used to check whether the CDM migration is successful, see section "Querying Job Status" in Cloud Data Migration API Reference.

    After configuring the RestAPI node for running the CDM job, add the node for waiting for the CDM job completion. The node properties are as follows:
    1. Node Name: Wait until the job is complete.
    2. URL Address: The format is https://{Endpoint}/cdm/v1.0/{project_id}/clusters/{cluster_id}/cdm/job/{job_name}/status. Keep the values of project_id and cluster_id consistent with those in 2. Set the job name to dws2obs-${currentTime}.
    3. HTTP Method: Enter GET.
    4. Request Header:
      • Content-Type = application/json
      • X-Language = en-us
    5. Check Return Value: Select YES.
    6. Property Path: Enter submissions[0].status.
    7. Request Success Flag: Set this parameter to SUCCEEDED.
    8. Retain default values for other parameters.
  5. (Optional) Configure the DeletingJob node.

    You can delete jobs as required. DataArts Factory periodically creates CDM jobs to implement incremental migration. Therefore, a large number of jobs exist in the CDM cluster. After the migration is successful, you can delete the jobs that have been successfully executed. To delete a CDM job, add a RestAPI node for deleting CDM jobs after the node for querying the CDM job status. DataArts Factory calls the API for deleting a job described in Cloud Data Migration API Reference.

    Properties of the node for deleting the CDM job are as follows:
    1. Node Name: Enter DeletingJob.
    2. URL Address: The format is https://{Endpoint}/cdm/v1.0/{project_id}/clusters/{cluster_id}/cdm/job/{job_name}. Keep the values of project_id and cluster_id consistent with those in 2. Set the job name to dws2obs-${currentTime}.
    3. HTTP Method: Enter DELETE.
    4. Request Header:
      • Content-Type = application/json
      • X-Language = en-us
    5. Retain default values for other parameters.
    Figure 5 Properties of the node for deleting the CDM job
  6. To perform computing operations after the migration is complete, you can add various computing nodes.
  7. Configure job parameters in DataArts Factory.
    1. Configure the job parameters shown in Figure 6.
      • startTime = $getTaskPlanTime(plantime,@@yyyyMMddHHmmss@@,-24*60*60)
      • currentTime = $getTaskPlanTime(plantime,@@yyyyMMdd-HHmm@@,0)
      Figure 6 Configuring job parameters in DataArts Factory
    2. After saving the job, choose Scheduling Configuration > Periodic Scheduling and set the scheduling period to one day.

      In this way, DataArts Factory works with CDM to migrate data generated on the previous day every day.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback