Prepare an EMR Serverless StarRocks instance and a DataWorks workspace before starting the tutorial.
Background
To improve business strategies, you need to analyze website user behavior to build basic user profiles. These profiles can include attributes like geographic location and social characteristics. By performing scheduled analysis, you can achieve granular control over website traffic.
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.
Prepare the OSS environment
This tutorial uses a user-defined function (UDF) whose resources are stored in OSS. Ensure that you have activated OSS and created an OSS bucket with public read and write permissions for the function resources.
Prepare the EMR Serverless StarRocks environment
Ensure that you have an EMR Serverless StarRocks instance. If you do not have one, create an instance.
-
Instance Type: All-in-one.
-
Region: China (Shanghai).
-
Instance Edition: Entry-level.
ImportantThis edition is for trial and testing only and is not covered by a Service Level Agreement (SLA). You can select the Standard edition as needed.
-
Version: 3.1.
This tutorial requires a database in your StarRocks instance. After creating the instance, log in to the SQL Editor and run the following statement to create the database:
CREATE DATABASE database_name;
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: Bind the StarRocks compute resource
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 a Compute Resource Type, and then configure the parameters.
This tutorial uses Serverless StarRocks as the compute and storage resource. For the compute resource type, select Serverless StarRocks and configure the related parameters. The following are the key parameters for this example. You can keep the default settings for any parameters that are not described.
Parameter
Description
StarRocks Instance
Select the StarRocks instance that you want to bind. You can also click New in the drop-down list to open the EMR StarRocks console and create a new instance. Then, return to the DataWorks workspace to select it.
Note-
If you enabled environment isolation when you created the workspace, you must select separate StarRocks instances for the development and production environments.
-
For more information about how to create a StarRocks instance, see Create an EMR Serverless StarRocks instance.
Database Name
Select a database in the StarRocks instance. If no database exists, you must first .
Username
Password
The username and password that you configured when you created the StarRocks instance. The default username is
admin.Computing Resource Instance Name
An identifier for the compute engine. At runtime, tasks use this name to select the compute engine.
For this tutorial, set the name to
doc_starrocks_storage_compute_tightly_01.Connection Configuration
The resource group used to connect to the StarRocks instance. You can test the connectivity here.
NoteIf no resource group is available, you can create one and bind it to the workspace. Then, test the connectivity to the compute resource on the workspace Details page. For more information, see Use a serverless resource group.
-
-
Click Confirm to finish configuring the Serverless StarRocks compute resource.
For more information about how to bind a compute engine, see Bind a compute engine.
Next steps
After preparing the environment, proceed to synchronize basic user information and website access logs to OSS, then use a StarRocks node to create tables and query the data. For more information, see Synchronize data.