【问题标题】:How does supervisord and nginx handle what tornado port is used?supervisord 和 nginx 如何处理使用的 tornado 端口?
【发布时间】:2013-04-24 10:03:45
【问题描述】:

我正在使用 supervisord 在不同的端口上假脱机 2 个龙卷风实例,并且我使用 nginx 作为这些端口的反向代理。我注意到所有流量都指向一个端口。当用户从 Web 服务发出请求时,supervisord 或 nginx 如何决定使用哪个 tornado 实例?

nginx 配置:

http {
    upstream frontends {
        server xx.xxx.x.xxx:8001;
        server xx.xxx.x.xxx:8002;
    }

    server {
        listen 80;
        server_name xx.xxx.x.xxx;

        location / {
            proxy_pass_header Server;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Scheme $scheme;
            proxy_pass http://frontends;
        }
    }
}

【问题讨论】:

    标签: nginx tornado supervisord


    【解决方案1】:

    来自nginx docs

    请求根据服务器权重以循环方式分配给服务器。

    默认情况下,服务器被赋予相同的权重。您确定所有请求都发送到一个端口吗?

    还要注意supervisord 的角色只是进程管理 - 只有 nginx 决定如何将流量分配到您配置的端口。

    【讨论】:

    • 不,我不确定,但感谢您澄清上游所做的事情
    猜你喜欢
    • 2016-03-16
    • 1970-01-01
    • 1970-01-01
    • 2015-12-28
    • 2021-01-22
    • 2015-01-14
    • 2013-10-08
    • 2014-10-13
    • 2011-11-23
    相关资源
    最近更新 更多