核心含义
PONG 是 Redis 对 PING 命令的标准响应,表示:
| 层面 |
含义 |
| 网络层 |
客户端与服务端TCP连接正常 |
| 服务层 |
Redis进程存活且正在运行 |
| 认证层 |
(如果配置了密码)密码验证通过 |
| 命令层 |
服务端能正常解析并响应命令 |
使用场景
1 2 3 4 5 6 7 8 9 10 11 12
| 127.0.0.1:6379> PING PONG
127.0.0.1:6379> PING "hello redis" "hello redis"
Jedis jedis = new Jedis("192.168.137.128", 6379); String response = jedis.ping(); // 返回 "PONG" jedis.close();
|
常见异常响应
| 响应 |
原因 |
Could not connect to Redis |
服务未启动、端口不通、防火墙拦截 |
NOAUTH Authentication required |
密码错误但未通过认证 |
ERR operation not permitted |
当前用户无执行 PING 的权限(罕见) |
| 超时/卡住 |
网络延迟高、服务端负载过高 |
总结:PONG = 一切正常,Redis 已就绪。