Search code examples
redisredis-cli

Redis CLI Rename Key - ERR unknown command RENAME with args


I have a redis-cli script that I can run locally (from Win10) but it fails when I run it against the server (Linux) with rename command.

After connecting with redis-cli (from Win10), I run the following:

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"

while locally everything is OK, when I run it against the server, I get the following output:

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>

(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,

redis server details:

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

What am I doing wrong here? Is it that I am running Win10 cli against Linux Redis server that causes it?

thanks!


Solution

  • Conclusion

    The RENAME command has been rename to something meaningless on your server.

    Solution

    Check the redis.conf file on the server whether there is a line rename-command RENAME xxx. If so, comment it and restart the Redis server.(if the server is online, contact the administrator first)

    From 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