![Rackspace Cloud 和专用硬件上的 RHEL 6.x 遇到 Redis 超时](https://linux22.com/image/796801/Rackspace%20Cloud%20%E5%92%8C%E4%B8%93%E7%94%A8%E7%A1%AC%E4%BB%B6%E4%B8%8A%E7%9A%84%20RHEL%206.x%20%E9%81%87%E5%88%B0%20Redis%20%E8%B6%85%E6%97%B6.png)
我最近刚刚使用 Rackconnect 设置了 RHEL 6.1 Rackspace 云主机和 RHEL 6.2 专用主机的混合体。我遇到了 Rails 3.2.8 应用程序内的间歇性 Redis 超时问题,而 Redis 2.4.16 运行在 RHEL 6.2 专用主机上。没有网络延迟或数据包丢失。此外,我们的云或专用服务器或 Rackspace 托管防火墙上的任何接口都没有错误。
当 Redis 超时时,即使已设置了调试日志记录,Redis 中也不会记录任何内容。我们收到的唯一错误来自 Airbrake,称 Redis 超时。
网络拓扑结构:
RHEL 6.1 cloud hosts <--> Alert logic IDS <--> Cisco ASA 5510 <--> RHEL 6.2 dedicated hosts
(web nodes) (two way NAT) (db hosts running redis)
从数据库主机 ping 至网络主机:
64 bytes from 10.181.230.180: icmp_seq=998 ttl=64 time=0.520 ms
64 bytes from 10.181.230.180: icmp_seq=999 ttl=64 time=0.579 ms
64 bytes from 10.181.230.180: icmp_seq=1000 ttl=64 time=0.482 ms
--- web1.xxxxxx.com ping statistics ---
1000 packets transmitted, 1000 received, 0% packet loss, time 999007ms
rtt min/avg/max/mdev = 0.359/0.535/5.684/0.200 ms
从 Web 主机 ping 数据库主机:
64 bytes from 192.168.100.26: icmp_seq=998 ttl=64 time=0.544 ms
64 bytes from 192.168.100.26: icmp_seq=999 ttl=64 time=0.452 ms
64 bytes from 192.168.100.26: icmp_seq=1000 ttl=64 time=0.529 ms
--- data1.xxxxxx.com ping statistics ---
1000 packets transmitted, 1000 received, 0% packet loss, time 999017ms
rtt min/avg/max/mdev = 0.358/0.499/6.120/0.201 ms
Redis 配置:
daemonize yes
pidfile /var/run/redis/6379/redis_6379.pid
port 6379
timeout 0
loglevel debug
logfile /var/lib/redis/log
syslog-enabled yes
syslog-ident redis-6379
syslog-facility local0
databases 16
save 900 1
save 300 10
save 60 10000
rdbcompression yes
dbfilename dump-6379.rdb
dir /var/lib/redis
maxclients 10000
maxmemory-policy volatile-lru
maxmemory-samples 3
appendfilename appendonly-6379.aof
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
slowlog-log-slower-than 10000
slowlog-max-len 1024
vm-enabled no
vm-swap-file /tmp/redis.swap
vm-max-memory 0
vm-page-size 32
vm-pages 134217728
vm-max-threads 4
hash-max-zipmap-entries 512
hash-max-zipmap-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
activerehashing yes
Redis-cli 信息:
redis-cli info
redis_version:2.4.16
redis_git_sha1:00000000
redis_git_dirty:0
arch_bits:64
multiplexing_api:epoll
gcc_version:4.4.6
process_id:4174
uptime_in_seconds:79346
uptime_in_days:0
lru_clock:1064644
used_cpu_sys:13.08
used_cpu_user:19.81
used_cpu_sys_children:1.56
used_cpu_user_children:7.69
connected_clients:167
connected_slaves:0
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:6
used_memory:15060312
used_memory_human:14.36M
used_memory_rss:22061056
used_memory_peak:15265928
used_memory_peak_human:14.56M
mem_fragmentation_ratio:1.46
mem_allocator:jemalloc-3.0.0
loading:0
aof_enabled:0
changes_since_last_save:166
bgsave_in_progress:0
last_save_time:1352823542
bgrewriteaof_in_progress:0
total_connections_received:286
total_commands_processed:507254
expired_keys:0
evicted_keys:0
keyspace_hits:1509
keyspace_misses:65167
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:690
vm_enabled:0
role:master
db0:keys=6,expires=0
编辑1:添加 redis-cli info 输出
答案1
已解决。这是因为我们的 Cisco ASA 丢弃了部分连接/断开的 TCP 连接。使用 Rackspace 更新配置解决了此问题。