# HELLO

```json metadata
{
  "schema_version": 2,
  "title": "HELLO",
  "description": "Handshakes with the Redis server.",
  "categories": ["docs","develop","stack","oss","rs","rc","oss","kubernetes","clients"],
  "arguments": [{"arguments":[{"display_text":"protover","name":"protover","type":"integer"},{"arguments":[{"display_text":"username","name":"username","type":"string"},{"display_text":"password","name":"password","type":"string"}],"name":"auth","optional":true,"token":"AUTH","type":"block"},{"display_text":"clientname","name":"clientname","optional":true,"token":"SETNAME","type":"string"}],"name":"arguments","optional":true,"type":"block"}],
  "syntax_fmt": "HELLO [protover [AUTH username password] [SETNAME clientname]]",
  "complexity": "O(1)",
  "group": "connection",
  "command_flags": ["noscript","loading","stale","fast","no_auth","allow_busy"],
  "acl_categories": ["@fast","@connection"],
  "since": "6.0.0",
  "arity": -1,
  "tableOfContents": {"sections":[{"id":"optional-arguments","title":"Optional arguments"},{"id":"details","title":"Details"},{"id":"redis-software-and-redis-cloud-compatibility","title":"Redis Software and Redis Cloud compatibility"},{"id":"return-information","title":"Return information"}]}

,
  "codeExamples": []
}
```


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](https://redis.io/docs/latest/commands/hgetall) returns a [map](https://redis.io/docs/latest/develop/reference/protocol-spec#maps) instead of an [array](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays), 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

<details open><summary><code>protover</code></summary>

The RESP protocol version to switch to (`2` or `3`). Required if any other option is given.

</details>

<details open><summary><code>AUTH username password</code></summary>

Authenticate the connection in addition to switching to the specified protocol version. This makes calling [`AUTH`](https://redis.io/docs/latest/commands/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.

</details>

<details open><summary><code>SETNAME clientname</code></summary>

Set the name of the current connection. This is equivalent to calling [`CLIENT SETNAME`](https://redis.io/docs/latest/commands/client-setname).

</details>

## 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`](https://redis.io/docs/latest/commands/ping) when setting up the connection.


## Redis Software and Redis Cloud compatibility

| Redis<br />Software | Redis<br />Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> |
|:----------------------|:-----------------|:------|
| <span title="Supported">&#x2705; Standard</span><br /><span title="Supported"><nobr>&#x2705; Active-Active</nobr></span> | <span title="Supported">&#x2705; Standard</span><br /><span title="Supported"><nobr>&#x2705; Active-Active</nobr></span> |  |

## Return information

**RESP2:**

[Map reply](../../develop/reference/protocol-spec#maps): a list of server properties.
[Simple error reply](../../develop/reference/protocol-spec#simple-errors): if the `protover` requested does not exist.

**RESP3:**

[Map reply](../../develop/reference/protocol-spec#maps): a list of server properties.
[Simple error reply](../../develop/reference/protocol-spec#simple-errors): if the `protover` requested does not exist.



