Latest web development tutorials

Redis Ping command

Redis connection

Redis Ping command uses the client sends a PING to the Redis server, if the server is functioning properly, then returns a PONG.

Usually used to test the server connection is still in force, or for measuring the delay value.

grammar

redis Ping basic command syntax is as follows:

redis 127.0.0.1:6379> PING 

Available versions

> = 1.0.0

return value

If the connection is normal 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