Skip to content

HELLO

The HELLO command is used to perform a handshake between the Redis server and client. It also allows clients to negotiate the RESP protocol version used and perform authentication.

Terminal window
HELLO [protover [AUTH username password] [SETNAME clientname]]

Parameter Description

  • protover: The RESP protocol version to negotiate (2 or 3)
  • AUTH username password: Optional authentication information
  • SETNAME clientname: Set client name

The HELLO command is a modern handshake command introduced in Redis 6.0, used to replace the old AUTH and SELECT command combination. It provides a standardized way to:

  1. Negotiate the RESP (Redis Serialization Protocol) version used between client and server
  2. Perform authentication
  3. Set client name

Redis supports two RESP protocol versions:

  • RESP2: Protocol version introduced in Redis 2.0
  • RESP3: Protocol version introduced in Redis 6.0, providing richer data type support

The HELLO command can perform authentication directly during the handshake process, avoiding the need to send AUTH commands separately.

The SETNAME option can be used to set a name for the client connection, facilitating server-side management and monitoring.

In redisun, the HELLO command is implemented through the HelloCommand class, but it usually does not need to be called directly, as the client automatically executes the HELLO command when the connection is established.

Redisun redisun = new Redisun(); // Using default configuration
// The HELLO command will be executed automatically, no manual call needed

Authentication information is configured through RedisunOptions:

Redisun redisun = Redisun.create(options -> {
options.setUsername("myuser");
options.setPassword("mypassword");
});
  1. The HELLO command is available in Redis 6.0 and above
  2. Clients usually automatically execute the HELLO command when the connection is established
  3. Authentication through the HELLO command is more efficient than using the AUTH command separately