Help Center/ Cloud Data Migration/ Best Practices/ Tutorials/ Migrating Data from MRS HDFS to OBS
Updated on 2023-07-14 GMT+08:00

Migrating Data from MRS HDFS to OBS

Scenario

CDM supports file-to-file data migration. This section describes how to migrate data from MRS HDFS to OBS. The process is as follows:

  1. Creating a CDM Cluster and Binding an EIP to the Cluster
  2. Creating an MRS HDFS Link
  3. Creating an OBS Link
  4. Creating a Migration Job

Prerequisites

  • You have obtained the domain name, port number, AK, and SK for accessing OBS.
  • You have purchased an MRS cluster.
  • Your EIP quota is sufficient.

Creating a CDM Cluster and Binding an EIP to the Cluster

  1. If CDM is used an independent service, create a CDM cluster by following the instructions in Creating a CDM Cluster. If CDM is used as a module of DataArts Studio, create a CDM cluster by following the instructions in Creating a CDM Cluster.

    The key configurations are as follows:

    • The flavor of the CDM cluster is selected based on the amount of data to be migrated. Generally, cdm.medium meets the requirements for most migration scenarios.
    • The VPC, subnet, and security group of the CDM cluster must be the same as those of the MRS cluster.

  2. After the CDM cluster is created, on the Cluster Management page, click Bind EIP in the Operation column to bind an EIP to the cluster. The CDM cluster uses the EIP to access MRS HDFS.

    If SSL encryption is configured for the access channel of a local data source, CDM cannot connect to the data source using the EIP.

Creating an MRS HDFS Link

  1. On the Cluster Management page, locate a cluster and click Job Management in the Operation column. On the displayed page, click the Links tab and then Create Link.

    Figure 1 Selecting a connector type

  2. Select MRS HDFS and click Next to configure parameters for the MRS HDFS link.

    • Name: Enter a custom link name, for example, mrs_hdfs_link.
    • Manager IP: IP address of MRS Manager. Click Select next to the Manager IP text box to select a created MRS cluster. CDM automatically fills in the authentication information.
    • Username: If Authentication Method is set to KERBEROS, set the username and password for logging in to MRS Manager.

      If you need to create a snapshot when exporting a directory from HDFS, the user configured here must have the administrator permission on HDFS.

    • Password: password for logging in to MRS Manager
    • Authentication Method: authentication method for accessing MRS
    • Run Mode: Select the running mode of the HDFS link.

Creating an OBS Link

  1. Click Job Management in the Operation column of the CDM cluster. On the displayed page, click the Links tab and then Create Link. The Select Connector page is displayed.

    Figure 2 Selecting a connector type

  2. Select Object Storage Service (OBS) and click Next to configure parameters for the OBS link.

    • Name: Enter a custom link name, for example, obslink.
    • OBS Server and Port: Enter the actual OBS address information.
    • AK and SK: Enter the AK and SK used for logging in to OBS.
      To obtain an access key, perform the following steps:
      1. Log in to the management console, move the cursor to the username in the upper right corner, and select My Credentials from the drop-down list.
      2. On the My Credentials page, choose Access Keys, and click Create Access Key. See Figure 3.
        Figure 3 Clicking Create Access Key
      3. Click OK and save the access key file as prompted. The access key file will be saved to your browser's configured download location. Open the credentials.csv file to view Access Key Id and Secret Access Key.
        • Only two access keys can be added for each user.
        • To ensure access key security, the access key is automatically downloaded only when it is generated for the first time and cannot be obtained from the management console later. Keep them properly.
    Figure 4 Creating an OBS link

  3. Click Save. The Link Management page is displayed.

Creating a Migration Job

  1. Choose Table/File Migration > Create Job to create a job for exporting data from the MRS HDFS database to OBS.

    Figure 5 Creating a job for migrating data from MRS HDFS to OBS
    • Job Name: Enter a unique name.
    • Source Job Configuration
      • Source Link Name: Select the hdfs_llink created in Creating an MRS HDFS Link.
      • Source Directory/File: Enter the directory or file path of the data to be migrated.
      • File Format: Select the file format used for data transmission. Select Binary. If files are transferred without being parsed, the file format does not have to be Binary. This applies to file copy.
      • Retain the default values of other optional parameters.
    • Destination Job Configuration
      • Destination Link Name: Select the obs_link created in Creating an OBS Link.
      • Bucket Name: Select the bucket from which the data will be migrated.
      • Write Directory: Enter the directory to which data is to be written on the OBS server.
      • File Format: Select Binary.
      • Retain the default values of the optional parameters in Show Advanced Attributes.

  2. Click Next. The Map Field page is displayed. CDM automatically matches the source and destination fields.

    • If the field mapping is incorrect, you can drag the fields to adjust the mapping.
    • The expressions in CDM support field conversion of common character strings, dates, and values. For details, see Converting Fields.

  3. Click Next and set task parameters. Generally, retain the default values of all parameters.

    In this step, you can configure the following optional functions:
    • Retry Upon Failure: If the job fails to be executed, you can determine whether to automatically retry. Retain the default value Never.
    • Group: Select the group to which the job belongs. The default group is DEFAULT. On the Job Management page, jobs can be displayed, started, or exported by group.
    • Schedule Execution: Enable it if you need to configure scheduled jobs. Retain the default value No.
    • Concurrent Extractors: Enter the number of extractors to be concurrently executed. CDM supports concurrent extraction of multiple files. Increasing the value of this parameter can improve migration efficiency.
    • Write Dirty Data: Select No. The file-to-file migration is binary, and no dirty data will be generated.
    • Delete Job After Completion: Retain the default value Do not delete. You can also set this parameter to Delete to prevent an accumulation of too many migration jobs.

  4. Click Save and Run. The Job Management page is displayed, on which you can view the job execution progress and result.
  5. After the job is successfully executed, in the Operation column of the job, click Historical Record to view the job's historical execution records and read/write statistics.

    On the Historical Record page, click Log to view the job logs.