无法在Lua脚本中运行Redis:这个Redis命令不能从脚本中执行

我有三个运行Sentinel和Lua脚本的Redis服务器实例,以便让redis_exporter收集连接到Redis服务器的客户端列表。但是当我将脚本传递给redis-cli命令时,我会得到以下错误:

(error) ERR Error running script (call to f_4c6be190ef2981eda70d58ec0c959bd1ca2c5352): @user_script:10: @user_script: 10: This Redis command is not allowed from scripts

这是我的Lua脚本:

local r = redis.call("CLIENT", "LIST")
return r

是否有任何方法可以解决这个问题?

点赞
用户2688699
用户2688699

快速通过谷歌搜索发现,该问题出现在 redis 服务器本身而非库中。

CLIENT 命令有一个 no-script 标志。

enter image description here

https://github.com/antirez/redis/blob/fe5aea38c35e3fc35a744ad2de73543df553ae48/src/sentinel.c

2019-11-20 06:43:56