Skip to content

Commit

Permalink
Updated Documentation for CLIENT KILL and CLIENT LIST (#218)
Browse files Browse the repository at this point in the history
Documentation for valkey-io/valkey#1401

---------

Signed-off-by: Sarthak Aggarwal <[email protected]>
  • Loading branch information
sarthakaggarwal97 authored Jan 17, 2025
1 parent fffb5dd commit af26ec2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion commands/client-kill.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ instead of killing just by address. The following filters are available:

* `CLIENT KILL ADDR ip:port`. This is exactly the same as the old three-arguments behavior.
* `CLIENT KILL LADDR ip:port`. Kill all clients connected to specified local (bind) address.
* `CLIENT KILL ID client-id`. Allows to kill a client by its unique `ID` field. Client `ID`'s are retrieved using the `CLIENT LIST` command.
* `CLIENT KILL ID client-id [client-id ...]`. Allows to kill a client by its unique `ID` field. Client `ID`'s can be retrieved using the `CLIENT LIST` command. The filter supports one or more `client-id` arguments.
* `CLIENT KILL TYPE type`, where *type* is one of `normal`, `master`, `replica` and `pubsub`. This closes the connections of **all the clients** in the specified class. Note that clients blocked into the `MONITOR` command are considered to belong to the `normal` class.
* `CLIENT KILL USER username`. Closes all the connections that are authenticated with the specified [ACL](../topics/acl.md) username, however it returns an error if the username does not map to an existing ACL user.
* `CLIENT KILL SKIPME yes/no`. By default this option is set to `yes`, that is, the client calling the command will not get killed, however setting this option to `no` will have the effect of also killing the client calling the command.
Expand Down
28 changes: 26 additions & 2 deletions commands/client-list.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
The `CLIENT LIST` command returns information and statistics about the client
connections server in a mostly human readable format.

You can use one of the optional subcommands to filter the list. The `TYPE type` subcommand filters the list by clients' type, where *type* is one of `normal`, `master`, `replica`, and `pubsub`. Note that clients blocked by the `MONITOR` command belong to the `normal` class.
You can use one or more optional arguments to filter the list:

The `ID` filter only returns entries for clients with IDs matching the `client-id` arguments.
- **`TYPE type`**: Filters the list by clients' type, where *type* is one of `normal`, `master`, `replica`, and `pubsub`.
> Note: Clients blocked by the `MONITOR` command belong to the `normal` class.
- **`ID client-id [client-id ...]`**: Returns entries for clients with IDs matching one or more `client-id` arguments.

- **`USER user`**: Filters the list to include only clients authenticated as the specified user.

- **`ADDR ip:port`**: Filters the list to include only clients connected from the specified address and port.

- **`LADDR ip:port`**: Filters the list to include only clients connected to the specified local address and port.

- **`SKIPME yes|no`**: Filters whether the list should skip the client making the request.
- `yes`: Skips the client making the request.
- `no`: Includes the client making the request.

- **`MAXAGE milliseconds`**: Filters the list to include only clients whose connection age (time since the client was created) is greater than or equal to the specified number of milliseconds.
> Note: This is actually a minimum age, not a maximum age. This filter was first added to CLIENT KILL, where the intention was to keep clients of a maximum age and kill the ones than the max age.
Filters can be combined to perform more precise searches. The command will handle multiple filters via logical AND.

Here is the meaning of the fields:

Expand Down Expand Up @@ -72,6 +90,12 @@ r: the client socket is readable (event loop)
w: the client socket is writable (event loop)
```

## Examples

```bash
CLIENT LIST TYPE normal USER admin MAXAGE 5000 ID 1234 5678
```

## Notes

New fields are regularly added for debugging purpose. Some could be removed
Expand Down

0 comments on commit af26ec2

Please sign in to comment.