CLIENT SETNAME
CLIENT SETNAME connection-name
- Group
- Connection
- Complexity
- O(1)
- Arity
- 3 (exactly, counting the command name)
- HotKV Cloud
- All plans
- On-Premise
- no license needed
CLIENT SETNAME names the current connection. The name appears as name= in
CLIENT LIST and CLIENT INFO,
and in SLOWLOG GET entries, which makes it much
easier to tell which application or worker a connection belongs to. An empty
string removes the name.
The name cannot contain spaces, newlines or other non-printable characters,
so that CLIENT LIST stays easy to parse. HELLO can set
the name too, with its SETNAME option.
Return value
Section titled “Return value”| Case | Reply (RESP2 and RESP3) |
|---|---|
| Name set | Simple string OK |
| Name with a space or special character | Error ERR Client names cannot contain spaces, newlines or special characters. |
Examples
Section titled “Examples”127.0.0.1:6379> CLIENT SETNAME billing-worker-3OK127.0.0.1:6379> CLIENT GETNAME"billing-worker-3"127.0.0.1:6379> CLIENT SETNAME "billing worker"(error) ERR Client names cannot contain spaces, newlines or special characters.Compatibility
Section titled “Compatibility”Same as Redis 7 and Valkey 8.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.