All Products
Search
Document Center

:Create a CDH MR node

Last Updated:Nov 27, 2024

In DataWorks DataStudio, you can create a Cloudera's Distribution Including Apache Hadoop (CDH) MapReduce (MR) node to process data in ultra-large datasets. This topic describes how to create and use a CDH MR node in DataWorks.

Prerequisites

  • A workflow is created in DataStudio.

    Development operations in different types of compute engines are performed based on workflows in DataStudio. Therefore, before you create a node, you must create a workflow. For more information, see Create a workflow.

  • An Alibaba Cloud CDH cluster is created and registered to DataWorks.

    Before you create a CDH node and use the CDH node to develop a CDH task in DataWorks, you must register a CDH cluster to a DataWorks workspace. For more information, see Register a CDH or CDP cluster to DataWorks.

  • (Required if you use a RAM user to develop tasks) The RAM user is added to the DataWorks workspace as a member and is assigned the Development or Workspace Administrator role. The Workspace Administrator role has more permissions than necessary. Exercise caution when you assign the Workspace Administrator role. For more information about how to add a member, see Add workspace members and assign roles to them.

  • A serverless resource group is purchased and configured. The configurations include association with a workspace and network configuration. For more information, see Create and use a serverless resource group.

Limits

Tasks on this type of node can be run on serverless resource groups or old-version exclusive resource groups for scheduling. We recommend that you run tasks on serverless resource groups.

Step 1: Create a CDH MR node

  1. Go to the DataStudio page.

    Log on to the DataWorks console. In the top navigation bar, select the desired region. In the left-side navigation pane, choose Data Development and Governance > Data Development. On the page that appears, select the desired workspace from the drop-down list and click Go to Data Development.

  2. On the DataStudio page, find the desired workflow, right-click the workflow name, and then choose Create Node > CDH > CDH MR.

  3. In the Create Node dialog box, configure the Engine Instance, Path, and Name parameters.

  4. Click Confirm. Then, you can use the created node to develop and configure tasks.

Step 2: Create and reference a CDH JAR resource

DataWorks allows you to upload a resource from your on-premises machine to DataStudio before you reference the resource. Perform the following operations to create and reference a CDH JAR resource:

  1. Create a CDH JAR resource.

    Find the desired workflow and click CDH. Right-click Resource and choose Create Resource > CDH JAR. In the Create Resource dialog box, click Upload to upload a required file.

    image.png

  2. Reference the CDH JAR resource.

    1. Go to the configuration tab of the created CDH MR node.

    2. Find the resource that you want to reference under Resource in the CDH folder, right-click the resource name, and then select Insert Resource Path. In this example, a resource named onaliyun_mr_wordcount-1.0-SNAPSHOT.jar is used.

      image.png

      If the clause that is in the ##@resource_reference{""} format appears on the configuration tab of the node, the resource is successfully referenced. Then, run the following code. You must replace the information such as the resource package name, bucket name, and directory in the following code with the actual information.

      ##@resource_reference{"onaliyun_mr_wordcount-1.0-SNAPSHOT.jar"}
      onaliyun_mr_wordcount-1.0-SNAPSHOT.jar cn.apache.hadoop.onaliyun.examples.EmrWordCount oss://onaliyun-bucket-2/cdh/datas/wordcount02/inputs oss://onaliyun-bucket-2/cdh/datas/wordcount02/outputs
      Note

      Do not add comments when you write code for a CDH MR node.

Step 3: Configure task scheduling properties

If you want the system to periodically run a task on the node, you can click Properties in the right-side navigation pane on the configuration tab of the node to configure task scheduling properties based on your business requirements.

Step 4: Debug task code

  1. Optional. Select a resource group and assign custom parameters to variables.

  2. Save and execute the SQL statements.

    In the top toolbar, click the 保存 icon to save the SQL statements. Then, click the 运行 icon to execute the SQL statements.

  3. Optional. Perform smoke testing.

    You can perform smoke testing on the task in the development environment when you commit the task or after you commit the task. For more information, see Perform smoke testing.

What to do next

  1. Commit and deploy the task.

    1. Click the 保存 icon in the top toolbar to save the task.

    2. Click the 提交 icon in the top toolbar to commit the task.

    3. In the Submit dialog box, configure the Change description parameter.

    4. Click Confirm.

    If you use a workspace in standard mode, you must deploy the task in the production environment after you commit the task. To deploy a task on a node, click Deploy in the top navigation bar of the DataStudio page. For more information, see Deploy tasks.

  2. View the task.

    1. Click Operation Center in the upper-right corner of the configuration tab of the corresponding node to go to Operation Center in the production environment.

    2. View the scheduled task. For more information, see View and manage auto triggered tasks.

    To view more information about the task, click Operation Center in the top navigation bar of the DataStudio page. For more information, see Overview.