Introduction
In this blog, we will discuss installing the Redis stack. But before going into that first, we would like you to know what Redis stack is and why it is popular.
Redis is defined as an open-source (BSD licensed), stored data structure in memory and used as a database, cache, message broker, and streaming the engine. Redis provides us with data structures like strings, lists, hashes, sets, bitmaps, streams, hyper logs etc. Functions like Replication, Lua Scripting, IRU eviction, Transaction and on-disk persistence of different levels are built-in in Redis. Redis is written in ANSI C language, and it works on most of the POSIX systems like Linux, *BSD, and Mac OS X.
Redis allows us to run the atomic operations like appending into a string, incrementing the value in the hash, pushing elements to a list, union, difference etc.
To achieve the top performance, Redis works with an in-memory dataset. Redis can persist our data by periodically dumping the dataset or appending each command to the disk-based log, depending on our use cases. We can also disable the persistence if we need a feature-rich, network, in-memory cache.
Next, in this blog, we will see how to Install the Redis stack.
Installing Redis Stack
Redis Works on most of the POSIX systems like Linux, *BSD, and MAC OS, X. We will discuss the installation process in detail.
How to install Redis Stack using tarballs
-
After Unzipping the Redis start-server download, start the Redis server by following the command.
/path/to/redis-stack-server/bin/redis-stack-server
-
To add Redis stack server binaries to your path, open the file using the ~/.bashrc or ~/zshrc command depending on your system and then type in the below command
export PATH=/path/to/redis-stack-server/bin:$PATH
-
If Redis installation is already done on your system, override that path variable, or you can choose to only add the Redis-stack-server binary by typing the following command
export PATH=/path/to/redis-stack-server/bin/redis-stack-server:$PATH
- Now start the Redis stack server by the Redis-stack-server command
How to install Redis Stack using Docker
First, select the Docker image
-
redis/redis-stack:- It contains both the Redis Stack server and RedisInsight. This container best suits local development because it allows us to use the embedded RedisInsight to visualise our data.
-
redis/redis-stack-server:- It provides a Redis Stack server only. This container is suited best for production deployment.
So depending on the docker image.
-
To start the Redis Stack server using the Redis-stack-server image, you need to run the following command in your terminal:
docker run -d --name redis-stack-server -p 6379:6379 redis/redis-stack-server:latest
To start the Redis Stack developer container using the Redis-stack image, you need to run the following command in your terminal:
docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
-
Now connect with the server using redis-cli. If you don't have it installed, you can run it from Docker Container.
$ docker exec -it redis-stack redis-cli
-
To Configure files By default, the Redis Stack Docker containers use internal configuration files for Redis. To start Redis with local configuration file, we 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
How to install Redis Stack on Linux
-
Install the recent stable version of the Redis stack from the official packages.redis.io APT repository
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
-
You can also install the recent stable version of the Redis stack from the official packages.redis.io YUM repository.
Create file /etc/yum.repos.d/redis.repo and add the following contents in it.
[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




