CLIENT KILL
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:portcloses the one connection whose client address (theaddrfield of CLIENT LIST) matches. - Filter form: one or more
option valuepairs. 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.
Options
Section titled “Options”| 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. |
Return value
Section titled “Return value”| 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.
Examples
Section titled “Examples”127.0.0.1:6379> CLIENT KILL 10.0.0.21:40118OK127.0.0.1:6379> CLIENT KILL USER batch-job(integer) 3127.0.0.1:6379> CLIENT KILL TYPE pubsub MAXAGE 3600(integer) 1127.0.0.1:6379> CLIENT KILL ID 99999(integer) 0Compatibility
Section titled “Compatibility”Same forms, filters and replies as Redis 7.4 and Valkey 8, except that the
master and replica types never match a connection.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.