Destinations
Redis destination connector: setup and configuration
Connect Redis as an Artie destination. Artie writes each table's changes to a Redis Stream as JSON, or keeps each row's current values in a Redis hash. Covers TLS, ACL users, SSH tunnels and Redis Cluster.
Prerequisites
- Redis 5.0 or later, which added Redis Streams.
- Redis 6.0 or later to sign in with a username, because 6.0 added ACLs.
- Network access from Artie to your Redis host and port, either direct or through an SSH tunnel.
- If your Redis uses ACLs, a user that can run
XADDandDEL(stream mode) orEVAL,EXISTS,HMGET,HSET,DEL,EXPIREandPERSIST(state mode) on Artie’s keys. State mode also needsXADDwhen a table uses history mode. Set up Redis covers how to create it.
Set up Redis
These steps cover the Destination section of pipeline setup. If you reuse a Redis destination from another pipeline, setup skips Network access and Prepare destination.
Choose Redis
On Choose destination, select Redis.
Choose how Artie reaches Redis
On Network access, select one of two methods:
- Allowlist Artie IPs: allow the addresses listed under Artie IP addresses through your firewall.
- SSH tunnel: works for standalone Redis only. With TLS on, Artie still verifies the certificate against Host, not the tunnel.
Redis Cluster needs Allowlist Artie IPs. A cluster tells clients to connect to each node’s own address, which the tunnel doesn’t forward. Saving a cluster connector with a tunnel fails with
SSH tunnels aren't supported for Redis Cluster.The PrivateLink card can’t be selected for Redis. Through the API, saving with a PrivateLink connection fails with
PrivateLink isn't supported for Redis.Create a Redis user for Artie
If your Redis only uses a password (
requirepass), skip this step and leave Username (optional) blank when you connect.Artie writes to keys that start with
redis:<namespace>:, or<prefix>:<namespace>:when you set Key prefix (optional). The namespace ispublicunless you set one on the pipeline. Artie needsDELto drop a table’s stream, for example before a backfill set to Drop and recreate. In state mode, it also deletes rows withDEL.Run the command for your setup and Write mode against Redis. State mode writes each row with a Lua script, so the user needs
EVALand every command the script runs.For Stream mode, run:
Bashredis-cli ACL SETUSER artie on '>YOUR_PASSWORD' '~redis:public:*' +@connection +xadd +delFor State mode, run:
Bashredis-cli ACL SETUSER artie on '>YOUR_PASSWORD' '~redis:public:*' +@connection +eval +exists +hmget +hset +del +expire +persistThe cluster client also reads the slot map, so the user needs
CLUSTER SLOTS. For Stream mode, run:Bashredis-cli -p 7000 ACL SETUSER artie on '>YOUR_PASSWORD' '~redis:public:*' +@connection +xadd +del '+cluster|slots'For State mode, run:
Bashredis-cli -p 7000 ACL SETUSER artie on '>YOUR_PASSWORD' '~redis:public:*' +@connection +eval +exists +hmget +hset +del +expire +persist '+cluster|slots'Redis Cluster doesn’t copy ACL users between nodes. Run the command on every node, primaries and replicas alike, or create the user with your provider’s user management, such as ElastiCache user groups.
In state mode, history mode tables still write a stream. If any table uses history mode, add
+xaddto the state mode command.Replace
YOUR_PASSWORDwith the user’s password, andpublicwith your namespace if you set one. If you set Key prefix (optional), replacerediswith it. You choose Write mode later, on Connect and verify, so until then the Prepare destination step shows a command for each write mode. Each command works for both setups and also grantsCLUSTER SHARDS.If the user is missing a permission, Redis rejects the command, and the connection check or the write fails with a
NOPERMerror. The wording varies by Redis version. On Redis 7.2 and later, examples areNOPERM User artie has no permissions to run the 'cluster|slots' commandandNOPERM No permissions to access a key. In state mode, a command inside Artie’s script fails withACL failure in scriptinstead, such asACL failure in script: User artie has no permissions to run the 'hset' command. Add the missing command or key pattern to the user.Connect and verify Redis
On Connect and verify, fill in the connection settings:
Setting What to enter Host The Redis hostname or IP address. For Redis Cluster, use the configuration endpoint. Port The Redis port. Defaults to 6379.Username (optional) The ACL user you created for Artie. Leave it blank for password-only Redis. Password (optional) The user’s password, or the requirepasspassword.Cluster mode Turn this on for Redis Cluster, such as ElastiCache with cluster mode enabled. Database number The logical database to write to, 0or higher. Defaults to0. Hidden when Cluster mode is on.Write mode Stream (change log per table) appends every change to one stream per table. State (current row per key) keeps each row’s current values in one hash per primary key. A new connector starts on State (current row per key). A connector saved with no mode, such as one created before Write mode existed, uses Stream (change log per table). History mode tables always write a stream. See State mode. Key prefix (optional) Replaces redisat the start of every key, as in<prefix>:<namespace>:<table>. Leave it blank to useredis.Max stream length Stream mode only. Roughly how many entries each table’s stream keeps. Defaults to 0, which keeps every entry. See Stream length and trimming.TTL (seconds) State mode only. A row’s key expires this long after its last write. Defaults to 0, which never expires.Use TLS Turn this on if your Redis requires TLS. Artie uses TLS 1.2 or later and verifies the server certificate against Host. Namespace (optional) A prefix that groups this pipeline’s keys. Defaults to public.Redis Cluster only has database
0, so turning on Cluster mode sets the database to0. Through the API, a cluster connector with another database fails withRedis Cluster only supports database 0.Select Verify destination. The step shows Destination verified when the check passes.
Change the namespace on an existing pipeline
Namespace (optional) is on the pipeline’s Destination: Redis tab, and it’s locked while the pipeline is running. Pause the pipeline, change the namespace, then rename the existing keys in Redis to the new prefix. If you don’t rename them, Artie writes to new keys and your consumers miss the old ones.
How Artie writes to Redis
In Stream mode, Artie writes change events to Redis Streams, one stream per table. In State mode, Artie keeps each row in its own hash, as described in State mode. History mode tables always write a stream, in either mode.
Stream keys and entry format
Artie writes each table to its own Redis Stream with the key redis:<namespace>:<table>, for example redis:public:orders. With Key prefix (optional) set, the key starts with the prefix instead of redis.
Each stream entry has one field, data, holding the row as a JSON object keyed by column name. To read one entry, run:
redis-cli XRANGE redis:public:orders - + COUNT 1Redis returns the entry ID and the data field:
1) 1) "1791941136611-0"
2) 1) "data"
2) "{\"__artie_delete\":false,\"__artie_operation\":\"c\",\"id\":1042,\"price\":\"19.99\",\"status\":\"pending\"}"The row follows these rules:
- Every entry includes
__artie_operation:cfor create,ufor update,dfor delete, andrfor rows from a backfill. - In stream mode, Artie always adds
__artie_operation, whatever the pipeline’s Operation extra column setting says. __artie_deleteistruewhen the row was deleted in the source.- A delete entry leaves out columns that are
NULL. - Decimal values are JSON strings, such as
"19.99", so no precision is lost. - Other system columns appear when you turn them on under Extra columns in setup, or in the pipeline’s advanced settings.
To read the stream with a consumer group, first create the group:
redis-cli XGROUP CREATE redis:public:orders analytics 0 MKSTREAMThen read up to 100 new entries as the consumer worker-1:
redis-cli XREADGROUP GROUP analytics worker-1 COUNT 100 STREAMS redis:public:orders '>'Changes to the same row within a flush
Artie buffers changes and writes them when a flush rule triggers. Within one flush, it keeps only the latest change for each primary key. If a row is updated three times between flushes, the stream gets one entry with the final values. If a row is created and then deleted between flushes, the stream gets only the delete.
Shorter flush rules write intermediate changes more often, but don’t guarantee one entry per source change.
Delivery guarantees and retries
Delivery is at least once. Make your consumers idempotent, for example by upserting on the primary key.
- If a write to Redis fails, for any reason, Artie tries it up to 15 times, waiting up to 30 seconds between attempts.
- If every attempt fails, Artie reports a replication error, restarts, and tries again from its last committed position.
- Artie only commits its position after a write succeeds, so a failed write doesn’t lose changes. Artie writes them once Redis accepts writes again.
- Artie sends each flush’s entries to Redis in one pipeline, which isn’t a transaction. If a write fails partway through, the retry rewrites the entries that already landed, and consumers see them twice.
Stream length and trimming
Max stream length caps each table’s stream. Artie passes it to XADD as MAXLEN ~, so Redis trims old entries as Artie adds new ones. Trimming is approximate: Redis only removes whole internal nodes, so a stream can run over the cap. The cap applies to every stream the connector writes.
With the default of 0, Artie never trims, and each stream grows until you trim it with XTRIM. If Redis reaches maxmemory and can’t evict, it rejects writes with an OOM error. Artie keeps retrying as described in Delivery guarantees and retries. The pipeline makes no progress until you free memory or raise maxmemory.
State mode
With Write mode set to State (current row per key), Artie keeps each row’s current values in a Redis hash. The key is <prefix>:<namespace>:<table>:<primary key column>:<value>, for example redis:public:orders:id:1042. A composite primary key adds a :<column>:<value> pair for each key column. A : or % in the namespace, table, column or value is escaped as %3A or %25.
The hash follows these rules:
- Each column with a value is a field of the hash. A
NULLcolumn has no field. - Strings, decimals, timestamps and bytes (as base64) are stored as plain text, and other values as JSON.
- An update replaces the whole hash, except values the change doesn’t carry, such as an unchanged PostgreSQL TOAST value in a text column.
- A delete removes the key, unless soft delete is on, which keeps the hash and sets
__artie_delete. - Each write resets the key’s expiry to TTL (seconds). With
0, the key never expires. - A row appears once it changes in the source or is backfilled.
__artie_operationfollows the pipeline’s Operation extra column setting.
Redis Cluster
With Cluster mode on, Artie connects to the configuration endpoint and reads the cluster’s slot map. It writes each key to the node that owns it. In stream mode, each flush for a table writes to a single key, so all of its entries go to one node. In state mode, each row is its own key, so a table’s rows spread across nodes.
If Cluster mode is off and Host points at a cluster, Redis answers writes to keys on other nodes with MOVED <slot> <host>:<port>. Retrying doesn’t help, so the pipeline reports a replication error that contains MOVED. Turn on Cluster mode to fix it.
Limitations
- PrivateLink isn’t supported. Setup doesn’t offer it for Redis, and the API rejects it. Connect directly or through an SSH tunnel.
- Redis Cluster can’t use an SSH tunnel. Saving fails. Connect to the cluster directly and allow Artie’s IP addresses.
- Redis Cluster writes to database
0only. This is a Redis Cluster restriction. Use the namespace to separate pipelines. - State mode doesn’t support append-only pipelines. Artie doesn’t write to Redis in state mode while Append only (recommended) is on, a setting of Events API pipelines that the API also accepts as
appendOnly. Use stream mode for those pipelines. - Drop and recreate doesn’t clear state mode rows. Before a backfill set to Drop and recreate, Artie deletes only the key
<prefix>:<namespace>:<table>, which state mode doesn’t write. Row hashes stay, so a row that’s no longer in the source keeps its key until you delete it or TTL (seconds) expires it. - One stream length cap per connector. Max stream length applies to every table. To use different caps, create a separate Redis connector for those tables.
- Not every source change becomes an entry. Changes to the same row within one flush collapse into the latest. See Changes to the same row within a flush.
Frequently asked questions
Each answer links to the section that explains it.
Why are entries missing from my stream?
Redis trimmed them, or Artie collapsed them within a flush. Check Max stream length against how far your consumers fall behind, and see Changes to the same row within a flush.
Why do my consumers see the same entry twice?
A write failed partway and Artie retried it. Delivery is at least once, so make consumers idempotent. See Delivery guarantees and retries.
How do I tell a delete from an update?
Read __artie_operation. It’s d for deletes and u for updates, and every stream entry has it. See Stream keys and entry format.
Was this page helpful?
- Need help? Message us on Slack or email [email protected].
- Want a walkthrough? Book a demo.
- LLM? Read llms.txt.