Describe the bug
Hi!
When using redis-cli 7.2.3, running redis-cli --cluster create with less than three nodes results in an error on the standard output. This is because redis-cli requires at least three master nodes to create a cluster. The error message is unclear when only one node is given. However, this issue does not occur when two or more nodes are used.
For the case when only one node is given, I suggest to output the same error message as when two nodes are given.
To reproduce
-
Start two redis-server instances that listen at 7000 and 7001 ports.
-
Run the following commands:
$ redis-cli --cluster create 127.0.0.1:7000 127.0.0.1:7001 --cluster-replicas 0
*** ERROR: Invalid configuration for cluster creation.
*** Redis Cluster requires at least 3 master nodes.
*** This is not possible with 2 nodes and 0 replicas per node.
*** At least 3 nodes are required.
$ redis-cli --cluster create 127.0.0.1:7000 --cluster-replicas 0
[ERR] Wrong number of arguments for specified --cluster sub command
Expected behavior
I suggest something like this:
$ redis-cli --cluster create 127.0.0.1:7000 --cluster-replicas 0
*** ERROR: Invalid configuration for cluster creation.
*** Redis Cluster requires at least 3 master nodes.
*** This is not possible with 1 nodes and 0 replicas per node.
*** At least 3 nodes are required.
Comment From: enjoy-binbin
thanks for the report, this make sense to me, the error message is friendly.