Upgrade Redis Enterprise for Kubernetes

Overview

Redis implements rolling updates for software upgrades in Kubernetes deployments. The upgrade process includes updating three components:

  1. [Upgrade the Redis Enterprise operator](#upgrade-the-operator)
  1. [Upgrade the Redis Enterprise cluster (REC)](#upgrade-the-redis-enterprise-cluster-rec)
  1. [Upgrade Redis Enterprise databases (REDB)](#upgrade-databases)

Prerequisites

Before upgrading, ensure you have the minimum versions of all components necessary for your target version. **Without these minimum versions, the upgrade may freeze and require manual recovery.**

See the [troubleshooting](#troubleshooting) section for details on recovering a failed upgrade.

Kubernetes version

Check [Supported Kubernetes distributions]() to make sure your Kubernetes distribution is supported by your target Redis Enterprise operator version. If not, upgrade your Kubernetes distribution before upgrading the Redis operator.

Redis operator version

Check the [Redis Enterprise for Kubernetes release notes]() for the minimum operator version required for your target upgrade. Some versions may require intermediate upgrades.

Redis database version

Check the release notes for your target version to determine the minimum Redis database version required. See [upgrade databases](#upgrade-databases) for detailed steps. You can find your database version in the [REDB `spec.redisVersion` field]().

User-defined modules

If your databases use user-defined modules (custom non-bundled modules):

- Set `autoUpgradeRedisEnterprise: false` in the REC custom resource before upgrading the operator.
- Define the user-defined modules in the REC custom resource before upgrading the database.
- See [Edit `redisEnterpriseImageSpec`](#edit-redisenterpriseimagespec-in-the-rec-spec) for more details.

For more information about user-defined modules, see [User-defined modules]().

Valid license

Upgrade with Helm charts

If you installed the Redis Enterprise operator using Helm charts, you can upgrade using Helm commands. This method automatically handles the operator upgrade and Custom Resource Definition (CRD) updates.

To upgrade using Helm:

[code example]

For example:

[code example]

For OpenShift installations, include the `openshift.mode=true` parameter:

[code example]

After the Helm upgrade completes, continue with [upgrading the Redis Enterprise cluster (REC)](#upgrade-the-redis-enterprise-cluster-rec) and [upgrading databases](#upgrade-databases).

For detailed Helm upgrade instructions, see [Upgrade the chart]().

Upgrade the operator

If your databases use user-defined modules, set `autoUpgradeRedisEnterprise: false` in the REC custom resource before upgrading the operator.

Download the bundle

Make sure you pull the correct version of the bundle. You can find the version tags
by checking the [operator releases on GitHub](https://github.com/RedisLabs/redis-enterprise-k8s-docs/releases)
or by [using the GitHub API](https://docs.github.com/en/rest/reference/repos#releases).

You can download the bundle for the latest release with the following `curl` command:

[code example]

If you need a different release, replace `VERSION` in the above with a specific release tag.

Apply the bundle

Apply the bundle to deploy the new operator binary. This will also apply any changes in the new release to custom resource definitions, roles, role binding, or operator service accounts.

If you are not pulling images from Docker Hub, update the operator image spec to point to your private repository.
If you have made changes to the role, role binding, RBAC, or custom resource definition (CRD) in the previous version, merge them with the updated declarations in the new version files.

Upgrade the bundle and operator with a single command, passing in the bundle YAML file:

[code example]

After running this command, you should see a result similar to this:

[code example]

If you have the admission controller enabled, you need to manually reapply the `ValidatingWebhookConfiguration`.

Verify the operator is running

You can check your deployment to verify the operator is running in your namespace.

[code example]

You should see a result similar to this:

[code example]

We recommend upgrading the REC as soon as possible after updating the operator. After the operator upgrade completes, the operator suspends the management of the REC and its associated REDBs, until the REC upgrade completes.

The Redis Enterprise cluster (REC) can be updated automatically or manually. To trigger automatic upgrade of the REC after the operator upgrade completes, specify `autoUpgradeRedisEnterprise: true` in your REC spec. If you don't have automatic upgrade enabled, follow the below steps for the manual upgrade.

Before beginning the upgrade of the Redis Enterprise cluster, check the [Redis Enterprise for Kubernetes release notes]() to find the Redis Enterprise image tag for your target version.

After the operator upgrade is complete, you can upgrade Redis Enterprise cluster (REC).

For Active-Active databases, we recommend upgrading all participating clusters to the same operator version.

Edit `redisEnterpriseImageSpec` in the REC spec

1. Edit the REC custom resource YAML file.

    [code example]

1. Replace the `versionTag:` declaration under `redisEnterpriseImageSpec` with the new version tag.

    [code example]

1. Define any user-defined modules used by databases in the cluster.

    [code example]

  The `name` field must match the `display_name` or `module_name` that appears in the module manifest (for example, "redisgears"). This enables the operator to run validation on the user-defined module. If these names don't match, the operator can't run validation on the user-defined module and preventable errors may occur.

Adding or modifying the `userDefinedModules` list triggers a rolling restart of the Redis Enterprise cluster pods in addition to the rolling upgrade for the version change.

1. Save the changes to apply.

Reapply roles and role bindings

If your operator is monitoring multiple namespaces, you'll need to [reapply your role and role bindings]() for each managed namespace. See [Manage databases in multiple namespaces]() for more details.

Monitor the upgrade

You can view the state of the REC with `kubectl get rec`.

  During the upgrade, the state should be `Upgrade`.
  When the upgrade is complete and the cluster is ready to use, the state will change to `Running`.
  If the state is `InvalidUpgrade`, there is an error (usually relating to configuration) in the upgrade.

[code example]

To see the status of the current rolling upgrade, run:

[code example]

Upgrade databases

After the cluster is upgraded, you can upgrade your databases.

Upgrade REDB

To upgrade your REDB, specify your new database version in the `spec.redisVersion` field in the REDB or REAADB custom resources. Supported database versions for operator versions include "7.2", "7.4", "8.0", and "8.2" (note this value is a string).

Upgrade REAADB

For Active-Active databases, the `redis.Version` change only needs to be applied on one participating cluster and will automatically propagate to all other participating clusters. All participating clusters must be running operator version 8.0.2-2 or later.

If your REAADB uses supported modules, keep the existing `moduleList` version numbers unchanged when upgrading `redisVersion`. The database will automatically use the module versions that are bundled with the new Redis version, regardless of what versions are specified in `moduleList`. After the upgrade is complete, you can optionally change the old version numbers from `moduleList`, but this change has no functional impact.

Upgrade with user-defined modules

If a user-defined module is used by any database in the cluster, the module must be defined in the REC custom resource before upgrading the database. See [Add user-defined modules to the REC]() for detailed instructions.

Upgrade policy

Note that if your cluster [`redisUpgradePolicy`]() or your database [`redisVersion`]() are set to `major`, you won't be able to upgrade those databases to minor versions. See [Redis upgrade policy]() for more details.

Troubleshooting

If you start an upgrade without meeting the [prerequisites](#prerequisites), the operator will freeze the upgrade. Check the operator logs for the source of the error. The REDB reconsilliation doesn't work during an upgrade, so you need to apply a manual fix with the Redis Software API (examples below). The updates will also need to be added to the REDB custom resource.

User-defined modules

If your databases use user-defined modules and you encounter upgrade issues:

1. **Verify `autoUpgradeRedisEnterprise` is set to `false`**: Check the REC spec to ensure automatic upgrades are disabled.

    [code example]

1. **Verify modules are defined in the REC**: Ensure all user-defined modules are listed in the REC `userDefinedModules` section before upgrading.

    [code example]

1. **Check module validation errors**: Review the REC status for module validation errors.

    [code example]

For more information about user-defined modules, see [User-defined modules]().

Invalid module version

If the operator logs show an event related to an unsupported module, download the updated module locally, and install it using the `v2/modules` API endpoint.

[code example]

After updating the database with the Redis Software API, update the REDB custom resource to reflect the change.

Invalid database version

If the operator logs show an event related to an incompatible database version, upgrade the database using the Redis Software API.

[code example]

After updating the modules with the Redis Software API, update the REDB custom resource to reflect the change.

helm upgrade my-redis-enterprise redis/redis-enterprise-operator --version <chart-version>

helm upgrade <release-name> redis/redis-enterprise-operator --version <chart-version> \
    --set openshift.mode=true

VERSION=`curl --silent https://api.github.com/repos/RedisLabs/redis-enterprise-k8s-docs/releases/latest | grep tag_name | awk -F'"' '{print $4}'`
curl --silent -O https://raw.githubusercontent.com/RedisLabs/redis-enterprise-k8s-docs/$VERSION/bundle.yaml

$ kubectl get rec
NAME   NODES   VERSION      STATE     SPEC STATUS   LICENSE STATE   SHARDS LIMIT   LICENSE EXPIRATION DATE   AGE
rec    3       8.0.2-17   Upgrade   Valid         Valid           4              2022-07-16T13:59:00Z      92m

kubectl get rec <cluster-name> -o jsonpath='{.spec.autoUpgradeRedisEnterprise}'

kubectl get rec <cluster-name> -o jsonpath='{.spec.userDefinedModules}' | jq


Redis Open Source

Summary: Operate Redis Open Source. Redis 8 in Redis Open Source replaces Redis Stack.

Summary: How to install Redis Open Source on your target platform

Install Redis Open Source

Summary: An administrator's guide to Redis

Manage Redis

Redis Open Source and Redis Software

Summary: Redis Open Source reference documentation

Reference

Overview

Since 2009, the Redis open source project has inspired an enthusiastic and active community of users and contributors. We continue to be committed to fostering an open, welcoming, diverse, inclusive, and healthy community.

Original developer and core team

[Salvatore Sanfilippo](https://github.com/antirez) built, led, and maintained the Redis open source project. In 2020, Salvatore Sanfilippo named two successors to take over and lead the Redis project: Yossi Gottlieb [yossigo](https://github.com/yossigo) and Oran Agra [oranagra](https://github.com/oranagra). Salvatore [returned to Redis in 2024](https://antirez.com/news/144).

Code of Conduct

Redis has adopted the [Contributor Covenant Code of Conduct](https://github.com/redis/redis/blob/unstable/CODE_OF_CONDUCT.md).

Getting help

On the [Redis Discord server](https://discord.gg/redis), you can chat with members of the Redis community in real time. You'll meet Redis users, contributors, and developer advocates. This is a great place to stop in for quick questions or to share your latest Redis discoveries.

Stack Overflow

Have a question about Redis? Search the [Stack Overflow Redis tag](https://stackoverflow.com/questions/tagged/redis) for answers, or post a question of your own.

Redis news

For occasional updates on the new Redis releases, you can [check out the What’s New section](https://redis.io/docs/latest/develop/whats-new/).

To keep up with the latest from Redis Inc., including news on Redis Cloud and Redis Stack, consider [following the Redis Twitter feed](https://twitter.com/redisinc).

Conferences and meetups

Redis regularly sponsors conferences, webinars, and meetups. Check out the [Redis events](https://redis.io/events/) page for details.

Contributing to Redis

The Redis core source repository is hosted under [https://github.com/redis/redis](https://github.com/redis/redis) along with many of the client libraries. Commits to the Redis source repository will require code review, approval of at least one reviewer who is not the author of the commit, and no objections.

There are many ways to contribute to Redis, starting with documentation all the way to changes to the open source Redis server. Here are a few ways you can get involved.

Contributing to docs

The [Redis docs](https://github.com/redis/docs) are open source, and we'd love to incorporate your contributions. For small changes and typos, we recommend working in a fork and creating a [pull request](https://github.com/redis/docs/pulls). Your first PR will prompt you to sign the contributor license agreement. Approved PRs will be published with the next batch of changes to the docs site.

Reporting bugs

To report a bug in Redis, create a [Redis Github issue](https://github.com/redis/redis/issues).

For larger changes, we ask that you first create an issue describing your proposed changes. This is a good way to get feedback in advance to increase the likelihood that your changes will be accepted.

Client libraries

The Redis [client libraries]() are nearly always open source and accepting of contributions. Consult the contribution guidelines for the library you're interested in.


Install Redis Community Edition or Redis Stack

Summary: How to install your preferred Redis flavor on your target platform

Summary: Install Redis on Linux, macOS, and Windows

Install Redis

Summary: Install Redis Stack on Linux, macOS, and Windows

Install Redis Stack

Content

You can install [Redis](https://redis.io/about/) or [Redis Stack](https://redis.io/about/about-stack/) locally on your machine. Redis and Redis Stack are available on Linux, macOS, and Windows.

Here are the installation instructions:

* [Install Redis]()
* [Install Redis Stack]()

While you can install Redis or Redis Stack locally, you might also consider using Redis Cloud by creating a [free account](https://redis.com/try-free/?utm_source=redisio&utm_medium=referral&utm_campaign=2023-09-try_free&utm_content=cu-redis_cloud_users).


Install Redis

Summary: How to install Redis on Linux

Install Redis on Linux

Summary: Use Homebrew to install and start Redis on macOS

Install Redis on macOS

Summary: Use Redis on Windows through Memurai, official Redis partner for Windows compatibility

Install Redis on Windows

Summary: Compile and install Redis from source

Install Redis from Source

Overview

This is a an installation guide. You'll learn how to install, run, and experiment with the Redis server process.

While you can install Redis on any of the platforms listed below, you might also consider using Redis Cloud by creating a [free account](https://redis.com/try-free?utm_source=redisio&utm_medium=referral&utm_campaign=2023-09-try_free&utm_content=cu-redis_cloud_users). You can also download [Redis Insight](), a free developer tool that works with Redis.

Install Redis Open Source

How you install Redis depends on your operating system. See the guide below that best fits your needs:

* [Install Redis on Linux]()
* [Install Redis on macOS]()
* [Install Redis on Windows]()

Refer to [Redis Administration]() for detailed setup tips.

Test if you can connect using the CLI

After you have Redis up and running, you can connect using `redis-cli`.

External programs talk to Redis using a TCP socket and a Redis specific protocol. This protocol is implemented in the Redis client libraries for the different programming languages. However, to make hacking with Redis simpler, Redis provides a command line utility that can be used to send commands to Redis. This program is called **redis-cli**.

The first thing to do to check if Redis is working properly is sending a **PING** command using redis-cli:

[code example]

Running **redis-cli** followed by a command name and its arguments will send this command to the Redis instance running on localhost at port 6379. You can change the host and port used by `redis-cli` - just try the `--help` option to check the usage information.

Another interesting way to run `redis-cli` is without arguments: the program will start in interactive mode. You can type different commands and see their replies.

[code example]

Securing Redis

By default Redis binds to **all the interfaces** and has no authentication at all. If you use Redis in a very controlled environment, separated from the external internet and in general from attackers, that's fine. However, if an unhardened Redis is exposed to the internet, it is a big security concern. If you are not 100% sure your environment is secured properly, please check the following steps in order to make Redis more secure:

1. Make sure the port Redis uses to listen for connections (by default 6379 and additionally 16379 if you run Redis in cluster mode, plus 26379 for Sentinel) is firewalled, so that it is not possible to contact Redis from the outside world.
2. Use a configuration file where the `bind` directive is set in order to guarantee that Redis listens on only the network interfaces you are using. For example, only the loopback interface (127.0.0.1) if you are accessing Redis locally from the same computer.
3. Use the `requirepass` option to add an additional layer of security so that clients will be required to authenticate using the [`AUTH`](/commands/auth) command.
4. Use [spiped](http://www.tarsnap.com/spiped.html) or another SSL tunneling software to encrypt traffic between Redis servers and Redis clients if your environment requires encryption.

Note that a Redis instance exposed to the internet without any security [is very simple to exploit](http://antirez.com/news/96), so make sure you understand the above and apply **at least** a firewall layer. After the firewall is in place, try to connect with `redis-cli` from an external host to confirm that the instance is not reachable.

Use Redis from your application

Of course using Redis just from the command line interface is not enough as the goal is to use it from your application. To do so, you need to download and install a Redis client library for your programming language.

You'll find a [full list of supported clients for different languages in this page]().

Redis persistence

You can learn [how Redis persistence works on this page](). It is important to understand that, if you start Redis with the default configuration, Redis will spontaneously save the dataset only from time to time. For example, after at least five minutes if you have at least 100 changes in your data. If you want your database to persist and be reloaded after a restart make sure to call the **SAVE** command manually every time you want to force a data set snapshot. Alternatively, you can save the data on disk before quitting by using the **SHUTDOWN** command:

[code example]

This way, Redis will save the data on disk before quitting. Reading the [persistence page]() is strongly suggested to better understand how Redis persistence works.

Install Redis properly

Running Redis from the command line is fine just to hack a bit or for development. However, at some point you'll have some actual application to run on a real server. For this kind of usage you have two different choices:

* Run Redis using screen.
* Install Redis in your Linux box in a proper way using an init script, so that after a restart everything will start again properly.

A proper install using an init script is strongly recommended.

The available packages for supported Linux distributions already include the capability of starting the Redis server from `/etc/init`.

The remainder of this section assumes you've [installed Redis from its source code]().

The following instructions can be used to perform a proper installation using the init script shipped with the Redis source code, `/path/to/redis-stable/utils/redis_init_script`.

If you have not yet run `make install` after building the Redis source, you will need to do so before continuing. By default, `make install` will copy the `redis-server` and `redis-cli` binaries to `/usr/local/bin`.

* Create a directory in which to store your Redis config files and your data:

    [code example]

* Copy the init script that you'll find in the Redis distribution under the **utils** directory into `/etc/init.d`. We suggest calling it with the name of the port where you are running this instance of Redis. Make sure the resulting file has `0755` permissions.

    [code example]

* Edit the init script.

    [code example]

Make sure to set the **REDISPORT** variable to the port you are using.
Both the pid file path and the configuration file name depend on the port number.

* Copy the template configuration file you'll find in the root directory of the Redis distribution into `/etc/redis/` using the port number as the name, for instance:

    [code example]

* Create a directory inside `/var/redis` that will work as both data and working directory for this Redis instance:

    [code example]

* Edit the configuration file, making sure to perform the following changes:
    * Set **daemonize** to yes (by default it is set to no).
    * Set the **pidfile** to `/var/run/redis_6379.pid`, modifying the port as necessary.
    * Change the **port** accordingly. In our example it is not needed as the default port is already `6379`.
    * Set your preferred **loglevel**.
    * Set the **logfile** to `/var/log/redis_6379.log`.
    * Set the **dir** to `/var/redis/6379` (very important step!).
* Finally, add the new Redis init script to all the default runlevels using the following command:

    [code example]

You are done! Now you can try running your instance with:

[code example]

Make sure that everything is working as expected:

1. Try pinging your instance within a `redis-cli` session using the [`PING`](/commands/ping) command.
2. Do a test save with `redis-cli save` and check that a dump file is correctly saved to `/var/redis/6379/dump.rdb`.
3. Check that your Redis instance is logging to the `/var/log/redis_6379.log` file.
4. If it's a new machine where you can try it without problems, make sure that after a reboot everything is still working.

The above instructions don't include all of the Redis configuration parameters that you could change. For example, to use AOF persistence instead of RDB persistence, or to set up replication, and so forth. Further details can be found in the [configuration article on this site]().

<hr>

$ redis-cli
redis 127.0.0.1:6379> ping
PONG

sudo mkdir /etc/redis
    sudo mkdir /var/redis

sudo cp utils/redis_init_script /etc/init.d/redis_6379


Install Redis from Source

Summary: Compile and install Redis from source

Overview

You can compile and install Redis from source on variety of platforms and operating systems including Linux and macOS. Redis has no dependencies other than a C  compiler and `libc`.

Downloading the source files

The Redis source files are available from the [Download](https://redis.io/downloads) page. You can verify the integrity of these downloads by checking them against the digests in the [redis-hashes git repository](https://github.com/redis/redis-hashes).

To obtain the source files for the latest stable version of Redis from the Redis downloads site, run:

wget https://download.redis.io/redis-stable.tar.gz

Compiling Redis

To compile Redis, first extract the tarball, change to the root directory, and then run `make`:

tar -xzvf redis-stable.tar.gz
cd redis-stable
make

To build with TLS support, you'll need to install OpenSSL development libraries (e.g., libssl-dev on Debian/Ubuntu) and then run:

make BUILD_TLS=yes

If the compile succeeds, you'll find several Redis binaries in the `src` directory, including:

* **redis-server**: the Redis Server itself
* **redis-cli** is the command line interface utility to talk with Redis.

To install these binaries in `/usr/local/bin`, run:

sudo make install

Starting and stopping Redis in the foreground

Once installed, you can start Redis by running

redis-server

If successful, you'll see the startup logs for Redis, and Redis will be running in the foreground.

To stop Redis, enter `Ctrl-C`.

For a more complete installation, continue with [these instructions]().


Install Redis on Linux

Summary: How to install Redis on Linux

Overview

Most major Linux distributions provide packages for Redis.

Install on Ubuntu/Debian

Add the repository to the APT index, update it, and install Redis:

sudo apt-get install lsb-release curl gpg
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
sudo chmod 644 /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

Redis will start automatically, and it should restart at boot time. If Redis doesn't start across reboots, you may need to manually enable it:

sudo systemctl enable redis-server
sudo systemctl start redis-server

Install on Red Hat/Rocky

sudo yum install redis
sudo systemctl enable redis
sudo systemctl start redis

Redis will restart at boot time.

Install on Ubuntu using Snap

To install via Snap, run:

sudo apt update
sudo apt install redis-tools # for redis-cli
sudo snap install redis

Redis will start automatically, but it won't restart at boot time. To do this, run:

sudo snap set redis service.start=true

You can use these additional snap-related commands to start, stop, restart, and check the status of Redis:

* `sudo snap start redis`
* `sudo snap stop redis`
* `sudo snap restart redis`
* `sudo snap services redis`

If your Linux distribution does not currently have Snap installed, you can install it using the instructions described  [here](https://snapcraft.io/docs/installing-snapd). Then, consult the [Snapcraft store](https://snapcraft.io/redis) for instructions on installing Redis using Snap for your distribution.

Starting and stopping Redis in the background

You can start the Redis server as a background process using the `systemctl` command. This only applies to Ubuntu/Debian when installed using `apt`, and Red Hat/Rocky when installed using `yum`.

sudo systemctl start <redis-service-name> # redis or redis-server depending on platform

To stop the server, use:

sudo systemctl stop <redis-service-name> # redis or redis-server depending on platform

Connect to Redis

Once Redis is running, you can test it by running `redis-cli`:

redis-cli

Test the connection with the `ping` command:

127.0.0.1:6379> ping
PONG

You can also test that your Redis server is running using
[Redis Insight]().

Next steps

Once you have a running Redis instance, you may want to:

* Try the [Redis CLI tutorial]()
* Connect using one of the [Redis clients]()
* [Install Redis "properly"]()
  for production use.


Install Redis on macOS

Overview

This guide shows you how to install Redis on macOS using Homebrew. Homebrew is the easiest way to install Redis on macOS. If you'd prefer to build Redis from the source files on macOS, see [Installing Redis from Source]().

The Homebrew distribution of Redis Open Source is only supported on macOS.

Prerequisites

First, make sure you have Homebrew installed. From the terminal, run:

brew --version

If this command fails, you'll need to [follow the Homebrew installation instructions](https://brew.sh/).

Installation

From the terminal, run:

brew install redis

This will install Redis on your system.

To test your Redis installation, you can run the `redis-server` executable from the command line:

redis-server

If successful, you'll see the startup logs for Redis, and Redis will be running in the foreground.

To stop Redis, enter `Ctrl-C`.

Starting and stopping Redis using launchd

As an alternative to running Redis in the foreground, you can also use `launchd` to start the process in the background:

brew services start redis

This launches Redis and restarts it at login. You can check the status of a `launchd` managed Redis by running the following:

brew services info redis

If the service is running, you'll see output like the following:

redis (homebrew.mxcl.redis)
Running: ✔
Loaded: ✔
User: miranda
PID: 67975

To stop the service, run:

brew services stop redis

Connect to Redis

Next steps


Install Redis on Windows

Run Redis on Windows using Memurai

Redis is now natively supported on Windows through [Memurai](https://www.memurai.com/), the official Redis partner for Windows compatibility.

Run Redis on Windows using WSL (Windows Subsystem for Linux)

To install Redis on Windows using WSL, you'll first need to enable [WSL2](https://docs.microsoft.com/en-us/windows/wsl/install) (Windows Subsystem for Linux). WSL2 lets you run Linux binaries natively on Windows. For this method to work, you'll need to be running Windows 10 version 2004 and higher or Windows 11.

Install or enable WSL2

Microsoft provides [detailed instructions for installing WSL](https://docs.microsoft.com/en-us/windows/wsl/install). Follow these instructions, and take note of the default Linux distribution it installs. This guide assumes Ubuntu.

Install Redis

Once you're running Ubuntu on Windows, you can follow the steps detailed at [Install on Ubuntu/Debian]() to install recent stable versions of Redis from the official `packages.redis.io` APT repository.
Add the repository to the apt index, update it, and then 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

Lastly, start the Redis server like so:

redis-server --daemonize yes

Connect to Redis

Next steps


Install Redis Stack from binaries

Summary: How to install Redis Stack using tarballs

Start Redis Stack Server

Install the openssl libraries for your platform. For example, on a Debian or Ubuntu instance run:

sudo apt install libssl-dev

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

If you're running redis-stack-server on a mac, please ensure you have openssl installed, via [homebrew](https://brew.sh/).

Now you can start Redis Stack Server as follows:

redis-stack-server


Run Redis Stack on Docker

Summary: How to install Redis Stack using Docker

Overview

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 Redis Insight. This container is best for local development because you can use the embedded Redis Insight 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

redis/redis-stack

To start a Redis Stack 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 Redis Insight on port 8001. You can use Redis Insight by pointing your browser to `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 in Docker

To mount directories or files to your Docker container, 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 Redis Insight on a different port, update the left hand of portion of the `-p` argument. This command exposes Redis Stack server on port `10001` and Redis Insight 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 Redis

* `REDISEARCH_ARGS`: arguments for the search and query features (RediSearch)

* `REDISJSON_ARGS`: arguments for JSON (RedisJSON)

* `REDISTIMESERIES_ARGS`: arguments for time series (RedisTimeSeries)

* `REDISBLOOM_ARGS`: arguments for  the probabilistic data structures (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

An example of setting [Redis persistence]():

docker run -e REDIS_ARGS="--save 60 1000 --appendonly yes" redis/redis-stack:latest

Here's how to set a retention policy for time series:

docker run -e REDISTIMESERIES_ARGS="RETENTION_POLICY=20" redis/redis-stack:latest


Install Redis Stack

Summary: How to install Redis Stack on Linux

Install Redis Stack on Linux

Summary: How to install Redis Stack on macOS

Install Redis Stack on macOS

Summary: How to install Redis Stack on Windows

Install Redis Stack on Windows

Summary: How to install Redis Stack using Docker

Run Redis Stack on Docker

Install Redis Stack from binaries

Content

While you can install Redis Stack on any of the platforms listed below, you might also consider using Redis Cloud by creating a [free account](https://redis.com/try-free/?utm_source=redisio&utm_medium=referral&utm_campaign=2023-09-try_free&utm_content=cu-redis_cloud_users).

<hr/>


Install Redis Stack on Linux

Summary: How to install Redis Stack on Linux

Overview

Learn how to install Redis Stack on Linux from the official APT repository or RPM feed, or with Snap or AppImage.

From the official Ubuntu/Debian APT Repository

See [this page](https://redis.io/downloads/#redis-stack-downloads) for a complete list of supported Ubuntu/Debian platforms.
Add the repository to the APT index, update it, and install Redis Stack:

sudo apt-get install lsb-release curl gpg
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
sudo chmod 644 /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

Redis will not start automatically, nor will it start at boot time. To do this, run the following commands.

sudo systemctl enable redis-stack-server
sudo systemctl start redis-stack-server

From the official Red Hat/Rocky RPM Feeds

See [this page](https://redis.io/downloads/#redis-stack-downloads) for a complete list of supported Red Hat/Rocky platforms.
Follow these steps to install Redis Stack.

1. Create the file `/etc/yum.repos.d/redis.repo` with the following contents.

    [Redis]
    name=Redis
    baseurl=http://packages.redis.io/rpm/rhel9 # replace rhel9 with the appropriate value for your platform
    enabled=1
    gpgcheck=1

1. Run the following commands:

    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

Redis will not start automatically, nor will it start at boot time. To do this, run the following commands.

sudo systemctl enable redis-stack-server
sudo systemctl start redis-stack-server

On Ubuntu with Snap

First, download the latest Redis Stack snap package from [this page](https://redis.io/downloads/).

To install, run:

sudo apt update
sudo apt install redis-tools
sudo snap install --dangerous --classic <snapname.snap>

Redis will not start automatically, nor will it start at boot time. To start `redis-stack-server` in the foreground, run the command:

sudo snap run redis-stack-server

To stop Redis, enter `Ctrl-C`.

Follow these steps to integrate Redis Stack with `systemd` so you can start/stop in/from the background:

1. Edit the `/etc/systemd/system/redis-stack-server.service` file and enter the following information:

    [Unit]
    Description=Redis Stack Server
    After=network.target

    [Service]
    ExecStart=/usr/bin/snap run redis-stack-server
    Restart=always
    User=root
    Group=root

    [Install]
    WantedBy=multi-user.target

1. Run the following commands.

    sudo systemctl daemon-reload
    sudo systemctl start redis-stack-server
    sudo systemctl enable redis-stack-server

If your Linux distribution does not currently have Snap installed, you can install it using the instructions described  [here](https://snapcraft.io/docs/installing-snapd). Then, download the appropriate from the [downloads page](https://redis.io/downloads/).

On Ubuntu with AppImage

Fuse needs to be installed before proceeding. Install it as follows.

sudo apt update
sudo apt install fuse

Next, download the latest Redis Stack AppImage package from [this page](https://redis.io/downloads/).

To run the image, execute these commands:

sudo apt update
sudo apt install redis-tools
chmod a+x <AppImageFile> # replace AppImageFile with the name of your downloaded file
./<AppImageFile>

This will start Redis in the foreground. To stop Redis, enter `Ctrl-C`.

Follow these steps to integrate Redis Stack with `systemd` so you can start/stop in/from the background:

1. Edit the `/etc/systemd/system/redis-appimage.service` file and enter the following information:

    [Unit]
    Description=Redis Server (AppImage)
    After=network.target

    [Service]
    ExecStart=/path/to/your/<AppImageFile> --daemonize no
    Restart=always
    User=redis-user   # replace with an existing user or create a new one
    Group=redis-group # replace with an existing group or create a new one

    [Install]
    WantedBy=multi-user.target

1. Run the following commands.

    sudo systemctl daemon-reload
    sudo systemctl start redis-appimage
    sudo systemctl enable redis-appimage

Starting and stopping Redis Stack in the background

You can start the Redis server as a background process using the `systemctl` command. This only applies to Ubuntu/Debian when installed using `apt`, and Red Hat/Rocky when installed using `yum`.

sudo systemctl start redis-stack-server

To stop the service, use:

sudo systemctl stop redis-stack-server

Connect to Redis

Once Redis is running, you can test it by running `redis-cli`:

redis-cli

Test the connection with the `ping` command:

127.0.0.1:6379> ping
PONG

You can also test that your Redis server is running using
[Redis Insight]().

Next steps

Once you have a running Redis instance, you may want to:

* Try the [Redis CLI tutorial]()
* Connect using one of the [Redis clients]()
* [Install Redis properly]()
  for production use.


Install Redis Stack on macOS

Summary: How to install Redis Stack on macOS

Overview

To install Redis Stack on macOS, use [Homebrew](https://brew.sh/). Make sure that you have [Homebrew installed](https://docs.brew.sh/Installation) before starting on the installation instructions below.

There are three brew casks available.

* `redis-stack` contains both `redis-stack-server` and `redis-stack-redisinsight` casks.
* `redis-stack-server` provides Redis Stack server only.
* `redis-stack-redisinsight` contains Redis Insight.

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, you need to be sure that your `PATH` variable includes the Redis Stack installation location. This location is either `/opt/homebrew/bin` for Apple silicon Macs or `/usr/local/bin` for Intel-based Macs.

To check this, run:

echo $PATH

Then, confirm that the output contains `/opt/homebrew/bin` (Apple silicon Macs) or `/usr/local/bin` (Intel Mac). If these directories are not in the output, see the "Existing Redis installation" instructions below.

Because Redis Stack is installed using a brew cask via the `brew tap` command, it will not be integrated with the `brew services` command.

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 Apple silicon 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

Connect to Redis

Next steps

Once you have a running Redis instance, you may want to:

* Try the [Redis CLI tutorial]()
* Connect using one of the [Redis clients]()
* [Install Redis "properly"]()
  for production use.


Install Redis Stack on Windows

Summary: How to install Redis Stack on Windows

Run Redis on Windows using Memurai

Redis is now natively supported on Windows through [Memurai](https://www.memurai.com/), the official Redis partner for Windows compatibility.

Run Redis on Windows using Docker

To install Redis Stack on Windows, you will need to have Docker installed. When Docker is up and running, open Windows PowerShell and follow the instructions described in [Run Redis Stack on Docker](). Then, use Docker to connect with `redis-cli` as explained in that topic.

If you attempt to use Windows Subsystem for Linux (WSL) or Ubuntu for Windows to follow [Linux instructions](), you will get a `systemd` error telling you `System has not been booted with systemd as init system (PID 1). Can't operate.` Do not fret. Just use Docker.

_`systemd` is a suite of basic building blocks for a Linux system._ For more information about its function, see [System and Service Manager](https://systemd.io/). This becomes an issue due to the lack of support for Linux workflows on WSL. But, you can test the instructions listed in [Systemd support is now available in WSL!](https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/). Let us know how that worked for you.


Build and run Redis Open Source on AlmaLinux/Rocky Linux 8.10

Overview

Follow the steps below to build and run Redis Open Source from its source code on a system running AlmaLinux and Rocky Linux 8.10.

Docker images used to produce these build notes:
- AlmaLinux:
    - almalinux:8.10
    - almalinux:8.10-minimal
- Rocky Linux:
    - rockylinux/rockylinux:8.10
    - rockylinux/rockylinux:8.10-minimal

1. Prepare the system

For 8.10-minimal, you'll need to install `sudo` and `dnf` as follows:

[code example]

For 8.10 (regular), you'll need to install `sudo` as follows:

[code example]

Clean the package metadata, enable required repositories, and install development tools:

[code example]

2. Install required packages

Install the build dependencies, Python 3.11, and supporting tools:

[code example]

Create a Python virtual environment:

[code example]

Enable the GCC toolset:

[code example]

3. Install CMake

Install CMake 3.25.1 manually:

[code example]

4. Download and extract the Redis source

The Redis source code is available from [the Redis GitHub site](https://github.com/redis/redis/releases). Select the release you want to build and then select the .tar.gz file from the **Assets** drop down menu. You can verify the integrity of these downloads by checking them against the digests in the [redis-hashes GitHub repository](https://github.com/redis/redis-hashes).

Copy the tar(1) file to `/usr/src`.

Alternatively, you can download the file directly using the `wget` command, as shown below.

[code example]

Replace `<version>` with the three-digit Redis release number, for example `8.0.0`.

Extract the source:

[code example]

5. Build Redis

Enable the GCC toolset and build Redis with support for TLS and modules:

[code example]

6. (Optional) Verify the installation

Check the installed Redis server and CLI versions:

[code example]

7. Start Redis

To start Redis, use the following command:

[code example]

To validate that the available modules have been installed, run the [`INFO`] command and look for lines similar to the following:

[code example]

8. (Optional) Install Redis to its default location

[code example]

sudo dnf clean all

# Add GoReleaser repo
sudo tee /etc/yum.repos.d/goreleaser.repo > /dev/null <<EOF
[goreleaser]
name=GoReleaser
baseurl=https://repo.goreleaser.com/yum/
enabled=1
gpgcheck=0
EOF

sudo dnf update -y
sudo dnf groupinstall "Development Tools" -y
sudo dnf config-manager --set-enabled powertools
sudo dnf install -y epel-release

sudo dnf install -y --nobest --skip-broken \
    pkg-config \
    wget \
    gcc-toolset-13-gcc \
    gcc-toolset-13-gcc-c++ \
    git \
    make \
    openssl \
    openssl-devel \
    python3.11 \
    python3.11-pip \
    python3.11-devel \
    unzip \
    rsync \
    clang \
    curl \
    libtool \
    automake \
    autoconf \
    jq \
    systemd-devel

sudo cp /opt/rh/gcc-toolset-13/enable /etc/profile.d/gcc-toolset-13.sh
echo "source /etc/profile.d/gcc-toolset-13.sh" | sudo tee -a /etc/bashrc

CMAKE_VERSION=3.25.1
ARCH=$(uname -m)

if [ "$ARCH" = "x86_64" ]; then
  CMAKE_FILE=cmake-${CMAKE_VERSION}-linux-x86_64.sh
else
  CMAKE_FILE=cmake-${CMAKE_VERSION}-linux-aarch64.sh
fi

wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_FILE}
chmod +x ${CMAKE_FILE}
./${CMAKE_FILE} --skip-license --prefix=/usr/local --exclude-subdir
rm ${CMAKE_FILE}

cmake --version

cd /usr/src
wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz

cd /usr/src
tar xvf redis-<version>.tar.gz
rm redis-<version>.tar.gz

source /etc/profile.d/gcc-toolset-13.sh
cd /usr/src/redis-<version>

export BUILD_TLS=yes
export BUILD_WITH_MODULES=yes
export INSTALL_RUST_TOOLCHAIN=yes
export DISABLE_WERRORS=yes

make -j "$(nproc)" all

./src/redis-server --version
./src/redis-cli --version

cd /usr/src/redis-<version>
sudo make install


Build and run Redis Open Source on AlmaLinux/Rocky Linux 9.5

Overview

Follow the steps below to build and run Redis Open Source from its source code on a system running AlmaLinux and Rocky Linux 9.5.

Docker images used to produce these build notes:
- AlmaLinux:
    - almalinux:9.5
    - almalinux:9.5-minimal
- Rocky Linux:
    - rockylinux/rockylinux:9.5
    - rockylinux/rockylinux:9.5-minimal

1. Prepare the system

For 9.5-minimal, you'll need to install `sudo` and `dnf` as follows:

[code example]

For 9.5 (regular), you'll need to install `sudo` as follows:

[code example]

Enable the GoReleaser repository and install required packages:

[code example]

2. Install required packages

Install build dependencies, GCC toolset, Python, and utilities:

[code example]

Create a Python virtual environment:

[code example]

Enable the GCC toolset:

[code example]

3. Install CMake

Install CMake version 3.25.1 manually:

[code example]

5. Build Redis

Enable the GCC toolset and compile Redis with TLS and module support:

[code example]

6. (Optional) Verify the installation

Check that Redis was installed successfully:

[code example]

7. Start Redis

[code example]

sudo tee /etc/yum.repos.d/goreleaser.repo > /dev/null <<EOF
[goreleaser]
name=GoReleaser
baseurl=https://repo.goreleaser.com/yum/
enabled=1
gpgcheck=0
EOF

sudo dnf clean all
sudo dnf makecache
sudo dnf update -y

sudo dnf install -y --nobest --skip-broken \
    pkg-config \
    xz \
    wget \
    which \
    gcc-toolset-13-gcc \
    gcc-toolset-13-gcc-c++ \
    git \
    make \
    openssl \
    openssl-devel \
    python3 \
    python3-pip \
    python3-devel \
    unzip \
    rsync \
    clang \
    curl \
    libtool \
    automake \
    autoconf \
    jq \
    systemd-devel


Build and run Redis Open Source on Debian 12 (Bookworm)

Overview

Follow the steps below to build and run Redis Open Source from its source code on a system running Debian 12 (Bookworm).

Docker images used to produce these build notes:
- debian:bookworm
- debian:bookworm-slim

1. Install required dependencies

First, update your package lists and install the development tools and libraries needed to build Redis:

[code example]

2. Download and extract the Redis source

3. Build Redis

Set the appropriate environment variables to enable TLS, modules, and other build options, then compile and install Redis:

[code example]

This builds the Redis server, CLI, and any included modules.

4. (Optional) Verify the installation

You can confirm that Redis has been built and installed successfully by checking the version:

[code example]

5. Start Redis

6. (Optional) Install Redis to its default location

[code example]

apt-get update
apt-get install -y sudo
sudo apt-get install -y --no-install-recommends \
    ca-certificates \
    wget \
    dpkg-dev \
    gcc \
    g++ \
    libc6-dev \
    libssl-dev \
    make \
    git \
    cmake \
    python3 \
    python3-pip \
    python3-venv \
    python3-dev \
    unzip \
    rsync \
    clang \
    automake \
    autoconf \
    libtool

cd /usr/src/redis-<version>
export BUILD_TLS=yes
export BUILD_WITH_MODULES=yes
export INSTALL_RUST_TOOLCHAIN=yes
export DISABLE_WERRORS=yes

make -j "$(nproc)" all

cd /usr/src/redis-version
sudo make install


Build and run Redis Open Source on Debian 11 (Bullseye)

Overview

Follow the steps below to build and run Redis Open Source from its source code on a system running Debian 11 (Bullseye).

Docker images used to produce these build notes:
- debian:bullseye
- debian:bullseye-slim

1. Install required dependencies

3. Build Redis

4. (Optional) Verify the installation

5. Start Redis

[code example]


Build and run Redis Open Source

Summary: Build and run Redis 8 in Redis Open Source on Linux and macOS

Build and run Redis Open Source on Ubuntu 20.04 (Focal)

Build and run Redis Open Source on Ubuntu 22.04 (Jammy)

Build and run Redis Open Source on Ubuntu 24.04 (Noble)

Build and run Redis Open Source on macOS 13 (Ventura) and macOS 14 (Sonoma)

Content

Build instructions are provided for the following platforms:


Overview

Follow the steps below to build and run Redis Open Source from its source code on a system running macOS 13 (Ventura) and macOS 14 (Sonoma).

1. Install homebrew

If Homebrew isn't already installed, follow the installation instructions on the [Homebrew home page](https://brew.sh).

2. Install required packages

[code example]

3. Install Rust

Rust is required to build the JSON package.

[code example]

The Redis source code is available from [the Redis GitHub site](https://github.com/redis/redis/releases). Select the release you want to build and then select the .tar.gz file from the **Assets** drop down menu. You can verify the integrity of these downloads by checking them against the digests in the [redis-hashes GitHub repository](https://github.com/redis/redis-hashes).

Create a directory for the src, for example `~/src`.

[code example]

Copy the tar(1) file to `~/src`.

Alternatively, you can download the file directly using the `wget` command, as shown below.

[code example]

Replace `<version>` with the three-digit Redis release number, for example `8.0.0`.

Extract the source:

[code example]

5. Build Redis

[code example]

6. (Optional) Verify the installation

Check the installed Redis server and CLI versions:

[code example]

7. Start Redis

To start Redis, use the following command:

[code example]

To validate that the available modules have been installed, run the [`INFO`] command and look for lines similar to the following:

[code example]

export HOMEBREW_NO_AUTO_UPDATE=1
brew update
brew install coreutils
brew install make
brew install openssl
brew install llvm@18
brew install cmake
brew install gnu-sed
brew install automake
brew install libtool
brew install wget

RUST_INSTALLER=rust-1.80.1-$(if [ "$(uname -m)" = "arm64" ]; then echo "aarch64"; else echo "x86_64"; fi)-apple-darwin
wget --quiet -O ${RUST_INSTALLER}.tar.xz https://static.rust-lang.org/dist/${RUST_INSTALLER}.tar.xz
tar -xf ${RUST_INSTALLER}.tar.xz
(cd ${RUST_INSTALLER} && sudo ./install.sh)

cd ~/src
wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz

tar xvf redis-<version>.tar.gz
rm redis-<version>.tar.gz

cd ~/src/redis-<version>
export HOMEBREW_PREFIX="$(brew --prefix)"
export BUILD_WITH_MODULES=yes
export BUILD_TLS=yes
export DISABLE_WERRORS=yes
PATH="$HOMEBREW_PREFIX/opt/libtool/libexec/gnubin:$HOMEBREW_PREFIX/opt/llvm@18/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
export LDFLAGS="-L$HOMEBREW_PREFIX/opt/llvm@18/lib"
export CPPFLAGS="-I$HOMEBREW_PREFIX/opt/llvm@18/include"

mkdir -p build_dir/etc
make -C redis-8.0 -j "$(nproc)" all OS=macos
make -C redis-8.0 install PREFIX=$(pwd)/build_dir OS=macos

build_dir/bin/redis-server --version
build_dir/bin/redis-cli --version

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
build_dir/bin/redis-server redis-full.conf


Overview

Follow the steps below to build and run Redis Open Source from its source code on a system running Ubuntu 20.04 (Focal).

Docker images used to produce these build notes:
- ubuntu:20.04

1. Install required dependencies

Update your package lists and install the necessary development tools and libraries:

[code example]

2. Use GCC 10 as the default compiler

Update the system's default compiler to GCC 10:

[code example]

3. Install CMake

Install CMake using `pip3` and link it for system-wide access.

CMake version 3.31.6 is the latest supported version. Newer versions cannot be used.

[code example]

The Redis source code is available from [the Redis GitHub site](https://github.com/redis/redis/releases). Select the release you want to build and then select the .tar.gz file from the **Assets** drop down menu. You can verify the integrity of these downloads by checking them against the digests in the [redis-hashes GitHub repository](https://github.com/redis/redis-hashes).

Copy the tar(1) file to `/usr/src`.

Alternatively, you can download the file directly using the `wget` command, as shown below.

[code example]

Replace `<version>` with the three-digit Redis release number, for example `8.0.0`.

Extract the source:

[code example]

5. Build Redis

Set the necessary environment variables and compile Redis:

[code example]

6. (Optional) Verify the installation

Confirm the Redis installation:

[code example]

7. Start Redis

[code example]

apt-get update
apt-get install -y sudo
sudo apt-get install -y --no-install-recommends \
    ca-certificates \
    wget \
    dpkg-dev \
    gcc \
    g++ \
    libc6-dev \
    libssl-dev \
    make \
    git \
    python3 \
    python3-pip \
    python3-venv \
    python3-dev \
    unzip \
    rsync \
    clang \
    automake \
    autoconf \
    gcc-10 \
    g++-10 \
    libtool

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10

pip3 install cmake==3.31.6
sudo ln -sf /usr/local/bin/cmake /usr/bin/cmake
cmake --version

cd /usr/src
wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz

cd /usr/src
tar xvf redis-<version>.tar.gz
rm redis-<version>.tar.gz

./src/redis-server --version
./src/redis-cli --version

cd /usr/src/redis-<version>
sudo make install


Overview

Follow the steps below to build and run Redis Open Source from its source code on a system running Ubuntu 22.04 (Jammy).

Docker images used to produce these build notes:
- ubuntu:22.04

1. Install required dependencies

First, update your package lists and install the development tools and libraries needed to build Redis:

[code example]

2. Install CMake

3. Download and extract the Redis source

4. Build Redis

Set the appropriate environment variables to enable TLS, modules, and other build options, then compile and install Redis:

[code example]

This builds the Redis server, CLI, and any included modules.

5. (Optional) Verify the installation

You can confirm that Redis has been built and installed successfully by checking the version:

[code example]

6. Start Redis

7. (Optional) Install Redis to its default location

[code example]

apt-get update
apt-get install -y sudo
sudo apt-get install -y --no-install-recommends \
    ca-certificates \
    wget \
    dpkg-dev \
    gcc \
    g++ \
    libc6-dev \
    libssl-dev \
    make \
    git \
    cmake \
    python3 \
    python3-pip \
    python3-venv \
    python3-dev \
    unzip \
    rsync \
    clang \
    automake \
    autoconf \
    libtool

cd /usr/src/redis-<version>
export BUILD_TLS=yes
export BUILD_WITH_MODULES=yes
export INSTALL_RUST_TOOLCHAIN=yes
export DISABLE_WERRORS=yes

make -j "$(nproc)" all


Overview

Follow the steps below to build and run Redis Open Source from its source code on a system running Ubuntu 24.04 (Noble).

Docker images used to produce these build notes:
- ubuntu:24.04

1. Install required dependencies

3. Build Redis

4. (Optional) Verify the installation

5. Start Redis

[code example]


Install Redis Open Source

Summary: Install Redis Open Source on Docker, Linux, macOS, and Windows (using Docker only)

Install Redis Open Source

Summary: Upgrade Redis Open Source

Upgrade Redis Open Source

Build and run Redis Open Source

Summary: Describes Redis Open Source supported database versions.

Redis Open Source version management

Install Redis Community Edition or Redis Stack

Content

You can install [Redis Open Source]() locally on your machine. Redis Open Source is available on Docker, Linux, macOS, and Windows (using Docker only).

You can also download [Redis Insight](), a free developer companion tool with an intuitive GUI and advanced CLI, which you can use alongside Redis Open Source.

Here are the installation and upgrade instructions:

* [Install Redis Open Source]()
* [Upgrade Redis Open Source]()

While you can install Redis Open Source locally, you might also consider using Redis Cloud by creating a [free account](https://redis.com/try-free/?utm_source=redisio&utm_medium=referral&utm_campaign=2023-09-try_free&utm_content=cu-redis_cloud_users).


Install Redis Open Source on Linux

Summary: How to install Redis Open Source using APT

Install Redis Open Source on Ubuntu or Debian Linux using APT

Add the repository to the APT index, update it, and install Redis Open Source:

sudo apt-get install lsb-release curl gpg
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
sudo chmod 644 /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

The most recent version of Redis Open Source will be installed, along with the redis-tools package (redis-cli, etc.).
If you need to install an earlier version, run the following command to list the available versions:

apt policy redis

redis:
  Installed: (none)
  Candidate: 6:8.6.1-1rl1~noble1
  Version table:
     6:8.6.1-1rl1~noble1 500
        500 https://packages.redis.io/deb noble/main amd64 Packages
        500 https://packages.redis.io/deb noble/main all Packages
     6:8.6.0-1rl1~noble1 500
        500 https://packages.redis.io/deb noble/main amd64 Packages
        500 https://packages.redis.io/deb noble/main all Packages
     ...
     6:8.0.0-1rl1~noble1 500
        500 https://packages.redis.io/deb noble/main amd64 Packages
        500 https://packages.redis.io/deb noble/main all Packages
     6:7.4.8-1rl1~noble1 500
        500 https://packages.redis.io/deb noble/main amd64 Packages
        500 https://packages.redis.io/deb noble/main all Packages

For example, to install Redis Open Source v7.4.8 on Ubuntu LTS 24.04 (Noble Numbat), run the following command:

sudo apt-get install \
redis=6:7.4.8-1rl1~noble1 \
redis-server=6:7.4.8-1rl1~noble1 \
redis-sentinel=6:7.4.8-1rl1~noble1 \
redis-tools=6:7.4.8-1rl1~noble1

Alternatively, you can also set up a preferences file to pin a particular release:

Package: redis redis-server redis-sentinel redis-tools
Pin: version 6:7.4.*
Pin-Priority: 1001

See [this document](https://manpages.debian.org/buster/apt/apt_preferences.5.en.html#How_APT_Interprets_Priorities) for more information on `Pin-Priority`.

With the example preferences file give above, `6:7.4.8-1rl1~noble1` is the latest version that matches the pinned version and it will be installed when you run this command:

sudo apt-get install redis-server redis-sentinel redis-tools

Redis should start automatically after the initial installation and also at boot time.
Should that not be the case on your system, run the following commands:

sudo systemctl enable redis-server
sudo systemctl start redis-server


Run Redis Open Source on Docker

Summary: How to run Redis Open Source using Docker

Install Docker

Follow the Docker installation instructions for your operating system:

- [Linux](https://docs.docker.com/desktop/setup/install/linux/)
- [macOS](https://docs.docker.com/docker-for-mac/install/)
- [Windows](https://store.docker.com/editions/community/docker-ce-desktop-windows)

On Windows, make sure Docker is configured to run Linux-based containers.

Run Redis Open Source on Docker

To start the Redis Open Source server using the `redis:<version>` image, run the following command in your terminal:

docker run -d --name redis -p 6379:6379 redis:<version>

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 redis-cli

If you do have `redis-cli` installed locally, you can run it from your terminal:

$ redis-cli -h 127.0.0.1 -p 6379

Use a local configuration file

By default, the Redis Docker containers use internal configuration files for Redis. To start Redis with local configuration file, you can do one of the following:

You can create your own Dockerfile that adds a `redis.conf` from the context into `/data/`, like so.

[code example]
Alternatively, you can specify something along the same lines with docker run options.

$ docker run -v /myredis/conf:/usr/local/etc/redis --name myredis redis redis-server /usr/local/etc/redis/redis.conf

where `/myredis/conf/` is a local directory containing your `redis.conf` file. Using this method means that there is no need for you to have a Dockerfile for your redis container.

The mapped directory should be writable, as depending on the configuration and mode of operation, Redis may need to create additional configuration files or rewrite existing ones.

Use local storage for data persistence

To mount directories or files to your Docker container, specify -v to configure a local volume. This command stores all data in the local directory local-data:

$ docker run -v /local-data/:/data --name redis -p 6379:6379 redis:<version>

See the [official Redis page on Docker Hub](https://hub.docker.com/_/redis) for more options.

FROM redis
COPY redis.conf /usr/local/etc/redis/redis.conf
CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]


Install Redis Open Source on macOS

Summary: How to install Redis Open Source on macOS using Homebrew

Install Redis Open Source on macOS using Homebrew

Installation using Homebrew is only supported on macOS.

To install Redis Open Source on macOS, use [Homebrew](https://brew.sh/).
Make sure that you have [Homebrew installed](https://docs.brew.sh/Installation) before starting on the installation instructions below.

Remove any existing Redis installation files

If you had previously installed Redis on your system using the default Homebrew formula called "redis", you need to remove it before installing Redis Open Source 8.x.

Follow these steps to remove any existing Redis installation files:

1. Uninstall Redis:
    [code example]
1. Next check if the `redis.conf` file is still installed:
    [code example]

    If you get output similar to the following, then it’s still there:

    [code example]

    Run this command to remove the file:

    [code example]

Next, follow the instructions in the [next section](#install-using-homebrew) to install Redis Open Source 8.x using the Redis Homebrew cask.

Install using Homebrew {#install-using-homebrew}

First, tap the Redis Homebrew cask:

brew tap redis/redis

Next, run `brew install`:

brew install --cask redis

Run Redis

If this is the first time you've installed Redis on your system, you need to be sure that your `PATH` variable includes the Redis installation location. This location is either `/opt/homebrew/bin` for Apple silicon Macs or `/usr/local/bin` for Intel-based Macs.

To check this, run:

echo $PATH

Next, confirm that the output contains `/opt/homebrew/bin` (Apple silicon Macs) or `/usr/local/bin` (Intel Mac). If neither `/opt/homebrew/bin` nor `/usr/local/bin` are in the output, add them.

Open the file `~/.bashrc` or `~/.zshrc` (depending on your shell), and add the following line.

export PATH=$(brew --prefix)/bin:$PATH

You can now start the Redis server as follows:

redis-server $(brew --prefix)/etc/redis.conf

The server will run in the background.

Because Redis is installed using a Homebrew cask with the `brew tap` command, it will not be integrated with the `brew services` command.

Connect to Redis

Once Redis is running, you can test it by running `redis-cli`:

redis-cli

Test the connection with the `ping` command:

127.0.0.1:6379> PING
PONG

Verify that all modules are loaded correctly

If you had previously installed earlier versions of Redis using Homebrew, for example 7.2.x or 7.4.x, you should test to see if all the modules are loaded correctly by running the following command. Your output should look similar to the following:

$ redis-cli MODULE LIST
1) 1) "name"
   2) "bf"
   3) "ver"
   4) (integer) 80200
   5) "path"
   6) "/usr/local/lib/redis/modules//redisbloom.so"
   7) "args"
   8) (empty array)
2) 1) "name"
   2) "timeseries"
   3) "ver"
   4) (integer) 80200
   5) "path"
   6) "/usr/local/lib/redis/modules//redistimeseries.so"
   7) "args"
   8) (empty array)
3) 1) "name"
   2) "search"
   3) "ver"
   4) (integer) 80201
   5) "path"
   6) "/usr/local/lib/redis/modules//redisearch.so"
   7) "args"
   8) (empty array)
4) 1) "name"
   2) "vectorset"
   3) "ver"
   4) (integer) 1
   5) "path"
   6) ""
   7) "args"
   8) (empty array)
5) 1) "name"
   2) "ReJSON"
   3) "ver"
   4) (integer) 80200
   5) "path"
   6) "/usr/local/lib/redis/modules//rejson.so"
   7) "args"
   8) (empty array)

Stop Redis

Run the following command:

redis-cli SHUTDOWN

Uninstall Redis Open Source

To uninstall Redis, run:

brew uninstall redis
brew untap redis/redis

Next steps

Once you have a running Redis instance, you may want to:

* Try the [Redis CLI tutorial]()
* Connect using one of the [Redis clients]()
* Connect using [Redis Insight]()

-rw-r--r--@ 1 user  admin  122821  2 Oct 16:07 /opt/homebrew/etc/redis.conf


Install Redis Open Source

Run Redis Open Source on Docker

Install Redis Open Source on Linux

Summary: How to install Redis Open Source using RPM

Install Redis Open Source on Linux

Summary: How to install Redis Open Source using Snap

Install Redis Open Source on Linux

Install Redis Open Source on macOS

Summary: How to run Redis Open Source on Windows

Run Redis Open Source on Windows using Docker

Content

The latest version of Redis Open Source has been tested on the following platforms:

- Ubuntu 22.04 (Jammy Jellyfish) and 24.04 (Noble Numbat).
- Rocky Linux 8.10, 9.5.
- AlmaLinux 8.10, 9.5, and 10.1.
- Debian 12 (Bookworm) and 13 (Trixie).
- macOS 14 (Sonoma), and 15 (Sequoia).

Follow the links below for installation instructions for your OS and distribution.

While you can install Redis Open Source on any of the platforms listed below, you might also consider using Redis Cloud by creating a [free account](https://redis.com/try-free/?utm_source=redisio&utm_medium=referral&utm_campaign=2023-09-try_free&utm_content=cu-redis_cloud_users).

You can also download [Redis Insight](), a free developer companion tool with an intuitive GUI and advanced CLI, which you can use alongside Redis Open Source.

<hr/>


Install Redis Open Source on Linux

Install Redis Open Source on Rocky Linux 8 and 9, or AlmaLinux 8 and 9 using RPM

Follow these steps to install Redis Open Source.

1. Create the file `/etc/yum.repos.d/redis.repo` with the following contents.

    - For Rocky Linux 9 and AlmaLinux 9

    [Redis]
    name=Redis
    baseurl=http://packages.redis.io/rpm/rockylinux9
    enabled=1
    gpgcheck=1

    - For Rocky Linux 8 and AlmaLinux 8

    [Redis]
    name=Redis
    baseurl=http://packages.redis.io/rpm/rockylinux8
    enabled=1
    gpgcheck=1

2. Run the following commands:

    curl -fsSL https://packages.redis.io/gpg > /tmp/redis.key
    sudo rpm --import /tmp/redis.key
    sudo yum install redis

Redis will not start automatically, nor will it start at boot time. To do this, run the following commands.

sudo systemctl enable redis
sudo systemctl start redis


Install Redis Open Source on Linux

Install Redis Open Source on Ubuntu Linux using Snap

To install Redis via snap, run the following commands:

sudo apt update
sudo apt install redis-tools # this will install `redis-cli`
sudo snap install redis

Redis will start automatically after installation and also at boot time.

Connect to Redis


Summary: How to run Redis Open Source on Windows

To install Redis Open Source on Windows, you will need to have Docker installed. When Docker is up and running, open Windows PowerShell and follow the instructions described in [Run Redis Open Source on Docker](). Then, use Docker to connect with `redis-cli` as explained in that topic.


Upgrade a Redis cluster to Redis 8

Summary: Upgrade a Redis Open Source cluster to Redis 8

Overview

The supported upgrade paths are:
- Redis Open Source 7.x (with or without modules) to Redis 8 in Redis Open Source
- Redis Stack 7.2 or 7.4 to Redis 8 in Redis Open Source

</br>

It's essential to practice upgrading Redis in a controlled environment before upgrading it in a production environment.
Docker is an excellent tool to use for this purpose.

Follow these instructions to upgrade a Redis cluster. This guide assumes you have installed Redis using one of the supported methods listed [here]().

Save your current data

Before upgrading, create a snapshot of your current dataset on each node (identified by its port) using the following command:

[code example]

Repeat for every node in your cluster, both masters and replicas.

This creates or updates an `RDB` file, for example `dump.rdb`, in the node's Redis data directory. If you use AOF persistence, the files will be named `appendonly.aof.*` and they will be written in the `appendonlydir` directory inside the data directory. The AOF-related directory and file names are the defaults. Use the names defined in your `redis.conf` file if different from the defaults.

Use the following command on each node to identify where your data directories are located:

[code example]

Make a copy of the files contained in each of those directories before proceeding.

Upgrade Redis nodes

Upgrade each node one at a time, starting with the replicas, using these steps:

1. Stop the current version of Redis Open Source or Redis Stack server.
1. Follow the installation steps that correspond to your [Redis distribution]() to install Redis 8.
1. Start Redis 8 if it didn't start automatically.

Restore from saved files (if necessary)

If necessary, restore the saved files to their original locations on each node. Then restart Redis on each node.

Redis Search won't be fully operational until all master shards have completed their upgrades.
Any queries sent during the upgrade process will either return errors or a message such as "Waiting for all nodes to connect".

Verify the upgrade

[code example]

You should also verify that your data is accessible and that your clients can connect successfully.

redis-cli -p <port> INFO server | grep redis_version
redis-cli -p <port> cluster info
redis-cli --cluster check <IP address>:<port>


Upgrade Redis Open Source

Summary: Upgrade Redis Open Source

Summary: Upgrade a standalone instance of Redis Open Source or Redis Stack to Redis 8

Upgrade a standalone Redis instance to Redis 8

Upgrade a Redis cluster to Redis 8

Content

Upgrade Redis Open Source to version 8 from version 7.x with or without modules or from Redis Stack 7.2 and 7.4.

<hr/>


Overview

The supported upgrade paths are:
- Redis Open Source 7.x (with or without modules) to Redis 8 in Redis Open Source
- Redis Stack 7.2 or 7.4 to Redis 8 in Redis Open Source

It's essential to practice upgrading Redis in a controlled environment before upgrading it in a production environment.
Docker is an excellent tool to use for this purpose.

Follow these instructions to upgrade a single-node Redis server. This guide assumes you have installed Redis using one of the supported methods listed [here]().

Save your current data

Before upgrading, create a snapshot of your current dataset using the following command:

[code example]

This creates or updates an `RDB` file, for example `dump.rdb`, in your Redis data directory. If you use AOF persistence, the files will be named `appendonly.aof.*` and they will be written in the `appendonlydir` directory inside the data directory. The AOF-related directory and file names are the defaults. Use the names defined in your `redis.conf` file if different from the defaults.

Use the following command to identify where your data directory is located:

[code example]

Make a copy of these files before proceeding:

[code example]

Upgrade Redis

Follow these steps to upgrade Redis.

1. Stop the current version of Redis Open Source or Redis Stack server.
1. Follow the installation steps that correspond to your [Redis distribution]() to install Redis 8.
1. Start Redis 8 if it didn't start automatically.

Restore from saved files (if necessary)

If Redis fails to start properly or if data is missing after the upgrade, restore from your backup.

1. Stop the Redis server.
2. Copy the backup file back into the the Redis data directory:
   [code example]
3. Start Redis again and verify data is restored:
   [code example]

Verify the upgrade

Use the following command to confirm you're running Redis 8:

[code example]

You should also verify that your data is accessible and that your clients can connect successfully.

cp -r /path/to/redis-data-dir/ /path/to/backup/

cp -r /path/to/backup/ /path/to/redis-data-dir/

redis-cli INFO server | grep redis_version


Redis Open Source version management

Overview

Redis Open Source provides comprehensive version management that prioritizes customer control over major changes.

Redis version structure

Redis uses a **MAJOR.MINOR.PATCH** versioning scheme:

- **Major versions**: Significant changes that may include breaking changes (e.g., Redis 7 → Redis 8)
- **Minor versions**: New features and improvements within a major version (e.g., 8.2 → 8.4 → 8.6)
- **Patch versions**: Bug fixes and security updates (e.g., 8.2.1 → 8.2.2)

Supported versions

**We strongly recommend using the latest available version** to benefit from the newest features, performance improvements, and security updates.

| Version | Status | EOL Date |
|---------|--------|----------|
| **Redis 8.4** | GA | TBD |
| **Redis 8.2** | GA | TBD |
| **Redis 8.0** | GA | TBD |
| **Redis 7.4** | GA | December 1, 2029 |
| **Redis 7.2** | GA | December 1, 2029 |
| **Redis 6.2** | GA | April 1, 2027 |


Redis administration

Summary: Advice for configuring and managing Redis in production

Redis setup tips

Linux

* Deploy Redis using the Linux operating system. Redis is also tested on OS X, and from time to time on FreeBSD and OpenBSD systems. However, Linux is where most of the stress testing is performed, and where most production deployments are run.

* Set the Linux kernel overcommit memory setting to 1. Add `vm.overcommit_memory = 1` to `/etc/sysctl.conf`. Then, reboot or run the command `sysctl vm.overcommit_memory=1` to activate the setting. See [FAQ: Background saving fails with a fork() error on Linux?]() for details.

* To ensure the Linux kernel feature Transparent Huge Pages does not impact Redis memory usage and latency, run the command: `echo never > /sys/kernel/mm/transparent_hugepage/enabled` to disable it. See [Latency Diagnosis - Latency induced by transparent huge pages]() for additional context.

Memory

* Ensured that swap is enabled and that your swap file size is equal to amount of memory on your system. If Linux does not have swap set up, and your Redis instance accidentally consumes too much memory, Redis can crash when it is out of memory, or the Linux kernel OOM killer can kill the Redis process. When swapping is enabled, you can detect latency spikes and act on them.

* Set an explicit `maxmemory` option limit in your instance to make sure that it will report errors instead of failing when the system memory limit is near to be reached. Note that `maxmemory` should be set by calculating the overhead for Redis, other than data, and the fragmentation overhead. So if you think you have 10 GB of free memory, set it to 8 or 9.

* If you are using Redis in a write-heavy application, while saving an RDB file on disk or rewriting the AOF log, Redis can use up to 2 times the memory normally used. The additional memory used is proportional to the number of memory pages modified by writes during the saving process, so it is often proportional to the number of keys (or aggregate types items) touched during this time. Make sure to size your memory accordingly.

* See the [`LATENCY DOCTOR`](/commands/latency-doctor) and [`MEMORY DOCTOR`](/commands/memory-doctor) commands to assist in troubleshooting.

Imaging

* When running under daemontools, use `daemonize no`.

Replication

* Set up a non-trivial replication backlog in proportion to the amount of memory Redis is using. The backlog allows replicas to sync with the primary (master) instance much more easily.

* If you use replication, Redis performs RDB saves even if persistence is disabled. (This does not apply to diskless replication.) If you don't have disk usage on the master, enable diskless replication.

* If you are using replication, ensure that either your master has persistence enabled, or that it does not automatically restart on crashes. Replicas will try to maintain an exact copy of the master, so if a master restarts with an empty data set, replicas will be wiped as well.

Security

* By default, Redis does not require any authentication and listens to all the network interfaces. This is a big security issue if you leave Redis exposed on the internet or other places where attackers can reach it. See for example [this attack](http://antirez.com/news/96) to see how dangerous it can be. Please check our [security page]() for information about how to secure Redis.

Running Redis on EC2

* Use HVM based instances, not PV based instances.
* Do not use old instance families. For example, use m3.medium with HVM instead of m1.medium with PV.
* The use of Redis persistence with EC2 EBS volumes needs to be handled with care because sometimes EBS volumes have high latency characteristics.
* You may want to try the new diskless replication if you have issues when replicas are synchronizing with the master.

Upgrading or restarting a Redis instance without downtime

Redis is designed to be a long-running process in your server. You can modify many configuration options without a restart using the [`CONFIG SET`](/commands/config-set) command. You can also switch from AOF to RDB snapshots persistence, or the other way around, without restarting Redis. Check the output of the `CONFIG GET *` command for more information.

From time to time, a restart is required, for example, to upgrade the Redis process to a newer version, or when you need to modify a configuration parameter that is currently not supported by the [`CONFIG`](/commands/config) command.

Follow these steps to avoid downtime.

* Set up your new Redis instance as a replica for your current Redis instance. In order to do so, you need a different server, or a server that has enough RAM to keep two instances of Redis running at the same time.

* If you use a single server, ensure that the replica is started on a different port than the master instance, otherwise the replica cannot start.

* Wait for the replication initial synchronization to complete. Check the replica's log file.

* Using [`INFO`](/commands/info), ensure the master and replica have the same number of keys. Use `redis-cli` to check that the replica is working as expected and is replying to your commands.

* Allow writes to the replica using `CONFIG SET slave-read-only no`.

* Configure all your clients to use the new instance (the replica). Note that you may want to use the [`CLIENT PAUSE`](/commands/client-pause) command to ensure that no client can write to the old master during the switch.

* Once you confirm that the master is no longer receiving any queries (you can check this using the [`MONITOR`](/commands/monitor) command), elect the replica to master using the `REPLICAOF NO ONE` command, and then shut down your master.

If you are using [Redis Sentinel]() or [Redis Cluster](), the simplest way to upgrade to newer versions is to upgrade one replica after the other. Then you can perform a manual failover to promote one of the upgraded replicas to master, and finally promote the last replica.

---
**NOTE**

Redis Cluster 4.0 is not compatible with Redis Cluster 3.2 at cluster bus protocol level, so a mass restart is needed in this case. However, Redis 5 cluster bus is backward compatible with Redis 4.

---


Redis configuration

Summary: Overview of redis.conf, the Redis configuration file

Content

Redis is able to start without a configuration file using a built-in default
configuration, however this setup is only recommended for testing and
development purposes.

The proper way to configure Redis is by providing a Redis configuration file,
usually called `redis.conf`. Beginning with Redis 8 in Redis Open Source, there are two configuration files:
* `redis.conf` - contains the configuration settings for Redis server only.
* `redis-full.conf` - contains configuration settings for Redis server and all available components: Redis Search, Redis time series, and Redis probabilistic data structures. This file has as its first line `include redis.conf`, which pulls in the Redis server configuration settings at startup. Use `redis-full.conf` when you want to enable all available components. The file contains four `loadmodule` directives, one for each component, and also loads Redis JSON (though JSON has no configuration parameters).

If you are building Redis from source and choose to build Redis server without the available components, you can use `redis.conf` as your configuration file.

Each configuration file contains a number of directives that have a very simple format:

    keyword argument1 argument2 ... argumentN

This is an example of a configuration directive:

    replicaof 127.0.0.1 6380

It is possible to provide strings containing spaces as arguments using
(double or single) quotes, as in the following example:

    requirepass "hello world"

Single-quoted string can contain characters escaped by backslashes, and
double-quoted strings can additionally include any ASCII symbols encoded using
backslashed hexadecimal notation "\\xff".

The list of configuration directives, along with comments describing their meaning and intended usage, is available in the self-documented sample files `redis.conf` and `redis-full.conf` files shipped with the Redis distributions.

* Configuration files for Redis 8.6: [redis-full.conf](https://raw.githubusercontent.com/redis/redis/8.6/redis-full.conf) and [redis.conf](https://raw.githubusercontent.com/redis/redis/8.6/redis.conf).
* Configuration files for Redis 8.4: [redis-full.conf](https://raw.githubusercontent.com/redis/redis/8.4/redis-full.conf) and [redis.conf](https://raw.githubusercontent.com/redis/redis/8.4/redis.conf).
* Configuration files for Redis 8.2: [redis-full.conf](https://raw.githubusercontent.com/redis/redis/8.2/redis-full.conf) and [redis.conf](https://raw.githubusercontent.com/redis/redis/8.2/redis.conf).
* Configuration files for Redis 8.0: [redis-full.conf](https://raw.githubusercontent.com/redis/redis/8.0/redis-full.conf) and [redis.conf](https://raw.githubusercontent.com/redis/redis/8.0/redis.conf).
* Configuration file for Redis 7.4: [redis.conf](https://raw.githubusercontent.com/redis/redis/7.4/redis.conf).
* Configuration file for Redis 7.2: [redis.conf](https://raw.githubusercontent.com/redis/redis/7.2/redis.conf).
* Configuration file for Redis 7.0: [redis.conf](https://raw.githubusercontent.com/redis/redis/7.0/redis.conf).
* Configuration file for Redis 6.2: [redis.conf](https://raw.githubusercontent.com/redis/redis/6.2/redis.conf).

Passing arguments using the command line
---

You can also pass Redis configuration parameters
using the command line directly. This is very useful for testing purposes.
The following is an example that starts a new Redis instance using port 6380
as a replica of the instance running at 127.0.0.1 port 6379.

    ./redis-server --port 6380 --replicaof 127.0.0.1 6379

The format of the arguments passed using the command line is exactly the same
as the one used in the redis.conf file, with the exception that the keyword
is prefixed with `--`.

Note that internally this generates an in-memory temporary config file
(possibly concatenating the config file passed by the user, if any) where
arguments are translated into the format of redis.conf.

Changing Redis configuration while the server is running
---

It is possible to reconfigure Redis on the fly without stopping and restarting
the service, or querying the current configuration programmatically using the
special commands [`CONFIG SET`](/commands/config-set) and [`CONFIG GET`](/commands/config-get).

Not all of the configuration directives are supported in this way, but most
are supported as expected.
Please refer to the [`CONFIG SET`](/commands/config-set) and [`CONFIG GET`](/commands/config-get) pages for more information.

Note that modifying the configuration on the fly does not affect the
`redis.conf` and `redis-full.conf` files, so at the next restart of Redis, the old configuration will
be used instead.

Make sure to also modify the configuration files accordingly to the configuration
you set using [`CONFIG SET`](/commands/config-set).
You can do it manually, or you can use [`CONFIG REWRITE`](/commands/config-rewrite), which will automatically scan your configuration files and update the fields that don't match the current configuration value.
Fields set to the default value are not added.
Comments inside your configuration file are retained.

Configuring Redis as a cache
---

If you plan to use Redis as a cache where every key will have an
expire set, you may consider using the following configuration instead
(assuming a max memory limit of 2 megabytes as an example):

    maxmemory 2mb
    maxmemory-policy allkeys-lru

In this configuration there is no need for the application to set a
time to live for keys using the [`EXPIRE`](/commands/expire) command (or equivalent) since
all the keys will be evicted using an approximated LRU algorithm as long
as we hit the 2 megabyte memory limit.

Basically, in this configuration Redis acts in a similar way to memcached.
We have more extensive documentation about using Redis as an LRU cache [here]().