Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

CLIENT KILL

Last updated
CLIENT KILL ip:port
CLIENT KILL [ID client-id] [TYPE NORMAL | MASTER | REPLICA | PUBSUB] [USER username] [ADDR ip:port] [LADDR ip:port] [SKIPME YES | NO] [MAXAGE seconds]
Group
Connection
Complexity
O(N) where N is the number of client connections
Arity
-3 (at least 3 words, counting the command name)
HotKV Cloud
All plans
On-Premise
no license needed

CLIENT KILL closes client connections. It has two forms:

  • Address form: CLIENT KILL ip:port closes the one connection whose client address (the addr field of CLIENT LIST) matches.
  • Filter form: one or more option value pairs. Every connection that matches all the filters is closed.

A connection being closed gets no further replies. If it is in the middle of a command, that command finishes first.

Filter Matches
ID client-id The connection with this id. The id must be greater than 0.
TYPE type Connections of this type: normal or pubsub (slave is taken as replica). master and replica never match a connection.
USER username Connections logged in as this ACL user. The user must exist.
ADDR ip:port The connection from this client address.
LADDR ip:port Connections to this local address, as the laddr field shows it.
SKIPME YES | NO Whether the connection running the command is left open. Default YES.
MAXAGE seconds Connections open for at least this many seconds.
Case Reply (RESP2 and RESP3)
Address form, connection found Simple string OK
Address form, no such connection Error ERR No such client
Filter form Integer: the number of connections closed

Filter form errors: ERR client-id should be greater than 0, ERR Unknown client type '<type>', ERR No such user '<username>', ERR maxage is not an integer or out of range, and ERR syntax error for an unknown filter, a missing value, or a SKIPME value other than YES or NO.

127.0.0.1:6379> CLIENT KILL 10.0.0.21:40118
OK
127.0.0.1:6379> CLIENT KILL USER batch-job
(integer) 3
127.0.0.1:6379> CLIENT KILL TYPE pubsub MAXAGE 3600
(integer) 1
127.0.0.1:6379> CLIENT KILL ID 99999
(integer) 0

Same forms, filters and replies as Redis 7.4 and Valkey 8, except that the master and replica types never match a connection.

CLIENT LIST, CLIENT ID, CLIENT PAUSE, ACL DELUSER