1
votes

I try to use "config get" command to get one of redis status metrics in lua ,but get "Unknown Redis command called from Lua script", I do not know why?

127.0.0.1:6379> eval "return redis.call('config get','lazyfree_pending_objects')" 0
(error) ERR Error running script (call to f_4e7351811a87a6961eb6fe85622dce826bbc681c): @user_script:1: @user_script: 1: Unknown Redis command called from Lua script
127.0.0.1:6379> eval "return redis.call('config', 'get','lazyfree_pending_objects')" 0
(empty list or set)
127.0.0.1:6379> eval "return redis.call('config', 'get','used_memory_dataset')" 0
(empty list or set)
127.0.0.1:6379> eval "return redis.call('config', 'get used_memory_dataset')" 0
(error) ERR Error running script (call to f_25423fef37dc24142677d59a564f5b664f9e0f45): @user_script:1: ERR CONFIG subcommand must be one of GET, SET, RESETSTAT, REWRITE
2

2 Answers

3
votes

I had the same issue. This issue started occurring after I upgraded the python redis==2.10.5 to redis==3.5.3.

I guess it happen because of the Redis server (Linux package) version is not supported by latest python redis package.

I have upgraded linux Redis server package to 4.0.9 and it works.

Remember to restart the system.

2
votes

You code has 2 problems.

For config get xxx, config is the command, get is the subcommand, and xxx is the configuration field. So when you call it with Lua script, you should use redis.call('config', 'get', 'xxx').

If you call it as redis.call('config get', 'xxx'), Redis will take config get as the command, which is an UNKNOWN command. If you call it as redis.call('config', 'get xxx'), Redis will take get xxx as the subcommand, which is also invalid.

The other problem is that lazyfree_pending_objects and used_memory_dataset are NOT configuration, but system info. You should use the INFO command instead.