err unknown command rename with args

7uzetpgm  于 2021-06-09  发布在  Redis
关注(0)|答案(1)|浏览(1086)

我有一个redis cli脚本,我可以在本地(从win10)运行,但在服务器(linux)上使用rename命令运行时失败。
在连接redis cli(从win10)后,我运行以下命令:

SET "someinstance.domain.us:mytenant:MyDailyData:2018.1.10" "Hello123"
GET "someinstance.domain.us:mytenant:MyDailyData:2018.1.10"
RENAME "someinstance.domain.us:mytenant:MyDailyData:2018.1.10" "TEMP:someinstance.domain.us:mytenant:MyDailyData:2018.1.10"
DEL "TEMP:someinstance.domain.us:mytenant:MyDailyData:2018.1.10"
GET "TEMP:someinstance.domain.us:mytenant:MyDailyData:2018.1.10"

虽然本地一切正常,但当我在服务器上运行它时,会得到以下输出:

my-redis-address:6379> SET "someinstance.domain.us:mytenant:MyDailyData:2018.1.10" "Hello123"
OK
my-redis-address:6379> GET "someinstance.domain.us:mytenant:MyDailyData:2018.1.10"
"Hello123"
my-redis-address:6379> RENAME "someinstance.domain.us:mytenant:MyDailyData:2018.1.10" "TEMP:someinstance.domain.us:mytenant:MyDailyData:2018.1.10"

(error) ERR unknown command `RENAME`, with args beginning with: `someinstance.domain.us:mytenant:MyDailyData:2018.1.10`, `TEMP:someinstance.domain.us:mytenant:MyDailyData:2018.1.10`,

my-redis-address:6379> DEL "TEMP:someinstance.domain.us:mytenant:MyDailyData:2018.1.10"
(integer) 0
my-redis-address:6379> GET "TEMP:someinstance.domain.us:mytenant:MyDailyData:2018.1.10"
(nil)
my-redis-address:6379>

(错误)err unknown command rename,参数以:someinstance.domain.us开头:mytenant:mydailydata:2018.1.10, temp:someinstance.domain.us:mytenant:mydailydata:2018.1.10,
redis服务器详细信息:

gcc_version 5.4.0
os  Linux 4.4.0-176-generic x86_64
redis_build_id  452d9690a8de23a2
redis_mode  standalone
redis_version   5.0.7

我做错什么了?是我在linux redis服务器上运行win10 cli导致的吗?
谢谢!

2ekbmq32

2ekbmq321#

结论

这个 RENAME 命令已被重命名为服务器上没有意义的内容。

解决方案

检查服务器上的redis.conf文件是否有行 rename-command RENAME . 如果是,请对其进行注解并重新启动redis服务器。(如果服务器联机,请先与管理员联系)
从redis.conf:


# It is possible to change the name of dangerous commands in a shared

# environment. For instance the CONFIG command may be renamed into something

# hard to guess so that it will still be available for internal-use tools

# but not available for general clients.

# 

# Example:

# 

# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52

相关问题