首页 > 解决方案 > 无法将传递的 Lua 脚本运行到 Redis:脚本中不允许使用此 Redis 命令

问题描述

我有三个运行哨兵的 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

有没有办法解决这个问题?

标签: redisluaredis-sentinelredis-cli

解决方案


快速谷歌似乎问题来自redis服务器本身,而不是库。

CLIENT命令有一个no-script标志

在此处输入图像描述

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


推荐阅读