1、在與redis同一個內網的服務器上A的nginx作了下面的設置html
stream {nginx
upstream redis {redis
server redis.rds.aliyuncs.com:6379 max_fails=3 fail_timeout=30s;服務器
}post
server {阿里雲
listen 6379;url
proxy_connect_timeout 1s;server
proxy_timeout 3s;htm
proxy_pass redis;blog
}
}
2、服務器B上經過A:6379 來鏈接到阿里雲的redis
3、redis常常報錯 Unexpected end of stream
4、解決辦法,修改nginx的下面2個參數:
server {
listen 6379;
proxy_connect_timeout 10s;
proxy_timeout 30s;
proxy_pass redis;
}
}