From 5483adc26b0427509686b162d1a8ce241530a48e Mon Sep 17 00:00:00 2001 From: Martin Angers Date: Mon, 11 Apr 2022 16:17:30 -0400 Subject: [PATCH] Detect the NOPERM error to mean redis cluster is disabled (#5058) --- changes/issue-5048-detect-noperm-redis-standalone | 1 + server/datastore/redis/redis.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changes/issue-5048-detect-noperm-redis-standalone diff --git a/changes/issue-5048-detect-noperm-redis-standalone b/changes/issue-5048-detect-noperm-redis-standalone new file mode 100644 index 0000000000..3823c21b96 --- /dev/null +++ b/changes/issue-5048-detect-noperm-redis-standalone @@ -0,0 +1 @@ +* Support Redis in standalone mode when CLUSTER commands are disabled via ACL. diff --git a/server/datastore/redis/redis.go b/server/datastore/redis/redis.go index c8eae2da80..fc5dea76c9 100644 --- a/server/datastore/redis/redis.go +++ b/server/datastore/redis/redis.go @@ -336,7 +336,8 @@ func newCluster(conf PoolConfig) (*redisc.Cluster, error) { } func isClusterDisabled(err error) bool { - return strings.Contains(err.Error(), "ERR This instance has cluster support disabled") + return strings.Contains(err.Error(), "ERR This instance has cluster support disabled") || + strings.Contains(err.Error(), "NOPERM this user has no permissions to run the 'cluster' command") } // On GCP Memorystore the CLUSTER command is entirely unavailable and fails with