Creating a Redis Table

Create a Redis table to connect to the source stream.

For details about the JOIN syntax, see JOIN Between Stream Data and Table Data.

Syntax

1
2
3
4
5
6
CREATE TABLE table_id (key_attr_name STRING(, hash_key_attr_name STRING)?, value_attr_name STRING)
  WITH (
    type = "dcs_redis",
    cluster_address = ""(,password = "")?,
    value_type= "",
    key_column= ""(,hash_key_column="")?);

Keywords

Table 1 Keywords

Parameter

Mandatory

Description

type

Yes

Output channel type. Value dcs_redis indicates that data is exported to DCS Redis.

cluster_address

Yes

Redis instance connection address.

password

No

Redis instance connection password. This parameter is not required if password-free access is used.

value_type

Yes

Indicates the field data type. Supported data types include string, list, hash, set, and zset.

key_column

Yes

Indicates the column name of the Redis key attribute.

hash_key_column

No

If value_type is set to hash, this field must be specified as the column name of the level-2 key attribute.

cache_max_num

No

Indicates the maximum number of cached query results. The default value is 32768.

cache_time

No

Indicates the maximum duration for caching database query results in the memory. The unit is millisecond. The default value is 10000. The value 0 indicates that caching is disabled.

Precautions

Example

The Redis table is used to connect to the source stream.
CREATE TABLE table_a (attr1 string, attr2 string, attr3 string)
  WITH (
    type = "dcs_redis",
    value_type = "hash",
    key_column = "attr1",
    hash_key_column = "attr2",
    cluster_address = "192.168.1.238:6379",
    password = "xxxxxxxx"
 );