CLIENT SETNAME. LUA

15 views
Skip to first unread message

Александр Нижегородцев

unread,
Jul 17, 2017, 6:07:01 AM7/17/17
to Redis DB
Hello!

I'm working with redis cluster and I want to allow clients to identify themselves using CLIENT SETNAME command. But I can't allow all CLIENT commands to be available because there are such commands and CLIENT KILL and CLIENT PAUSE.

I decided to rename CLIENT command to "new_unguessable_name" and provide LUA script which allows to perform only CLIENT SETNAME command:

SCRIPT LOAD "return redis.call('new_unguessable_name', 'SETNAME', ARGV[1])"

So in theory from client side I can use evalsha to set client name:
evalsha "setname_script_sha1" 0 "Client_name_1"
But in fact redis throws error: "This Redis command is not allowed from scripts". Is it possible somehow to avoid this restriction? Why redis don't allow me to set client name using LUA script?

Jan-Erik Rediger

unread,
Jul 17, 2017, 6:27:45 AM7/17/17
to redi...@googlegroups.com
Lua scripts use a fake client inside the Redis server.
Even if it would allow `CLIENT SETNAME` the name would be for this fake client,
not for the real network-connected client.
That's also why the CLIENT commands are currently disallowed.

-- jer
> --
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
> To post to this group, send email to redi...@googlegroups.com.
> Visit this group at https://groups.google.com/group/redis-db.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages