暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

如何模拟redis超时

PiPiD 2020-09-04
1642

1. 模拟访问 redis 网络超时:

执行命令

 sudo iptables -A INPUT -p tcp --dport 6379 -j DROP

恢复网络:

 sudo iptables -F

2. client pause timeout

执行 redis 命令, 在指定时间内终止运行来自客户端的命令

client pause {timeout}

3. debug sleep

> ./redis-cli debug sleep 2
... 2 seconds wait ...
OK

4. BLPOP

> ./redis-cli blpop dummy_key_which_does_not_exist 2
... 2 seconds wait ...
(nil)

5. kill

kill -STOP $pid
sleep 1
kill -CONT $pid


文章转载自PiPiD,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论