This guide describes how to sink data from RisingWave to Redis.
JSON
or TEMPLATE
), so a primary key must always be provided.
You can test out this process on your own device by using the redis-sink
demo in the integration_test directory of the RisingWave repository.
Name | Description |
---|---|
redis.url | Required. Choose either the Redis cluster address or a non-cluster Redis address.
|
primary_key | Required. The primary keys of the sink. If necessary, use , to delimit the primary key columns. |
FORMAT data_format ENCODE data_encode (key = 'value')
, instead of the WITH
clause.Field | Notes |
---|---|
data_format | Data format. Allowed formats:
|
data_encode | Data encoding. Supported encodings:
|
force_append_only | If true, forces the sink to be PLAIN (also known as append-only), even if it cannot be. |
key_format | Specify the format for the key as a string. |
value_format | Specify the format for the value as a string. |
key_encode | Optional.
|
redis_value_type | Optional. Controls how data is written to Redis. For details, see examples below.
|
channel | Optional. Required if redis_value_type = 'pubsub' and channel_column is not set. The name of the Redis Pub/Sub channel to publish messages to. |
channel_column | Optional. Required if redis_value_type = 'pubsub' and channel is not set. The values from this column will be used as the names of the Redis Pub/Sub channels to publish messages to. Must be type of VARCHAR . |
longitude | Optional. Required if redis_value_type = 'geospatial' . Contains the longitude value. Must be of type FLOAT , REAL , or VARCHAR . |
latitude | Optional. Required if redis_value_type = 'geospatial' . Contains the latitude value. Must be of type FLOAT , REAL , or VARCHAR . |
member | Optional. Required when redis_value_type = 'geospatial' . Contains the member names for the geospatial set. Must be of type VARCHAR and part of the primary key. |
redis_value_type = 'string'
or omit this parameter, as string
is the default.
Assume we create a materialized view, bhv_mv
, from a source.
bhv_mv
to Redis by creating a sink. Here, data_encode
is JSON
.
bhv_mv
to Redis by creating a sink. Here, data_encode
is TEMPLATE
, so key_format
and value_format
must be defined.
FORMAT UPSERT ENCODE TEMPLATE
, redis_value_type = 'geospatial'
, key_format
, longitude
, latitude
, and member
.
Assume we have a table t1
:
t1
:
FORMAT UPSERT ENCODE TEMPLATE
, redis_value_type = 'pubsub'
, and value_format
. At least one of channel
or channel_column
must also be specified.
Assume we have a table t1
:
t1
as messages to a predefined Redis Pub/Sub channel:
channel_column
: