Redis Ping Command

Redis Connection

The Redis Ping command is used by the client to send a PING to the Redis server. If the server is operating normally, it will return a PONG.

It is usually used to test whether the connection to the server is still valid, or to measure latency values.

Syntax

The basic syntax of the Redis Ping command is as follows:

redis 127.0.0.1:6379> PING 

Available Versions

>= 1.0.0

Return Value

If the connection is normal, it returns a PONG; otherwise, it returns a connection error.

Examples

# 客户端和服务器连接正常

redis 127.0.0.1:6379> PING
PONG

# 客户端和服务器连接不正常(网络不正常或服务器未能正常运行)

redis 127.0.0.1:6379> PING
Could not connect to Redis at 127.0.0.1:6379: Connection refused

Redis Connection

Other Extensions