From 5b1fe925f214bdf7eee8dd4f35380559d8a85c5c Mon Sep 17 00:00:00 2001 From: Binbin Date: Thu, 28 Dec 2023 14:26:23 +0800 Subject: [PATCH] Adjust redis-cli --cluster create arity from -2 to -1 (#12892) When arity is -2, it allows us to input two nodes, but returns: ``` *** 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. ``` When we input one node, it return: ``` [ERR] Wrong number of arguments for specified --cluster sub command ``` Strictly speaking -2 should also be rejected, because redis-cli requires at least three nodes. However, the error message was not very friendly, so decided to change it arity -1. This closes #12891. --- src/redis-cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/redis-cli.c b/src/redis-cli.c index 930582dd9..ed6f59001 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -3765,7 +3765,7 @@ typedef struct clusterManagerCommandDef { } clusterManagerCommandDef; clusterManagerCommandDef clusterManagerCommands[] = { - {"create", clusterManagerCommandCreate, -2, "host1:port1 ... hostN:portN", + {"create", clusterManagerCommandCreate, -1, "host1:port1 ... hostN:portN", "replicas "}, {"check", clusterManagerCommandCheck, -1, " or - separated by either colon or space", "search-multiple-owners"},