From 694b973bc035f1d1dec2b1c70d14f044b021c824 Mon Sep 17 00:00:00 2001 From: chentianjie Date: Thu, 30 Nov 2023 10:24:53 +0800 Subject: [PATCH] Mention before 8.0, by/get is not allowed in cluster mode. --- commands/sort.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/commands/sort.md b/commands/sort.md index ad3a5b9e54..1f4ef5f910 100644 --- a/commands/sort.md +++ b/commands/sort.md @@ -105,7 +105,9 @@ SORT mylist BY weight_* GET object_* GET # ## Restrictions for using external keys -Specially, in `Redis cluster-mode`, `BY` or `GET` can only be used when pattern contains hash tag and implies a specific slot which the key is also in, which means any key matching this pattern must be in the same slot as the key, and therefore in the same node. For example, in cluster mode, `{mylist}weight_*` is acceptable as a pattern when sorting `mylist`, while pattern `{abc}weight_*` will be denied, causing the command to fail with an error. +Before 8.0, when enabling `Redis cluster-mode` there is no way to guarantee the existence of the external keys on the node which the command is processed on. In this case, any use of `GET` or `BY` which reference external key pattern will cause the command to fail with an error. + +Starting from 8.0, patterns with hash tag can be mapped to a slot, and so in `Redis cluster-mode`, the use of `BY` or `GET` is allowed when pattern contains hash tag and implies a specific slot which the key is also in, which means any key matching this pattern must be in the same slot as the key, and therefore in the same node. For example, in cluster mode, `{mylist}weight_*` is acceptable as a pattern when sorting `mylist`, while pattern `{abc}weight_*` will be denied, causing the command to fail with an error. Starting from Redis 7.0, any use of `GET` or `BY` which reference external key pattern will only be allowed in case the current user running the command has full key read permissions. Full key read permissions can be set for the user by, for example, specifying `'%R~*'` or `'~*` with the relevant command access rules.