# HELLO

> Choose RESP2 or RESP3 for the connection, optionally authenticate and name it, and get server details.

URL: https://docs.hotkv.com/commands/hello/

```
HELLO [protover [AUTH username password] [SETNAME clientname]]
```

- Group: Connection
- Complexity: O(1)
- HotKV Cloud: all plans
- On-Premise: no license needed

`HELLO` is usually the first command a modern client library sends. It
switches the connection to the protocol version you ask for (`2` for RESP2,
`3` for RESP3) and replies with a short description of the server. Without
arguments it keeps the current protocol and only returns the description.

The `AUTH` and `SETNAME` options let a client log in and name the connection
in the same round trip. They can only follow a `protover`.

## Options

| Option | Effect |
| --- | --- |
| `protover` | `2` or `3`. Any other value is refused with `NOPROTO unsupported protocol version`. |
| `AUTH username password` | Log in as this ACL user first, as [AUTH](https://docs.hotkv.com/commands/auth/index.md) does. Use `default` as the user name for a `requirepass` password. |
| `SETNAME clientname` | Name the connection, as [CLIENT SETNAME](https://docs.hotkv.com/commands/client-setname/index.md) does. The name cannot contain spaces or non-printable characters. |

If the server needs a password and the connection is not authenticated,
`HELLO` without `AUTH` fails with this error, and the protocol is not
changed:

```
NOAUTH HELLO must be called with the client already authenticated, otherwise the HELLO <proto> AUTH <user> <pass> option can be used to authenticate the client and select the RESP protocol version at the same time
```

## Return value

Seven fields: a map in RESP3, a flat array of field and value pairs in RESP2.
The reply already uses the protocol you selected.

| Field | Value |
| --- | --- |
| `server` | `hotkv` |
| `version` | The Redis version HotKV is compatible with (`8.4.0`). Client libraries choose features by it. The HotKV release is in the `hotkv_version` field of [INFO](https://docs.hotkv.com/commands/info/index.md) `server`. |
| `proto` | The protocol now in use, `2` or `3`. |
| `id` | The connection id, as [CLIENT ID](https://docs.hotkv.com/commands/client-id/index.md) returns it. |
| `mode` | `standalone` or `cluster`. |
| `role` | `master` or `replica`. |
| `modules` | Always an empty array. HotKV has no module system. |

Other errors: `WRONGPASS` when `AUTH` fails, `ERR syntax error` for an
unknown or incomplete option, and the name error of
[CLIENT SETNAME](https://docs.hotkv.com/commands/client-setname/index.md).

## Examples

```
127.0.0.1:6379> HELLO 3
1# "server" => "hotkv"
2# "version" => "8.4.0"
3# "proto" => (integer) 3
4# "id" => (integer) 7
5# "mode" => "standalone"
6# "role" => "master"
7# "modules" => (empty array)
127.0.0.1:6379> HELLO 2 AUTH default s3cret SETNAME worker-1
 1) "server"
 2) "hotkv"
 3) "version"
 4) "8.4.0"
 5) "proto"
 6) (integer) 2
 7) "id"
 8) (integer) 7
 9) "mode"
10) "standalone"
11) "role"
12) "master"
13) "modules"
14) (empty array)
127.0.0.1:6379> HELLO 4
(error) NOPROTO unsupported protocol version
```

## Compatibility

Same options and error replies as Redis 7 and Valkey 8. The `server` field
is `hotkv`, and `modules` is always empty. See [RESP3](https://docs.hotkv.com/develop/resp3/index.md) for
how replies differ between the two protocols.

## See also

[AUTH](https://docs.hotkv.com/commands/auth/index.md), [CLIENT SETNAME](https://docs.hotkv.com/commands/client-setname/index.md),
[CLIENT INFO](https://docs.hotkv.com/commands/client-info/index.md), [RESET](https://docs.hotkv.com/commands/reset/index.md),
[PING](https://docs.hotkv.com/commands/ping/index.md)