PING
PING [message]
- Group
- Connection
- Complexity
- O(1)
- Arity
- -1 (at least 1 words, counting the command name)
- Flags
- fast
- HotKV Cloud
- All plans
- On-Premise
- no license needed
PING checks that the server is reachable and processing commands. Without
an argument it replies PONG. With an argument it replies with that
argument. Health checks, connection pools and latency probes use it.
PING also works on a connection that is subscribed to channels (see
SUBSCRIBE), where most other commands are refused.
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| No argument | Simple string PONG |
Simple string PONG |
With message |
message as a bulk string |
message as a bulk string |
| No argument, connection subscribed | Array of "pong" and an empty string |
Simple string PONG |
With message, connection subscribed |
Array of "pong" and message |
message as a bulk string |
More than one argument is refused with
ERR wrong number of arguments for 'ping' command.
Examples
Section titled “Examples”127.0.0.1:6379> PINGPONG127.0.0.1:6379> PING "are you there?""are you there?"Compatibility
Section titled “Compatibility”Same replies as Redis 7 and Valkey 8, including the two-element reply on a subscribed RESP2 connection.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.