Hi,
I have been moving a Redis Cluster to Redis 6.0.1 and it seems that the --cluster-yes option is not working for redis-cli 6.0.1 as before.
I version 5, setting --cluster-yes allowed me to skip the question to proceed to create the cluster. But now it asks to proceed even using that option.
Just to clarify I am talking about this question:
...
Can I set the above configuration? (type 'yes' to accept):
As a workaround we did:
yes yes | redis-cli --cluster create ...
And it solves the issue temporarily, but I wanted to share/report this bug.
Comment From: bsergean
The code that is about to start the node creation is:
if (confirmWithYes("Can I set the above configuration?")) {
listRewind(cluster_manager.nodes, &li);
while ((ln = listNext(&li)) != NULL) {
clusterManagerNode *node = ln->value;
char *err = NULL;
int flushed = clusterManagerFlushNodeConfig(node, &err);
if (!flushed && node->dirty && !node->replicate) {
if (err != NULL) {
CLUSTER_MANAGER_PRINT_REPLY_ERROR(node, err);
zfree(err);
}
success = 0;
goto cleanup;
} else if (err != NULL) zfree(err);
}
clusterManagerLogInfo(">>> Nodes configuration updated\n");
clusterManagerLogInfo(">>> Assign a different config epoch to "
And I don't get how confirmWithYes can use the --cluster-yet.
static int confirmWithYes(char *msg) {
printf("%s (type 'yes' to accept): ", msg);
fflush(stdout);
char buf[4];
int nread = read(fileno(stdin),buf,4);
buf[3] = '\0';
return (nread != 0 && !strcmp("yes", buf));
}
It seems to only be used during resharding
} else if (!strcmp(argv[i],"--cluster-yes")) {
config.cluster_manager_command.flags |=
CLUSTER_MANAGER_CMD_FLAG_YES;
...
if (!(config.cluster_manager_command.flags &
CLUSTER_MANAGER_CMD_FLAG_YES))
{
printf("Do you want to proceed with the proposed "
"reshard plan (yes/no)? ");
fflush(stdout);
char buf[4];
int nread = read(fileno(stdin),buf,4);
buf[3] = '\0';
if (nread <= 0 || strcmp("yes", buf) != 0) {
result = 0;
goto cleanup;
}
}
... I believe this patch should fix it, I'll give it a try:
$ git diff
diff --git a/src/redis-cli.c b/src/redis-cli.c
index 208f7b35d..53b794fbf 100644
--- a/src/redis-cli.c
+++ b/src/redis-cli.c
@@ -5511,7 +5511,9 @@ assign_replicas:
}
clusterManagerOptimizeAntiAffinity(ip_nodes, ip_count);
clusterManagerShowNodes();
- if (confirmWithYes("Can I set the above configuration?")) {
+
+ if ((config.cluster_manager_command.flags & CLUSTER_MANAGER_CMD_FLAG_YES) ||
+ confirmWithYes("Can I set the above configuration?")) {
listRewind(cluster_manager.nodes, &li);
while ((ln = listNext(&li)) != NULL) {
clusterManagerNode *node = ln->value;
ps: ... shameless plug advertisement for my python tool to do similar task ;p / https://github.com/machinezone/rcc/ (which has a resharding and a manual cluster creation mode for redis-4)
Comment From: miguelaeh
Hi @bsergean , Thank you very much for the quick PR!!!
Comment From: bsergean
Sure thing !
We'll see what Salvatore says but I think that the PR or a variation of it should be merged eventually.
On May 14, 2020, at 12:55 AM, Miguel Ángel Cabrera Miñagorri notifications@github.com wrote:
Hi @bsergean https://github.com/bsergean , Thank you very much for the quick PR!!!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/antirez/redis/issues/7246#issuecomment-628461117, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2O6UPFSEYSCD4IZX7CHNLRROPWRANCNFSM4M7UEBPA.