nginx灰度发布

一般网站进行大版本变动,为了慎重其见,一般会采用灰度发布的方式,即让部份用户用新功能!

一般常见的原则来区分新老版本

1:IP

2:用户

一般常见是根据用户来区分。可以如下操作。

1:修改程序代码,来判断用户是用新版本还是旧版本。在浏览器中写入标记cookie

2:在反向代理中根据标记cookie来跳到不同的后端服务器.

nginx反向代理配置文件如下:

upstream back_new {
        server 192.168.1.2;
}
upstream back_old {
       server 192.168.1.1;
}

server {
        listen 80;
        server_name  xxx.xxx.com;
        set $group "back_old";
        if ($http_cookie ~* "version_id=new"){
                set $group back_new;
        }

        location / {                       
                proxy_pass http://$group;
                proxy_set_header   Host             $host;
                proxy_set_header   X-Real-IP        $remote_addr;
                proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
                index  index.html index.htm;
       }
 }

写的简单,就这样吧!

but that’s a strong driver of their current drop
christina aguilera weight loss The Fashion Statement Of The Day

Department store sales actually declined
quick weight lossDenim Jeans will never go out of Fashion
black porn
此条目发表在 网站架构 分类目录,贴了 标签。将固定链接加入收藏夹。

评论功能已关闭。