Redis Ping Command
The Redis Ping command uses the client to send a PING to the Redis server; if the server is operating normally, it returns a PONG.
It is usually used to test whether the connection to the server is still active, or to measure latency.
Syntax
The basic syntax of the redis Ping command is as follows:
redis 127.0.0.1:6379> PING
Available Version
= 1.0.0
Return Value
Returns a PONG if the connection is normal, otherwise returns a connection error.
Example
# Client and server connection is normal
redis 127.0.0.1:6379> PING
PONG
# Client and server connection is abnormal (network abnormal or server failed to run normally)
redis 127.0.0.1:6379> PING
Could not connect to Redis at 127.0.0.1:6379: Connection refused