Redis is an in-memory database that persists on disk. The data model is key-value, but many different kind of values are supported: Strings, Lists, Sets, Sorted Sets, Hashes, Streams, HyperLogLogs, Bitmaps.
This README is just a fast quick start document. You can find more detailed documentation at redis.io.
For developers, who are building real-time data-driven applications, Redis is the preferred, fastest, and most feature-rich cache, data structure server, and document and vector query engine.
Redis covers a wide range of use cases across a wide range of industries and projects, serving as
Redis can be relied upon (it is robust and has a well-defined behavior), it comes with a long-term commitment (we keep maintaining Redis, avoid introducing breaking changes, and keep it innovative and competitive). Redis is fast and has a low memory footprint (with the right tradeoffs), easy to understand, learn, and use, and easy to adopt across a wide range of development environments and languages.
If you want to know more, here is a list of starting points:
Redis Community Edition (Redis CE) was renamed Redis Open Source with the v8.0 release.
Redis Ltd. also offers Redis Software, a self-managed software with additional compliance, reliability, and resiliency for enterprise scaling,
and Redis Cloud, a fully managed service integrated with Google Cloud, Azure, and AWS for production-ready apps.
Read more about the differences between Redis Open Source and Redis here.
The fastest way to deploy Redis is using one the binary distributions:
If you prefer to build Redis from source - see instructions below.
redis-cli
is Redis’ command line interface. It is available as part of all the binary distributions and when you build Redis from source.
See https://redis.io/docs/latest/develop/tools/cli/
You can start a redis-server instance, and then, in another terminal try the following:
% cd src
% ./redis-cli
redis> ping
PONG
redis> set foo bar
OK
redis> get foo
"bar"
redis> incr mycounter
(integer) 1
redis> incr mycounter
(integer) 2
redis>
For a more visual and user-friendly experience, use Redis Insight - a tool that lets you explore data, design, develop, and optimize your applications while also serving as a platform for Redis education and onboarding. Redis Insight integrates Redis Copilot, a natural language AI assistant that improves the experience when working with data and commands.
See https://redis.io/docs/latest/develop/tools/insight/ and https://github.com/RedisInsight/RedisInsight.
To connect your application to Redis, you will need a client library. The list of client libraries is available in https://redis.io/docs/latest/develop/clients/.
Redis provides a variety of data types, processing engines, and capabilities to support a wide range of use cases:
String
JSON (*)
Hash
Redis Query Engine (*)
List
Set
Sorted Set
Vector Set (beta)
Geospatial Index
Bitmap
Bitfield
HyperLogLog
Bloom filter (*)
Cuckoo filter (*)
Top-k (*)
Count-min sketch (*)
t-digest (*)
Time series (*)
Pub/Sub
Stream
Transactions
Programmability
Items marked with (*) require building with BUILD_WITH_MODULES=yes
.
Tested with the following Docker images:
Install required dependencies
Update your package lists and install the necessary development tools and libraries:
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
Use GCC 10 as the default compiler
Update the system’s default compiler to GCC 10:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10
Install CMake
Install CMake using pip3
and link it for system-wide access:
pip3 install cmake==3.31.6
sudo ln -sf /usr/local/bin/cmake /usr/bin/cmake
cmake --version
Note: CMake version 3.31.6 is the latest supported version. Newer versions cannot be used.
Download the Redis source
Download a specific version of the Redis source code archive from GitHub.
Replace <version>
with the Redis version, for example: 8.0.0
.
cd /usr/src
wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
Extract the source archive
Create a directory for the source code and extract the contents into it:
cd /usr/src
tar xvf redis-<version>.tar.gz
rm redis-<version>.tar.gz
Build Redis
Set the necessary environment variables and compile Redis:
cd /usr/src/redis-<version>
export BUILD_TLS=yes BUILD_WITH_MODULES=yes INSTALL_RUST_TOOLCHAIN=yes DISABLE_WERRORS=yes
make -j "$(nproc)" all
Run Redis
cd /usr/src/redis-<version>
./src/redis-server redis-full.conf
Tested with the following Docker image:
Install required dependencies
Update your package lists and install the necessary development tools and libraries:
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
Download the Redis source
Download a specific version of the Redis source code archive from GitHub.
Replace <version>
with the Redis version, for example: 8.0.0
.
cd /usr/src
wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
Extract the source archive
Create a directory for the source code and extract the contents into it:
cd /usr/src
tar xvf redis-<version>.tar.gz
rm redis-<version>.tar.gz
Build Redis
Set the necessary environment variables and build Redis:
cd /usr/src/redis-<version>
export BUILD_TLS=yes BUILD_WITH_MODULES=yes INSTALL_RUST_TOOLCHAIN=yes DISABLE_WERRORS=yes
make -j "$(nproc)" all
Run Redis
cd /usr/src/redis-<version>
./src/redis-server redis-full.conf
Tested with the following Docker images:
Install required dependencies
Update your package lists and install the necessary development tools and libraries:
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
Download the Redis source
Download a specific version of the Redis source code archive from GitHub.
Replace <version>
with the Redis version, for example: 8.0.0
.
cd /usr/src
wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
Extract the source archive
Create a directory for the source code and extract the contents into it:
cd /usr/src
tar xvf redis-<version>.tar.gz
rm redis-<version>.tar.gz
Build Redis
Set the necessary environment variables and build Redis:
cd /usr/src/redis-<version>
export BUILD_TLS=yes BUILD_WITH_MODULES=yes INSTALL_RUST_TOOLCHAIN=yes DISABLE_WERRORS=yes
make -j "$(nproc)" all
Run Redis
cd /usr/src/redis-<version>
./src/redis-server redis-full.conf
Tested with the following Docker images:
Prepare the system
For 8.10-minimal, install sudo
and dnf
as follows:
microdnf install dnf sudo -y
For 8.10 (regular), install sudo as follows:
dnf install sudo -y
Clean the package metadata, enable required repositories, and install development tools:
sudo dnf clean all
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
Install required dependencies
Update your package lists and install the necessary development tools and libraries:
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
Create a Python virtual environment:
python3.11 -m venv /opt/venv
Enable the GCC toolset:
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
Install CMake
Install CMake 3.25.1 manually:
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
Download the Redis source
Download a specific version of the Redis source code archive from GitHub.
Replace <version>
with the Redis version, for example: 8.0.0
.
cd /usr/src
wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
Extract the source archive
Create a directory for the source code and extract the contents into it:
cd /usr/src
tar xvf redis-<version>.tar.gz
rm redis-<version>.tar.gz
Build Redis
Enable the GCC toolset, set the necessary environment variables, and build Redis:
source /etc/profile.d/gcc-toolset-13.sh
cd /usr/src/redis-<version>
export BUILD_TLS=yes BUILD_WITH_MODULES=yes INSTALL_RUST_TOOLCHAIN=yes DISABLE_WERRORS=yes
make -j "$(nproc)" all
Run Redis
cd /usr/src/redis-<version>
./src/redis-server redis-full.conf
Tested with the following Docker images:
Prepare the system
For 9.5-minimal, install sudo
and dnf
as follows:
microdnf install dnf sudo -y
For 9.5 (regular), install sudo as follows:
dnf install sudo -y
Clean the package metadata, enable required repositories, and install development tools:
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
Install required dependencies
Update your package lists and install the necessary development tools and libraries:
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
Create a Python virtual environment:
python3 -m venv /opt/venv
Enable the GCC toolset:
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
Install CMake
Install CMake 3.25.1 manually:
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
Download the Redis source
Download a specific version of the Redis source code archive from GitHub.
Replace <version>
with the Redis version, for example: 8.0.0
.
cd /usr/src
wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
Extract the source archive
Create a directory for the source code and extract the contents into it:
cd /usr/src
tar xvf redis-<version>.tar.gz
rm redis-<version>.tar.gz
Build Redis
Enable the GCC toolset, set the necessary environment variables, and build Redis:
source /etc/profile.d/gcc-toolset-13.sh
cd /usr/src/redis-<version>
export BUILD_TLS=yes BUILD_WITH_MODULES=yes INSTALL_RUST_TOOLCHAIN=yes DISABLE_WERRORS=yes
make -j "$(nproc)" all
Run Redis
cd /usr/src/redis-<version>
./src/redis-server redis-full.conf
Install Homebrew
If Homebrew is not already installed, follow the installation instructions on the Homebrew home page.
Install required packages
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
Install Rust
Rust is required to build the JSON package.
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)
Download the Redis source
Download a specific version of the Redis source code archive from GitHub.
Replace <version>
with the Redis version, for example: 8.0.0
.
cd ~/src
wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
Extract the source archive
Create a directory for the source code and extract the contents into it:
cd ~/src
tar xvf redis-<version>.tar.gz
rm redis-<version>.tar.gz
Build Redis
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
Run Redis
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
build_dir/bin/redis-server redis-full.conf
Support and instructions will be provided at a later date.
Redis can be compiled and used on Linux, OSX, OpenBSD, NetBSD, FreeBSD.
We support big endian and little endian architectures, and both 32 bit and 64 bit systems.
It may compile on Solaris derived systems (for instance SmartOS) but our support for this platform is best effort and Redis is not guaranteed to work as well as in Linux, OSX, and *BSD.
To build Redis with all the data structures (including JSON, time series, Bloom filter, cuckoo filter, count-min sketch, top-k, and t-digest) and with Redis Query Engine, make sure first that all the prerequisites are installed (see build instructions above, per operating system). You need to use the following flag in the make command:
make BUILD_WITH_MODULES=yes
To build Redis with just the core data structures, use:
make
To build with TLS support, you need OpenSSL development libraries (e.g. libssl-dev on Debian/Ubuntu) and the following flag in the make command:
make BUILD_TLS=yes
To build with systemd support, you need systemd development libraries (such as libsystemd-dev on Debian/Ubuntu or systemd-devel on CentOS), and the following flag:
make USE_SYSTEMD=yes
To append a suffix to Redis program names, add the following flag:
make PROG_SUFFIX="-alt"
You can build a 32 bit Redis binary using:
make 32bit
After building Redis, it is a good idea to test it using:
make test
If TLS is built, running the tests with TLS enabled (you will need tcl-tls
installed):
./utils/gen-test-certs.sh
./runtest --tls
Redis has some dependencies which are included in the deps
directory. make
does not automatically rebuild dependencies even if something in the source code of dependencies changes.
When you update the source code with git pull
or when code inside the dependencies tree is modified in any other way, make sure to use the following command in order to really clean everything and rebuild from scratch:
make distclean
This will clean: jemalloc, lua, hiredis, linenoise and other dependencies.
Also if you force certain build options like 32bit target, no C compiler optimizations (for debugging purposes), and other similar build time options, those options are cached indefinitely until you issue a make distclean
command.
If after building Redis with a 32 bit target you need to rebuild it
with a 64 bit target, or the other way around, you need to perform a make distclean
in the root directory of the Redis distribution.
In case of build errors when trying to build a 32 bit binary of Redis, try the following steps:
make 32bit
:make CFLAGS="-m32 -march=native" LDFLAGS="-m32"
Selecting a non-default memory allocator when building Redis is done by setting the MALLOC
environment variable. Redis is compiled and linked against libc malloc by default, with the exception of jemalloc being the default on Linux systems. This default was picked because jemalloc has proven to have fewer fragmentation problems than libc malloc.
To force compiling against libc malloc, use:
make MALLOC=libc
To compile against jemalloc on Mac OS X systems, use:
make MALLOC=jemalloc
By default, Redis will build using the POSIX clock_gettime function as the monotonic clock source. On most modern systems, the internal processor clock can be used to improve performance. Cautions can be found here: http://oliveryang.net/2015/09/pitfalls-of-TSC-usage/
To build with support for the processor’s internal instruction clock, use:
make CFLAGS="-DUSE_PROCESSOR_CLOCK"
Redis will build with a user-friendly colorized output by default.
If you want to see a more verbose output, use the following:
make V=1
Please consult the TLS.md file for more information on how to use Redis with TLS.
By contributing code to the Redis project in any form, including sending a pull request via GitHub, a code fragment or patch via private email or public discussion groups, you agree to release your code under the terms of the Redis Software Grant and Contributor License Agreement. Please see the CONTRIBUTING.md file in this source distribution for more information. For security bugs and vulnerabilities, please see SECURITY.md. Open Source Redis releases are subject to the following licenses:
Version 7.2.x and prior releases are subject to BSDv3. These contributions to the original Redis core project are owned by their contributors and licensed under the 3BSDv3 license as referenced in the REDISCONTRIBUTIONS.txt file. Any copy of that license in this repository applies only to those contributions;
Versions 7.4.x to 7.8.x are subject to your choice of RSALv2 or SSPLv1; and
Version 8.0.x and subsequent releases are subject to the tri-license RSALv2/SSPLv1/AGPLv3 at your option as referenced in the LICENSE.txt file.
The purpose of a trademark is to identify the goods and services of a person or company without causing confusion. As the registered owner of its name and logo, Redis accepts certain limited uses of its trademarks but it has requirements that must be followed as described in its Trademark Guidelines available at: https://redis.io/legal/trademark-policy/.