Skip to content

A Redis Module that make it possible to create a consistent Raft cluster from multiple Redis instances.

License

AGPL-3.0, Unknown licenses found

Licenses found

AGPL-3.0
LICENSE.agpl
Unknown
LICENSE.rsal
Notifications You must be signed in to change notification settings

shiyezheng/redisraft

 
 

Repository files navigation

RedisRaft

Strongly-Consistent Redis Deployments

RedisRaft is a Redis module that implements the Raft Consensus Algorithm, making it possible to create strongly-consistent clusters of Redis servers.

The Raft algorithm is provided by a standalone Raft library by Willem-Hendrik Thiart.

Main Features

  • Strong consistency (in the language of CAP, this system prioritizes consistency and partition-tolerance).
  • Support for most Redis data types and commands
  • Dynamic cluster configuration (adding / removing nodes)
  • Snapshots for log compaction
  • Configurable quorum or fast reads

Getting Started

Building

The module is mostly self-contained; its few dependencies are available as git submodules under deps.

To compile the module, you will need:

  • Build essentials (a compiler, GNU make, etc.)
  • CMake
  • GNU autotools (autoconf, automake, libtool)
  • libbsd-dev (on Debian/Ubuntu) or an equivalent for bsd/sys/queue.h.

To build, simply run:

git submodule init
git submodule update
make

Creating a RedisRaft Cluster

Note: RedisRaft requires Redis 6.0 or above.

To create a three-node cluster, start the first node:

redis-server \
    --port 5001 --dbfilename raft1.rdb \
    --loadmodule <path-to>/redisraft.so \
        raft-log-filename=raftlog1.db addr=localhost:5001

Then initialize the cluster:

redis-cli -p 5001 raft.cluster init

Now start the second node, and run the RAFT.CLUSTER JOIN command to join it to the existing cluster:

redis-server \
    --port 5002 --dbfilename raft2.rdb \
    --loadmodule <path-to>/redisraft.so \
        raft-log-filename=raftlog2.db addr=localhost:5002

redis-cli -p 5002 RAFT.CLUSTER JOIN localhost:5001

Now add the third node in the same way:

redis-server \
    --port 5003 --dbfilename raft3.rdb \
    --loadmodule <path-to>/redisraft.so \
        raft-log-filename=raftlog3.db addr=localhost:5003

redis-cli -p 5003 RAFT.CLUSTER JOIN localhost:5001

To query the cluster state, run the RAFT.INFO command:

redis-cli --raw -p 5001 RAFT.INFO

Now you can start using this RedisRaft cluster. All supported Redis commands will be executed in a strongly-consistent manner using the Raft protocol.

Documentation

Please consult the documentation for more information.

License

RedisRaft is dual-licensed under the GNU Affero General Public License (AGPL) Version 3 and the Redis Source Available License (RSAL).

About

A Redis Module that make it possible to create a consistent Raft cluster from multiple Redis instances.

Resources

License

AGPL-3.0, Unknown licenses found

Licenses found

AGPL-3.0
LICENSE.agpl
Unknown
LICENSE.rsal

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 75.5%
  • Python 18.8%
  • Shell 2.3%
  • Clojure 2.0%
  • Other 1.4%