Introducing Dragonfly Cloud! Learn More

Question: How can you set up a Redis cluster without replication?


Setting up a Redis cluster without replication is possible but not normally recommended due to potential loss of data resilience. However, if you decide to go this route, it essentially means that each node in the cluster will hold independent data and no nodes will serve as slaves.

Here's a high level process of how you can do it:

  1. Start Redis Instances: You need to start different Redis instances on different ports. Here's an example command for starting a Redis instance on port 7000:
$ redis-server --port 7000 --cluster-enabled yes --cluster-config-file nodes-7000.conf --cluster-node-timeout 5000 --appendonly yes
  1. Create Cluster: Use the redis-cli tool to create the cluster after all the instances are up and running. The following example creates a cluster with nodes running on ports 7000, 7001 and 7002:
$ redis-cli --cluster create

During the creation process, the tool will ask how to distribute hash slots among nodes. By default, it offers an equal distribution. Accept this for most use cases.

  1. Confirm Cluster Setup: Test your cluster using the redis-cli command:
$ redis-cli -c -p 7000

Then in the CLI, use the 'CLUSTER NODES' command:> CLUSTER NODES

If your cluster is correctly set up, it will display information about each node in the cluster.

Please note that running a Redis cluster without replication means your data won't have the redundancy typically provided by slave nodes. This makes your cluster more vulnerable to data loss if one or more nodes fail.

Was this content helpful?

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book

Start building today 

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.