nginx上游出现多个redis“连接超时”错误
我有用于4台redis服务器的带上游的nginx。有时我每分钟会收到20-30个这样的错误,仅针对nginx error.log中上游的第一台和第二台服务器:nginx上游出现多个redis“连接超时”错误,nginx,lua,redis,sysctl,Nginx,Lua,Redis,Sysctl,我有用于4台redis服务器的带上游的nginx。有时我每分钟会收到20-30个这样的错误,仅针对nginx error.log中上游的第一台和第二台服务器: ... upstream timed out (110: Connection timed out) while connecting to upstream ... upstream: "redis2://AAA.BBB.CCC.DDD:6379" .... 我的redis服务器上的平均负载&nginx是redis服务器本身发生了什么
... upstream timed out (110: Connection timed out) while connecting to upstream ... upstream: "redis2://AAA.BBB.CCC.DDD:6379" ....
我的redis服务器上的平均负载&nginx是redis服务器本身发生了什么?持续多长时间?我会查看redis日志,并使用工具监视redis。我们将icinga与check_redis脚本一起使用。redis统计数据已经存在,以前从未尝试过。此外,redis的“INFO”命令将向您显示很多信息。另一个选择是将其放置到位,并让它告诉您正在发生什么。
user nginx;
worker_processes 4;
timer_resolution 100ms;
worker_priority -15;
worker_rlimit_nofile 200000;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 65536;
use epoll;
multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_vary off;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/rss+xml application/atom+xml text/javascript application/javascript application/json text/mathml;
gzip_min_length 1000;
gzip_disable "MSIE [1-6]\.";
server_names_hash_bucket_size 64;
types_hash_max_size 2048;
types_hash_bucket_size 64;
include /etc/nginx/sites-enabled/*;
}
upstream redis_cluster {
server redis1.mydomain.com:6379 max_fails=0 fail_timeout=1s weight=4;
server redis2.mydomain.com:6379 max_fails=0 fail_timeout=1s weight=4;
server redis3.mydomain.com:6379 max_fails=0 fail_timeout=1s weight=4;
server redis4.mydomain.com:6379 max_fails=0 fail_timeout=1s weight=4;
}
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.tcp_max_syn_backlog = 20480
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.netfilter.nf_conntrack_max = 1048576
net.nf_conntrack_max = 1048576
net.ipv4.tcp_congestion_control = htcp
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_tw_reuse = 1
net.core.somaxconn = 15000
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_keepalive_time = 1800
net.ipv4.tcp_keepalive_intvl = 15
net.ipv4.tcp_keepalive_probes = 5
vm.overcommit_memory = 1
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.tcp_max_syn_backlog = 20480
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.netfilter.nf_conntrack_max = 1048576
net.nf_conntrack_max = 1048576
net.ipv4.tcp_congestion_control = htcp
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_tw_reuse = 1
net.core.somaxconn = 15000
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_keepalive_time = 1800
net.ipv4.tcp_keepalive_intvl = 15
net.ipv4.tcp_keepalive_probes = 5