This is the multi-page printable view of this section. Click here to print.
Install Redis Stack
1 - Install Redis Stack with binaries
Start Redis Stack Server
After untarring or unzipping your redis-stack-server download, you can start Redis Stack Server as follows:
/path/to/redis-stack-server/bin/redis-stack-server
Add the binaries to your PATH
You can add the redis-stack-server binaries to your $PATH
as follows:
Open the file ~/.bashrc
or '~/zshrc` (depending on your shell), and add the following lines.
export PATH=/path/to/redis-stack-server/bin:$PATH
If you have an existing Redis installation on your system, then you can choose override those override those PATH variables as before, or you can choose to only add redis-stack-server binary as follows:
export PATH=/path/to/redis-stack-server/bin/redis-stack-server:$PATH
Now you can start Redis Stack Server as follows:
redis-stack-server
2 - Run Redis Stack on Docker
To get started with Redis Stack using Docker, you first need to select a Docker image:
redis/redis-stack
contains both Redis Stack server and RedisInsight. This container is best for local development because you can use the embedded RedisInsight to visualize your data.redis/redis-stack-server
provides Redis Stack server only. This container is best for production deployment.
Getting started
redis/redis-stack-server
To start Redis Stack server using the redis-stack-server
image, run the following command in your terminal:
docker run -d --name redis-stack-server -p 6379:6379 redis/redis-stack-server:latest
You can that the Redis Stack server database to your RedisInsight desktop applicaiton.
redis/redis-stack
To start Redis Stack developer container using the redis-stack
image, run the following command in your terminal:
docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
The docker run
command above also exposes RedisInsight on port 8001. You can use RedisInsight by pointing your browser to http://localhost:8001.
Connect with redis-cli
You can then connect to the server using redis-cli
, 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 exec -it redis-stack redis-cli
Configuration
Persistence
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 local-data
:
$ docker run -v /local-data/:/data redis/redis-stack:latest
Ports
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
:
$ docker run -p 10001:6379 -p 13333:8001 redis/redis-stack:latest
Config files
By default, the Redis Stack Docker containers use internal configuration files for Redis. To start Redis with local configuration file, you can use the -v
volume options:
$ docker run -v `pwd`/local-redis-stack.conf:/redis-stack.conf -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
Environment variables
To pass in arbitrary configuration changes, you can set any of these environment variables:
REDIS_ARGS
: extra arguments for RedisREDISEARCH_ARGS
: arguments for RediSearchREDISJSON_ARGS
: arguments for RedisJSONREDISGRAPH_ARGS
: arguments for RedisGraphREDISTIMESERIES_ARGS
: arguments for RedisTimeSeriesREDISBLOOM_ARGS
: arguments for RedisBloom
For example, here's how to use the REDIS_ARGS
environment variable to pass the requirepass
directive to Redis:
docker run -e REDIS_ARGS="--requirepass redis-stack" redis/redis-stack:latest
Here's how to set a retention policy for RedisTimeSeries:
docker run -e REDISTIMESERIES_ARGS="RETENTION_POLICY=20" redis/redis-stack:latest
3 - Install Redis Stack on Linux
From the official Debian/Ubuntu APT Repository
You can install recent stable versions of Redis Stack from the official packages.redis.io APT repository. The repository currently supports Ubuntu Xenial (16.04), Ubuntu Bionic (18.04), and Ubuntu Focal (20.04). Add the repository to the apt index, update it and install:
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
sudo apt-get update
sudo apt-get install redis-stack-server
From the official offical RPM Feed
You can install recent stable versions of Redis Stack from the official packages.redis.io YUM repository. The repository currently supports RHEL7/CentOS7, and RHEL8/Centos8. Add the repository to the repository index, and install the package.
Create the file /etc/yum.repos.d/redis.repo with the following contents
[Redis]
name=Redis
baseurl=http://packages.redis.io/rpm/rhel7
enabled=1
gpgcheck=1
curl -fsSL https://packages.redis.io/gpg > /tmp/redis.key
sudo rpm --import /tmp/redis.key
sudo yum install epel-release
sudo yum install redis-stack-server
4 - Install Redis Stack on macOS
To install Redis Stack on macOS, use Homebrew. Make sure that you have Homebrew installed before starting on the installation instructions below.
There are three brew casks available.
redis-stack
contains bothredis-stack-server
andredis-stack-redisinsight
casks.redis-stack-server
provides Redis Stack server only.redis-stack-redisinsight
contains RedisInsight.
Install using Homebrew
First, tap the Redis Stack Homebrew tap:
brew tap redis-stack/redis-stack
Next, run brew install
:
brew install redis-stack
The redis-stack-server
cask will install all Redis and Redis Stack binaries. How you run these binaries depends on whether you already have Redis installed on your system.
First-time Redis installation
If this is the first time you've installed Redis on your system, then all Redis Stack binaries be installed and accessible from the $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:
echo $PATH
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.
Existing Redis installation
If you have an existing Redis installation on your system, then might want to modify your $PATH
to ensure that you're using the latest Redis Stack binaries.
Open the file ~/.bashrc
or '~/zshrc` (depending on your shell), and add the following lines.
For Intel-based Macs:
export PATH=/usr/local/Caskroom/redis-stack-server/<VERSION>/bin:$PATH
For M1 Macs:
export PATH=/opt/homebrew/Caskroom/redis-stack-server/<VERSION>/bin:$PATH
In both cases, replace <VERSION>
with your version of Redis Stack. For example, with version 6.2.0, path is as follows:
export PATH=/opt/homebrew/Caskroom/redis-stack-server/6.2.0/bin:$PATH
Start Redis Stack Server
You can now start Redis Stack Server as follows:
redis-stack-server
Installing Redis after installing Redis Stack
If you've already installed Redis Stack with Homebrew and then try to install Redis with brew install redis
, you may encounter errors like the following:
Error: The brew link step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/redis-benchmark
Target /usr/local/bin/redis-benchmark
already exists. You may want to remove it:
rm '/usr/local/bin/redis-benchmark'
To force the link and overwrite all conflicting files:
brew link --overwrite redis
To list all files that would be deleted:
brew link --overwrite --dry-run redis
In this case, you can overwrite the Redis binaries installed by Redis Stack by running:
brew link --overwrite redis
However, Redis Stack Server will still be installed. To uninstall Redis Stack Server, see below.
Uninstall Redis Stack
To uninstall Redis Stack, run:
brew uninstall redis-stack-redisinsight redis-stack-server redis-stack
brew untap redis-stack/redis-stack