weibocom / nginx-upsync-module

For http protocol. nginx-upsync-module, sync upstreams from consul or etcd and so on, dynamiclly modify backend-servers attributes(weight, max_fails, down...), needn't reload nginx
1.82k stars 391 forks source link

upstream不支持backup参数 #227

Open neighbour-oldhuang opened 6 years ago

neighbour-oldhuang commented 6 years ago

consul配置了127.0.0.1:83的参数: {"backup":1,"weight":2, "max_fails":2, "fail_timeout":10}

状态显示:

Upstream name: myup; Backend server count: 3
        server 127.0.0.1:83 weight=2 max_fails=2 fail_timeout=10s;
        server 127.0.0.1:82 weight=2 max_fails=2 fail_timeout=10s;
        server 127.0.0.1:81 weight=2 max_fails=2 fail_timeout=10s down;

backup没生效

gfrankliu commented 6 years ago

down, backup这两个参数跟其他参数不一样,不需要赋值。

neighbour-oldhuang commented 6 years ago

down, backup这两个参数跟其他参数不一样,不需要赋值。

不给值的话 ,upsync会提示 upsync_parse_json: parse '{"weight": 1, "max_fails": 3, "fail_timeout":10, "down":0, "backup"}' failed
backup 或者"backup" 都不行, "down":1 这个是没问题的

gfrankliu commented 5 years ago

I this below in the source:

            //if (server->backup) {
            //    continue;
            //}
            //
            // FIXME: until backup is fully implemented this causes crashes
            //        on startup with nodes set backup=1. Let them in for now

It looks like "backup" is not supported yet. @xiaokai-wang do you know the history about this?

CallMeFoxie commented 5 years ago

I actually do, I commented those lines out :). The main nginx code has/had some code to handle them but it was not implemented in upsync properly and it kept crashing the nginx. The easiest and quickest fix was to comment it out until a proper implementation happens.

hadret commented 5 years ago

Are there any plans on implementing backup properly/fully?