From d30ee6c44a72d9a3a13167cef5914943ede0f4d2 Mon Sep 17 00:00:00 2001 From: Binbin Date: Wed, 28 Apr 2021 18:19:55 +0800 Subject: [PATCH] redis-cli: Do not use hostsocket when we got redirected in cluster mode (#8870) When redis-cli was used with both -c (cluster) and -s (unix socket), it would have kept trying to use that unix socket, even if it got redirected by the cluster (resulting in an infinite loop). (cherry picked from commit 416f2773395ffcd72d8d8408e1558f49d59a0077) --- src/redis-cli.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/redis-cli.c b/src/redis-cli.c index 7e1fe3934..ff34f2b6a 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -844,7 +844,9 @@ static int cliConnect(int flags) { cliRefreshPrompt(); } - if (config.hostsocket == NULL) { + /* Do not use hostsocket when we got redirected in cluster mode */ + if (config.hostsocket == NULL || + (config.cluster_mode && config.cluster_reissue_command)) { context = redisConnect(config.hostip,config.hostport); } else { context = redisConnectUnix(config.hostsocket);