我在redis服务器上游有nginx(5台服务器,每台服务器上有4个redis实例),如下所示:
upstream redis_cluster {
server 10.0.1.8:6379 fail_timeout=0;
server 10.0.1.8:6380 fail_timeout=0;
server 10.0.1.8:6381 fail_timeout=0;
server 10.0.1.8:6382 fail_timeout=0;
server 10.0.1.6:6379 fail_timeout=0;
server 10.0.1.6:6380 fail_timeout=0;
server 10.0.1.6:6381 fail_timeout=0;
server 10.0.1.6:6382 fail_timeout=0;
...
keepalive 16;
}
在添加最后一台服务器(实际上是最后4台redis实例)之后,我注意到其中一些有奇怪的连接:
9684 10.0.0.17:6379 TIME_WAIT
3 10.0.0.17:6380 ESTABLISHED
9677 10.0.0.17:6380 TIME_WAIT
9664 10.0.0.17:6381 TIME_WAIT
6 10.0.0.17:6382 ESTABLISHED
9660 10.0.0.17:6382 TIME_WAIT
4 10.0.1.3:6379 ESTABLISHED
1 10.0.1.3:6379 SYN_SENT
9671 10.0.1.3:6379 TIME_WAIT
3 10.0.1.3:6380 ESTABLISHED
9665 10.0.1.3:6380 TIME_WAIT
1 10.0.1.3:6381 ESTABLISHED
9661 10.0.1.3:6381 TIME_WAIT
5 10.0.1.3:6382 ESTABLISHED
9660 10.0.1.3:6382 TIME_WAIT
5 10.0.0.7:6379 ESTABLISHED
9653 10.0.0.7:6379 TIME_WAIT
4 10.0.0.7:6380 ESTABLISHED
9663 10.0.0.7:6380 TIME_WAIT
1 10.0.0.7:6381 ESTABLISHED
9664 10.0.0.7:6381 TIME_WAIT
7 10.0.0.7:6382 ESTABLISHED
9667 10.0.0.7:6382 TIME_WAIT
5 10.0.1.8:6379 ESTABLISHED
9673 10.0.1.8:6379 TIME_WAIT
2 10.0.1.8:6380 ESTABLISHED
9676 10.0.1.8:6380 TIME_WAIT
4 10.0.1.8:6381 ESTABLISHED
9665 10.0.1.8:6381 TIME_WAIT
3 10.0.1.8:6382 ESTABLISHED
在评论出最后一台服务器(最后4个上游条目)后,一切都恢复正常:
4 10.0.0.10:6379 ESTABLISHED
4 10.0.0.10:6380 ESTABLISHED
4 10.0.0.10:6381 ESTABLISHED
1 10.0.0.10:6381 TIME_WAIT
4 10.0.0.10:6382 ESTABLISHED
4 10.0.1.3:6379 ESTABLISHED
4 10.0.1.3:6380 ESTABLISHED
4 10.0.1.3:6381 ESTABLISHED
4 10.0.1.3:6382 ESTABLISHED
4 10.0.0.7:6379 ESTABLISHED
4 10.0.0.7:6380 ESTABLISHED
4 10.0.0.7:6381 ESTABLISHED
4 10.0.0.7:6382 ESTABLISHED
4 10.0.1.8:6379 ESTABLISHED
4 10.0.1.8:6380 ESTABLISHED
4 10.0.1.8:6381 ESTABLISHED
4 10.0.1.8:6382 ESTABLISHED
这可能是什么原因?先谢谢,同志们。