Search code examples
redisredis-cli

Syntax error using CLIENT KILL USER <username> on Redis 5.9.102


I'm trying to kill a Redis client by user, as per the docs, but I get a syntax error in redis-cli:

redis:6379> client kill user my_client
(error) ERR syntax error
redis:6379> info
# Server
redis_version:5.9.102

What's the correct syntax for this command?


Solution

  • According to the this commit (May 1,2020) which is commited to the unstable version, your syntax is correct. But it is not released to the stable versions such as the one you used.

    If you want to remove client by ip:port format then you need something like this;

    127.0.0.1:6379> client list
    id=272 addr=127.0.0.1:51374 fd=8 name= age=66 idle=1 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=26 qbuf-free=32742 obl=0 oll=0 omem=0 events=r cmd=client
    id=273 addr=127.0.0.1:51376 fd=9 name= age=19 idle=16 flags=P db=0 sub=1 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=subscribe
    127.0.0.1:6379> client kill 127.0.0.1:51376
    OK
    127.0.0.1:6379>