HELLO
HELLO [protover [AUTH username password] [SETNAME clientname]]
- Available since:
- Redis Open Source 6.0.0
- Time complexity:
- O(1)
- ACL categories:
-
@fast,@connection, - Compatibility:
- Redis Software and Redis Cloud compatibility
Switches to a different protocol version, optionally authenticates the connection and sets the connection name. When you call HELLO with no arguments, or with a protocol version (2 or 3) and optional authentication information, the command also returns server and connection properties.
Redis 6 and later support two protocols: RESP2 and RESP3. RESP3 lets Redis return more semantic replies. For example, HGETALL returns a map instead of an array, so a client library does not need command-specific logic to convert the reply into a hash before returning it to the caller.
In Redis 6+, connections start in RESP2 mode, so clients implementing RESP2 do not need to updated or changed.
Optional arguments
protover
The RESP protocol version to switch to (2 or 3). Required if any other option is given.
AUTH username password
Authenticate the connection in addition to switching to the specified protocol version. This makes calling AUTH before HELLO unnecessary when setting up a new connection. Note that the username can be set to "default" to authenticate against a server that does not use ACLs, but rather the simpler requirepass mechanism of Redis prior to version 6.
SETNAME clientname
Set the name of the current connection. This is equivalent to calling CLIENT SETNAME.
Details
HELLO always replies with a list of current server and connection properties,
such as: version, loaded modules, client ID, replication role and so on.
When called without any arguments in Redis 6.2 or greater and its default use of RESP2
protocol, the reply looks like this:
> HELLO
1) "server"
2) "redis"
3) "version"
4) "8.8.0"
5) "proto"
6) (integer) 2
7) "id"
8) (integer) 5
9) "mode"
10) "standalone"
11) "role"
12) "master"
13) "modules"
14) ...
Clients that want to handshake using the RESP3 mode need to call the HELLO
command and specify the value "3" as the protover argument, like so:
> HELLO 3
1# "server" => "redis"
2# "version" => "8.8.0"
3# "proto" => (integer) 3
4# "id" => (integer) 10
5# "mode" => "standalone"
6# "role" => "master"
7# "modules" => ...
Because HELLO replies with useful information, and given that protover is
optional or can be set to "2", client library authors may consider using this
command instead of the canonical PING when setting up the connection.
Redis Software and Redis Cloud compatibility
| Redis Software |
Redis Cloud |
Notes |
|---|---|---|
| ✅ Standard |
✅ Standard |
Return information
protover requested does not exist.
History
- Starting with Redis version 6.2.0:
protovermade optional; when called without arguments the command reports the current connection's context.