> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackshift.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Redis

> Redis 8.10 with JSON, search, vector search, time series and Bloom filters built in.

> [!TIP]
>
> **Live.** This area is documented as current, user-reliable behavior.

## Goal

Use Redis for caches, queues and sessions, use its built-in JSON, search and vector features, and know what changes for existing Redis 7.4 databases.

## Prerequisites

* A StackShift account
* Any Redis client library

## Workflow

**Step 1**

Create a database and choose Redis. New databases run Redis 8.10.

**Step 2**

Connect with the `rediss://` connection string from the database page.

**Step 3**

Bind it to your app so `REDIS_URL` is set for you, then test a real job, cache write or session, not only `PING`.

## Versions

* New databases run Redis 8.10.
* Redis 6, 6.2, 7, 7.2 and 7.4 are not offered for new databases. Asking for one returns an error that tells you to use 8.10.
* In the API, CLI and Terraform the engine is `redis`.

## Built in

Redis 8 includes features that used to need Redis Stack. They are already loaded; there is nothing to turn on.

* JSON: store and update JSON documents with `JSON.SET` and `JSON.GET`.
* Search and query: secondary indexes, full-text search and vector similarity search with `FT.CREATE` and `FT.SEARCH`.
* Time series: `TS.ADD` and `TS.RANGE` for metrics and sensor data.
* Probabilistic structures: Bloom and Cuckoo filters, Count-Min Sketch and Top-K, for example `BF.ADD`.
* Vector sets: store vectors and run similarity queries with `VADD` and `VSIM`.

```text Vector search over hashes theme={null}
FT.CREATE docs_idx ON HASH PREFIX 1 doc: SCHEMA content TEXT embedding VECTOR HNSW 6 TYPE FLOAT32 DIM 1536 DISTANCE_METRIC COSINE

FT.SEARCH docs_idx "*=>[KNN 5 @embedding $vec AS score]" PARAMS 2 vec "<1536 float32 bytes>" SORTBY score RETURN 2 content score DIALECT 2
```

## Redis or Valkey

* Choose Redis when you want JSON, search, vector search, time series or Bloom filters in the same database as your cache and queues.
* Choose Valkey when you only need caching, queues, sessions and rate limits.
* Both speak the Redis protocol, use `rediss://` URLs and `REDIS_URL`, and work with the same client libraries.
* Licences: StackShift runs Redis 8 unmodified under the open-source AGPLv3 licence, and Valkey under the BSD licence. Connecting to either from your app does not change your app’s licence.

## Standby

An optional standby with automatic failover is rolling out for Redis and Valkey databases on StackShift servers. If your database page doesn't offer a standby, it isn't switched on for your account yet. Standbys are not available for databases on your own servers.

Turn it on from the database page or with `PUT /api/v1/databases/{id}/standby` and `{"mode": "async"}`; send `{"mode": "off"}` to turn it off. `sync` is not offered for Redis or Valkey. `GET /api/v1/databases/{id}/standby` shows its `state` (`enabling`, `active`, `degraded`, `failing_over`, `disabling`, `disabled` or `failed`), which server is serving (`master`: `home` or `standby`), how many failovers happened and when the last one was. The database needs a recent backup that passed its restore check first.

* The standby runs on another server. If the main server fails, the standby takes over in about 20 to 35 seconds.
* Your connection string and `REDIS_URL` never change; clients reconnect on their own.
* When the failed server comes back, it rejoins as the standby. Switching back to the main server pauses writes for 1 to 3 seconds.
* If only the standby is lost, your database keeps accepting writes.
* Copying to the standby is asynchronous, so a failover can lose about the last second of writes after a crash, or up to about 5 seconds if the main server is cut off from the network.
* Each failover shows up in your operations events.
* The standby is billed hourly as a second database of the same size.
* While a standby is on, stopping the database is refused. Deleting the database turns the standby off first.

## Existing Redis databases

Existing Redis 7.4 databases move to Redis 8.10 after this release, and we email you on the day. You do not need to change anything: your connection string, password and `REDIS_URL` stay the same.

* Every key, value and expiry time is copied and checked before the switch.
* For 1 to 5 minutes writes pause while reads keep working. Retrying a failed write after the window works.
* We keep your previous database read-only for 7 days in case anything needs to be rolled back.

## Limits

* Redis has no connection pooler; clients keep their own connections.
* Redis is not eligible for SQL Import / Export.

## Expected result

> [!TIP]
>
> Your app reads and writes keys through its usual Redis client, and `MODULE LIST` shows the JSON, search, time series and Bloom modules.

## Common failures

> [!WARNING]
>
> * `unsupported version` when creating with version 7.4 or older: use 8.10.
> * TLS handshake errors: connect with `rediss://` and the CA certificate from the database page.
> * `unknown command 'FT.CREATE'` or `'JSON.SET'`: the database is still on Redis 7.4. These commands work after it moves to Redis 8.
> * Writes fail for a few minutes on the day your database moves to Redis 8: retry after the window.

## Related guides

> **[Valkey](https://docs.stackshift.cloud/databases/valkey.md)**
>
> Valkey 9.0, a Redis-compatible key-value engine for caches, queues and sessions.

> **[Create a database](https://docs.stackshift.cloud/databases/create-a-database.md)**
>
> Create a hosted or connected-node database with private, direct public, or StackShift tunnel access.

> **[Database connections and tunneling](https://docs.stackshift.cloud/databases/credentials-pooling-and-usage.md)**
>
> Use private, direct public, or StackShift tunnel endpoints with TLS and explicit client IP policy.

> **[Back up and restore a database](https://docs.stackshift.cloud/databases/back-up-and-restore-a-database.md)**
>
> Use durable recovery storage correctly and understand why backups are independent from portable SQL transfers.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.