1、在與redis同一個內網的服務器上A的nginx作了下面的設置nginx
stream {redis
upstream redis {服務器
server redis.rds.aliyuncs.com:6379 max_fails=3 fail_timeout=30s;阿里雲
}spa
server {server
listen 6379;get
proxy_connect_timeout 1s;stream
proxy_timeout 3s;proxy_pass
proxy_pass redis;im
}
}
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;
}
}