Detect the NOPERM error to mean redis cluster is disabled (#5058)

This commit is contained in:
Martin Angers 2022-04-11 16:17:30 -04:00 committed by GitHub
parent a8d7b5478b
commit 5483adc26b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -0,0 +1 @@
* Support Redis in standalone mode when CLUSTER commands are disabled via ACL.

View File

@ -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