The Redis sink allows you to write data to a Redis instance or cluster. Redis is a great choice for use cases where you need low-latency access to the outputs of your Arroyo pipeline.

The Redis sink relies on pipelining to achieve high throughput and is capable of writing millions of records per second to a single Redis instance.

Redis supports a variety of data structures. Currently, the Redis sink supports writing to the following data structures:

Each value in Redis is identified by a key. The configuration of the Redis sink allows you to construct the key in various ways, including a fixed prefix and a suffix constructed from the columns of the result.

The value for each record will be the serialized representation of the row, using the configured format.

Configuring the Connection

Redis sinks can be created in the Web UI or directly in SQL.

Redis sink creation in the Web UI

General configuration

addressThe address of a single, non-clustered Redis instanceNo*redis://localhost:6379
cluster.addressesA comma-separated list of addresses of Redis instances in a clusterNo*redis://localhost:6379,redis://localhost:6380
typeThe type of table (currently only sink is supported)Yessink
targetThe data type to write to. Currently, string, hash, and list are supportedYesstring
target.key_prefixA prefix that will be prepended to all keysYesoutputs.
target.key_columnsA column whose value will be appended to the key for each recordNoid

string target

target.ttl_secsThe time-to-live for each key in secondsNo3600

list target

target.max_lengthThe max length for this list; once the list exceeds this, the oldest elements will be droppedNo100
target.operationThe operation to perform on the list; one of ‘append’ (default) or ‘prepend’Noappend

hash target

target.field_columnThis column will be used as the field name in the hashYeskey


  user_id TEXT NOT NULL,
  event_count BIGINT NOT NULL,
) WITH (
    connector = 'redis',
    type = 'sink',
    format = 'json',
    'address' = 'redis://localhost:6379',
    target = 'string',
    'target.key_prefix' = 'outputs.',
    'target.key_column' = 'user_id'

SELECT user_id, count(*)
FROM events
    user_id, hop(interval '5 seconds', interval '1 hour');

Given the above query, we can see the following output in Redis:

$ redis-cli> GET outputs.fred