无法 运行 将 Lua 脚本传递给 Redis:脚本中不允许使用此 Redis 命令

cannot run passed Lua script to Redis: This Redis command is not allowed from scripts

我有三个 Redis 服务器 运行 哨兵实例和一个 Lua 脚本,以便 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

有什么办法可以解决这个问题吗?

快速 google 看来问题出在 redis 服务器本身,而不是库。

CLIENT 命令有一个 no-script 标志

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