Redis cluster creation

redis

Solution

Yes. The requirement of at least 3 master nodes is set by the ruby script, but not a hard limit in cluster.

The first thing you need to do is send a `cluster` command with 16385 arguments like

cluster addslots 0 1 2 3 ... 16384

to the cluster. Since there is too many arguments to manually type them in a redis-cli, I suggest write a program to do that, in which you open a TCP socket connecting to the redis node, convert the previous command into a redis command string and write it to the socket.

The single node cluster will be online after few seconds you send the command. Then connect to the other node with redis-cli, type the following command to make it a slave

cluster meet MASTER_HOST MASTER_PORT
cluster replicate MASTER_ID

where `MASTER_HOST:MASTER_PORT` is the address of the previous node, and `MASTER_ID` is the ID of that node, which you could retrieve it via a `cluster nodes` command.

For convenience I've written a python tool for those kinds of redis cluster management, you could install it with

pip install redis-trib

For more detail please go to https://github.com/HunanTV/redis-trib.py/

Problem

Is it possible to create a redis cluster with 2 nodes , one acting as a master and other one as slave. I get the following error if I try with 2 nodes (one as master and other as slave) ``` >>> Creating cluster Connecting to node 127.0.0.1:6379: OK Connecting to node 192.168.40.159:6379: OK *** ERROR: Invalid configuration for cluster creation. *** Redis Cluster requires at least 3 master nodes. *** This is not possible with 2 nodes and 1 replicas per node. *** At least 6 nodes are required. ```

Original source