You can configure a Redis output component to write data from external databases to Redis. You can also use the component to copy and push data from storage systems connected to the big data platform to Redis for data integration and reprocessing.
Prerequisites
Before you begin, ensure that you have completed the following operations:
You have created a Redis data source. For more information, see Create a Redis data source.
The account that you use to configure the Redis output component must have read-through permission on the data source. If you do not have this permission, request it for the data source. For more information, see Request, renew, and return data source permissions.
Procedure
In the top menu bar of the Dataphin homepage, choose Development > Data Integration.
In the top menu bar of the Data Integration page, select a Project. If you are in Dev-Prod mode, you also need to select an environment.
In the navigation pane on the left, click Batch Pipeline. In the Batch Pipeline list, click the desired offline pipeline to open its configuration page.
Click the Component Library in the upper-right corner of the page to open the Component Library panel.
In the navigation pane on the left of the Component Library panel, select Output. In the list of output components on the right, find and drag the Redis component to the canvas.
Click and drag the
icon of the target upstream component to connect it to the current Redis output component.Click the
icon on the Redis output component card to open the Redis Output Configuration dialog box.
In the Redis Output Configuration dialog box, configure the parameters as described in the following table.
Parameter
Description
Basic settings
Step name
The name of the Redis output component. Dataphin automatically generates a name, but you can change it as needed. Naming rules:
Can contain only Chinese characters, letters, digits, and underscores (_).
Cannot exceed 64 characters.
Datasource
The drop-down list displays all Redis data sources, including those for which you have write-through permission and those for which you do not. To copy the current data source name, click the
icon.For a data source without write-through permission, click Request next to the data source to request the permission. For more information, see Request, renew, and return data source permissions.
If you do not have a Redis data source, click Create Data Source to create one. For more information, see Create a Redis data source.
DB
This parameter is not required in cluster mode. In standalone mode, specify the DB. The value must be an integer from 0 to 255. The default value is 0.
Key column
Select the column to use as the key.
Key separator
The separator for the key. This parameter takes effect when more than one key column is selected. Multi-character separators are supported. Example:
\u0001.Write data type
Select the data type of the value to write to Redis.
Write mode
Select the write mode.
Write in JSON format
This parameter is available only when Write data type is set to String. Select Yes to write the names and values of the value columns to the destination Redis instance in JSON format based on the configured field mapping. Select No to write the values separated by the value separator.
Value separator
The separator for the value. Multi-character separators are supported. Example:
\u0001.Advanced settings
Cache expiration time
Cache expiration time supports Validity Period, Expiration Time - Constant, or Expiration Time - From Field.
Validity period: Enter the validity period of the data in seconds.
Expiration time - constant: Select a specific time. The data expires after this time.
Expiration time - from field: Select a field that contains the expiration time. The data expires after the time specified in this field.
Write timeout
The timeout period for writing data to Redis. The default value is 300 seconds.
Key prefix
A prefix for the key. The prefix can contain Chinese and English characters, digits, and underscores (_).
Field mapping
Input fields
The input fields from the upstream component.
Output fields
The output fields. You can manually add output fields.
Click Batch Add to configure fields in batches in JSON or TEXT format. The following examples show the formats.
JSON format
"column":[ { "index":5, "name":"test1", "type":"STRING" }, { "index":2, "name":"partition", "type":"STRING" } ]TEXT format
paper_no,String phone_no,String vip_no,StringRow delimiter: Separates the information of each field. The default delimiter is a line feed (\n). Other supported delimiters are
\n ; ..Column delimiter: Separates the field name from the field type. The default delimiter is a comma (`,`). The field type is optional.
You can also perform the following operations on the added fields:
Click the Actions column
icon to edit existing fields.Click the Actions column's
icon to delete existing fields.
Mapping
Manually select the field mapping based on the upstream input fields and the destination table fields. Quick mapping options include Same Name Mapping and Same Row Mapping.
Click Confirm to complete the configuration of the Redis output component.