Redis Stack is an extension of Redis that adds modern data models and processing engines to provide a complete developer experience. Redis Stack provides a simple and seamless way to access different data models such as full-text search, document store, graph, time series, and probabilistic data structures enabling developers to build any real-time data application.
In addition to all of the features of OSS Redis, Redis Stack supports:
- Queryable JSON documents
- Full-text search
- Time series data (ingestion & querying)
- Graph data models with the Cypher query language
- Probabilistic data structures
Redis Stack is made up of several components, licensed as follows:
- Redis Stack Server combines open source Redis with RediSearch, RedisJSON RedisGraph, RedisTimeSeries and RedisBloom is licensed under the Redis Source Available License (RSAL).
- RedisInsight is licensed under the Server Side Public License (SSPL).
The following core client libraries support Redis Stack:
The Redis OM client libraries let you use the document modeling, indexing, and querying capabilities of Redis Stack much like the way you’d use an ORM. The following Redis OM libraries support Redis Stack:
- Redis Enterprise Cloud
Create your free Redis Enterprise Cloud account. Once you click on “Get Started”, you will receive an email with a link to activate your account and complete your signup process.
For a limited time, use TIGER200 to get $200 credits on Redis Enterprise Cloud and try all the advanced capabilities!
For the cloud provider, select your preferred cloud. Select the region of your choice and then click "Let's start free".
If you want to create a custom database with your preferred name and type of Redis, click "Create a custom database".
Once fully activated, you will see the database endpoints as shown below:
RedisInsight is a visual tool that lets you do both GUI- and CLI-based interactions with your Redis database, and so much more when developing your Redis based application. It is a fully-featured pure Desktop GUI client that provides capabilities to design, develop and optimize your Redis application. It works with any cloud provider as long as you run it on a host with network access to your cloud-based Redis server. It makes it easy to discover cloud databases and configure connection details with a single click. It allows you to automatically add Redis Enterprise Software and Redis Enterprise Cloud databases.
You can install Redis Stack on your local system to get RedisInsight GUI tool up and running. Ensure that you have the
brew package installed in your Mac system.
You can easily find the Applications folder on your Mac with Finder. Search "RedisInsight-v2" and click the icon to bring up the Redis Desktop GUI tool.
Add the Redis Enterprise cloud database endpoint, port and password.
In this tutorial, we will go through an example of a bike shop. We will show the different capabilities of Redis Stack.
Choose "Redis Stack" from the left sidebar menu.
Let's examine the query for creating a single bike. Click "Create a bike" button:
It will display a
JSON.SET command with model, brand, price, type, specs and description details. The
bikes:1 is the name of the Redis key that the JSON will be stored in.
Click "Get specific fields" to access parts of a stored JSON document as shown in the following image:
Use homebrew to install Redis Stack on macOS, by following these instructions:
First, tap the Redis Stack Homebrew tap and then run
brew install as shown below:
This will install all Redis and Redis Stack binaries. How you run these binaries depends on whether you already have Redis installed on your system.
If this is the first time you’ve installed Redis on your system, then all Redis Stack binaries will be installed and on your path. On M1 Macs, this assumes that
/opt/homebrew/bin is in your path. On Intel-based Macs,
/usr/local/bin should be in the path.
To check this, run:
Then, confirm that the output contains
/opt/homebrew/bin (M1 Mac) or
/usr/local/bin (Intel Mac). If these directories are not in the output, see the “Existing Redis installation” instructions below.
You can now start Redis Stack Server as follows:
If you have an existing Redis installation on your system, then you’ll need to modify your path to ensure that you’re using the latest Redis Stack binaries.
Open the file
~/zshrc (depending on your shell), and add the following line.
Go to Applications and click "RedisInsight-v2" to bring up the Redis Desktop GUI tool.
Add the local Redis database endpoint and port.
Redis Stack provides you with a native time series data structure. Let's see how a time series might be useful in our bike shop.
As we have multiple physical shops too, alongside our online shop, it could be helpful to have an overview of the sales volume. We will create one time series per shop tracking the total amount of all sales. In addition, we will mark the time series with the appropriate region label, east or west. This kind of representation will allow us to easily query bike sales performance per certain time periods, per shop, per region or across all shops.
Click the "Guides" icon (just below the key) in the left sidebar and choose "Redis for time series" for this demonstration.
As shown in the following query, we make the shop id (1,2,3,4,5) a part of the time series name. You might also notice the
DUPLICATE_POLICY SUM argument; this describes what should be done when two events in the same time series share the same timestamp: In this case, it would mean that two sales happened at exactly the same time, so the resulting value should be a sum of the two sales amounts.
Since the metrics are collected with a millisecond timestamp, we can compact our time series into sales per hour:
RedisTimeSeries supports downsampling with the following aggregations: avg, sum, min, max, range, count, first and last. If you want to keep all of your raw data points indefinitely, your data set grows linearly over time. However, if your use case allows you to have less fine-grained data further back in time, downsampling can be applied. This allows you to keep fewer historical data points by aggregating raw data for a given time window using a given aggregation function.
You can run Redis Stack using a Docker container. There are two types of Docker images available in Docker Hub.
redis/redis-stackDocker image contains both Redis Stack server and RedisInsight. This container is recommended for local development because you can use RedisInsight to visualize your data.
redis/redis-stack-serverprovides Redis Stack but excludes RedisInsight. This container is best for production deployment.
To start Redis Stack server using the redis-stack image, run the following command in your terminal:
You can use
redis-cli to connect to the server, just as you connect to any Redis instance.
If you don’t have redis-cli installed locally, you can run it from the Docker container:
docker run command above also exposes RedisInsight on port 8001. You can use RedisInsight by pointing your browser to http://localhost:8001.
To persist your Redis data to a local path, specify -v to configure a local volume. This command stores all data in the local directory
If you want to expose Redis Stack server or RedisInsight on a different port, update the left hand of portion of the
-p argument. This command exposes Redis Stack server on port 10001 and RedisInsight on port 13333:
By default, the Redis Stack Docker containers use internal configuration files for Redis. To start Redis with a local configuration file, you can use the
-v volume options:
To pass in arbitrary configuration changes, you can set any of these environment variables:
REDIS_ARGS: extra arguments for Redis
REDISEARCH_ARGS: arguments for RediSearch
REDISJSON_ARGS: arguments for RedisJSON
REDISGRAPH_ARGS: arguments for RedisGraph
REDISTIMESERIES_ARGS: arguments for RedisTimeSeries
REDISBLOOM_ARGS: arguments for RedisBloom
For example, here’s how to use the
REDIS_ARGS environment variable to pass the
requirepass directive to Redis:
Here’s how to set a retention policy for RedisTimeSeries:
Follow this tutorial to learn how to implement low latency and compact Probabilistic data structures using Redis Stack.