Redis Cluster Installation

Redis Cluster provides a way to run a Redis installation where data is automatically sharded across multiple Redis nodes. In this article, I am going to share steps of Redis Cluster Installation.

Redis Cluster also provides some degree of availability during partitions. That is in practical terms the ability to continue the operations when some nodes fail or are not able to communicate. However, the cluster stops to operate in the event of larger failures (for example when the majority of masters are unavailable).

Redis Cluster Benefits

So in practical terms, what do you get with Redis Cluster?

  • The ability to automatically split your dataset among multiple nodes.
  • The ability to continue operations when a subset of the nodes are experiencing failures or are unable to communicate with the rest of the cluster.

In this step I am going to tell you all the steps for Setting up Redis Clustering. You can read more about Redis at official website of Redis.

Redis Cluster Overview

Create Redis Configuration File with below directive for each node

Setting the cluster-enabled directive to yes enables cluster mode. Every instance also contains the path of a file where the configuration for this node is stored, which by default is nodes.conf. This file simply generated at startup by the Redis Cluster instances, and updated every time it is needed.

Note that the minimal cluster that works as expected must contain at least three master nodes. For deployment, we strongly recommend a six-node cluster, with three masters and three replicas.

You can test this locally by creating the following directories. These directories are named after the port number of the instance you’ll run inside any given directory.

port 7000
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes

Move each configuration file to it’s folder

mkdir 700{1..6}

Run redis-cli –cluster create command

redis-cli --cluster create 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 127.0.0.1:7006 --cluster-replicas 1

Comments are closed.

%d bloggers like this: