FlinkSQL Redis Table Development Rules
Job Parameters
The following table describes the parameter settings for Flink Redis jobs.
| Parameter | Mandatory (Yes/No) | Type | Description |
|---|---|---|---|
| zSetScoreColumn | No | String | Column name of the score field in the ZSet format when Redis functions as a dimension table. |
| hashKeyColumn | No | String | Column name of the Hash field, in hash format. |
| host | Yes | String | IP address for connecting to the Redis cluster, which is the instance IP address (service plane) of the Redis cluster. |
| port | Yes | String | Port number of the Redis instance. The port number of a Redis instance is calculated as follows: 22400 + Instance ID – 1. To obtain the instance ID, log in to FusionInsight Manager and choose Cluster > Services > Redis. On the page that is displayed, click Redis Manager then click the target Redis cluster name. For example, in the Redis cluster, the port number of the Redis instance that corresponds to the role R1 port is 22400 (22400 + 1 – 1 = 22400). |
| separator | No | String | Separator for the fields in a value when Redis functions as a dimension table, for example, (,) and (\u200b). |
| key-ttl-mode | No | String | Redis data expiration policy. The options include:
|
| key-ttl | No | String | This parameter is mandatory when key-ttl-mode is set to a value other than no-ttl. The value does not contain a unit. |
| isSSLMode | No | String | Whether to enable the SSL mode.
|
| keyPrefix | No | String | Prefix of the Redis key. |
| need-kerberos-auth | No | String | Whether to enable Kerberos authentication.
|
| service-kerberos-name | No | String | Kerberos service name of the Redis instance (required when security mode is enabled). Example: 'redis/hadoop.{System domain name}' System domain name: You can log in to FusionInsight Manager, choose System > Permission > Domain and Mutual Trust, and check the value of Local Domain. |
[Example]
CREATE table redis_sink( account varchar, costs int, PRIMARY KEY(account) NOT ENFORCED ) WITH ( 'connector' = 'redis', 'deploy-mode'='cluster', 'need-kerberos-auth' = 'true', 'service-kerberos-name' = 'redis/hadoop.System domain name', 'login-context-name' = 'Client', 'host' = 'IP address of the Redis instance', 'port' = 'Port number of the Redis instance', 'isSSLMode' = 'true', 'data-type' = 'string', 'namespace' = 'redis_table_2', 'sink.batch.max-size' = '-1',--Indicates whether to enable batch write to Redis and the number of writes in a batch. The value -1 indicates that the function is disabled. To enable the function, you need to enable checkpointing as well. 'sink.flush-buffer.timeout' = '1000'--Indicates that once batch write to Redis is enabled, data in the queue can be updated to Redis at a specified time, accurate to millisecond. );
- To obtain the System domain name, log in to FusionInsight Manager, choose System > Permission > Domain and Mutual Trust, and record the value of Local Domain.
- host and port indicate the IP address and port number of an instance in the Redis cluster, respectively.
The port number of a Redis instance is calculated as follows: 22400 + Instance ID – 1.
To obtain the instance ID, log in to FusionInsight Manager and choose Cluster > Services > Redis. On the page that is displayed, click Redis Manager then click the target Redis cluster name.
For example, in the Redis cluster, the port number of the Redis instance that corresponds to the role R1 port is 22400 (22400 + 1 – 1 = 22400).
- namespace: Key used to concatenate the Redis database. Set it to a value in the format of Namespace value:Account value. For example, if the account value is A1 and the namespace value is redis_table_2, the value of this key in the Redis database is redis_table_2:A1.
- sink.batch.max-size:
- Enable batch write to Redis and set the number (positive integer) of records to be written in a batch. The value -1 indicates that batch write to Redis is disabled.
Enabling this function can improve the performance in big data scenarios, but it is not suitable for scenarios that have high requirements on real-time performance. It is recommended that the number of batch writes be no more than 30,000.
- To set this parameter, you need to enable checkpointing.
- Enable batch write to Redis and set the number (positive integer) of records to be written in a batch. The value -1 indicates that batch write to Redis is disabled.
- sink.flush-buffer.timeout indicates after enabling batch write to Redis, data in the queue can be flushed to Redis at a specified time, in millisecond.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot