This tutorial uses user profile analysis as an example to show how DataWorks completes data synchronization, data processing, and quality monitoring from end to end. To complete the tutorial, prepare an EMR cluster and a DataWorks workspace, and then associate the cluster with the workspace.
Before you begin
To complete this tutorial, ensure you have read the tutorial overview and understand the entire user profile analysis workflow.
Notes
This tutorial provides the required user information and website access test data. You can use this data directly.
The data provided in this tutorial is for hands-on practice in DataWorks only. All data is mock data.
This tutorial uses the new version of Data Studio for data processing.
Why you need user profile data
To develop better business strategies, you need basic profile data about your website user groups, such as their geographical and social attributes, derived from how those users behave on your website. With this data, you can run profile analysis on a schedule and apply fine-grained operations to website traffic.
Prepare the EMR environment
Create an EMR cluster and integrate it with DataWorks so that you can run EMR data processing tasks on the DataWorks platform. For detailed steps on how to create an EMR cluster, see Create a cluster.
DataWorks support varies for EMR clusters with different configurations. If you plan to develop EMR tasks in DataWorks, review Best practices for DataWorks on EMR cluster configuration before you create the EMR cluster.
The following table describes the key configuration parameters for this tutorial.
|
Parameter |
Description |
|
Region |
China (Shanghai). |
|
Business Scenario |
Data Lake. |
|
Product Version |
Select the latest version. |
|
Optional Services |
Select components based on your requirements. The Hive and OSS-HDFS components are required for this tutorial. |
|
Metadata |
DLF Unified Metadata. |
|
Root Storage Directory of Cluster |
Select an OSS-HDFS instance. If the drop-down list is empty, click Create OSS-HDFS Instance. |
Prepare the DataWorks environment
Before you use DataWorks, make sure you have activated the service. For more information, see Purchase guide.
Step 1. Create a workspace
If you already have a workspace that uses the new version of Data Studio in the China (Shanghai) region, you can skip this step.
Log on to the DataWorks console. In the top navigation bar, switch the region to China (Shanghai). In the left-side navigation pane, click Work space to go to the workspace list page.
Click Create Workspace to create a workspace in standard mode that uses the Use Data Studio (New Version), with Isolate Development and Production Environments.
NoteAfter February 18, 2025, if an Alibaba Cloud primary account activates DataWorks and creates a workspace in the China (Shanghai) region for the first time, DataWorks enables the new version of Data Studio by default.
For more information about how to create a workspace, see Create a workspace.
Step 2. Create a serverless resource group
Purchase a serverless resource group.
This tutorial requires a DataWorks serverless resource group for data synchronization and scheduling. You must purchase and prepare a serverless resource group.
Log on to the DataWorks resource group list page. In the top navigation bar, switch the region to China (Shanghai). In the left-side navigation pane, click Resource Group to go to the Resource Groups page.
Click Create Resource Group. On the purchase page, set Region and Zone to China (Shanghai) and specify a Resource Group Name. Configure other parameters and complete the payment as prompted. For more information about the billing of serverless resource groups, see Billing of serverless resource groups.
NoteIf no VPC or vSwitch is available in the current region, click the corresponding console link in the parameter description to create them. For more information about VPCs and vSwitches, see What is a VPC?.
Bind the resource group to your DataWorks workspace.
You must bind a new serverless resource group to a workspace before using it.
Log on to the DataWorks resource group list page and switch the region to China (Shanghai). Find the serverless resource group that you purchased. In the Operation column, click Associate Workspace. Then, find the DataWorks workspace that you created and click Associate.
Configure public network access for the resource group.
This tutorial uses test data that must be accessed from the public internet. By default, a resource group cannot access the public internet. To enable access, you must configure an Internet NAT gateway and add an EIP for the VPC bound to the resource group.
Log on to the VPC - Internet NAT Gateway console. In the top navigation bar, switch the region to China (Shanghai).
Click Create NAT Gateway and configure the parameters. The following table describes the key parameters for this tutorial. Use the default values for other parameters.
Parameter
Value
Region
China (Shanghai).
Network and Zone
Select the VPC and vSwitch that are bound to the resource group.
You can go to the DataWorks console, switch the region to China (Shanghai), and then click Resource Group in the left-side navigation pane to go to the Resource Groups page. Find the resource group that you created and click Network Settings in the Operation column. In the Data Scheduling & Data Integration section, you can view the bound VPC and Switch. For more information about VPCs and vSwitches, see What is a VPC?.
Network Type
Internet NAT Gateway.
EIP
Create an EIP.
Create service-linked role
If you are creating an Internet NAT gateway for the first time, you must create a service-linked role. Click Create Service-Linked Role.
Click Buy Now, agree to the service agreement, and then click Activate to complete the purchase.
After you purchase the Internet NAT gateway, return to the console and create an SNAT entry for the new gateway instance.
NoteResource groups in the VPC can access the public internet only after you configure an SNAT entry.
In the row of the new instance, click Management in the Operation column. On the instance details page, click the SNAT Management tab.
On the SNAT Entry List tab, click Create SNAT Entry. Configure the following key parameters:
Parameter
Value
SNAT entry granularity
Select Specify VPC. This ensures that all resource groups in the VPC can access the public internet through the configured EIP.
Select EIP
Select the EIP that is bound to the current Internet NAT gateway instance.
After you configure the parameters for the SNAT entry, click OK to create the SNAT entry.
On the SNAT Entry List tab, wait for the Status of the new SNAT entry to become Enabled. Once the status is Available, the VPC bound to the resource group can access the public internet.
For more information about how to add and use a serverless resource group, see Use serverless resource groups.
Step 3. Associate EMR compute resources
Associate EMR compute resources with the workspace that you created to provide the workspace with compute and storage services.
Go to the DataWorks workspace list page. In the top navigation bar, switch the region to China (Shanghai). Find the workspace that you created and click its name to go to the Workspace Details page.
In the left-side navigation pane, click Computing Resources.
-
Click Associate Computing Resources, select EMR, and go to the configuration page for associating EMR compute resources.
-
Configure the following parameters:
Parameter
Description
Alibaba Cloud Account to Which Cluster Belongs
Select Current Alibaba Cloud Account.
Cluster Type
Select Data Lake.
Cluster
Select the EMR cluster that you created in Prepare the EMR environment.
Default Access Identity
Defines the identity that is used to access the EMR cluster from the current workspace. Development environment: select Cluster Account: hadoop. Production environment: select Cluster Account: hadoop.
Pass Proxy User Info
Select Do Not Pass.
Computing Resource Instance Name
Enter a custom name for the compute resource instance.
-
Click Confirm to complete the EMR compute resource configuration.
-
On the Computing Resources management page, find the EMR compute resource that you associated, and then click the Initialize Resource Group button in the upper-right corner to complete the resource group connectivity test.
For more information about associating compute resources, see Associate compute resources.
Next steps
Now that the environment is ready, continue with the next tutorial in the series. In the next tutorial, you synchronize basic user information data and website access log data to OSS, and then use an EMR Hive node to create a table and query the synchronized data. For instructions, see Synchronize data.