What are the ports required for Redis clustering?


I am looking to set-up Redis clustering with three master nodes. I am wondering what are the specific ports required to be open for each of the master nodes for Redis clustering?

I am following the documentation on Scaling with Redis Cluster | Redis and it says each node requires two TCP ports:

  1. A Redis TCP port e.g. 6379
  2. The cluster bus port e.g. 16379

Further down on the page, it gives an example to create a cluster with the following command:

mkdir cluster-test
cd cluster-test
mkdir 7000 7001 7002 7003 7004 7005

Does this mean each master node must be assigned with a different Redis TCP port or can they all be using the port 6379?

Furthermore, does this mean I will need to open the corresponding cluster bus port e.g. 17000, 17001, and 17002? Or can they all be using 16379?

Thirdly, the documentation also states, “You can now interact with the cluster, the first node will start at port 30001 by default.” Does this mean the port 30001 needs to be open on all of the Redis clusters as well?

Lastly, the documentation says, " By default, the cluster bus port is set by adding 10000 to the data port (e.g., 16379); however, you can override this in the cluster-port config." How can I change the port of the cluster bus port of each master node?


Hi there!

So you are right, Redis cluster needs two ports, one for Redis TCP traffic, and the other for the cluster bus. These are both entirely configurable.

The first example you give is from a tutorial where they are having you set up all the nodes on the same host. Since they are on the same host, they have you select different ports. Obviously, you can’t have two Redis processes bind to the same port. If you are going to be running your Redis nodes on different hosts, they can all use the same ports (e.g. 6379 and 16379).

The other example, with port 30001, is an artifact of the create-cluster script, as seen here. Redis cluster doesn’t need to be on that particular port, the script just chooses that port when creating the cluster.

For your questions about the cluster bus port, yes this will, by default, be 10000 greater than the port you choose. You can override this in your redis.conf by adding cluster-port <PORT> on a new line. If you are running all nodes on different hosts, they can have the same cluster port, but if you are trying to run them all locally, you will need to make sure these are all different, otherwise Redis will fail to start.

Hope this helps!

1 Like

Thank you very much for your answer and confirmation, it was very helpful!