Hello!
2015-01-25 22:58 GMT-08:00 siqin:
> agentzh 您好!
> 恕我冒昧发此邮件,恳请您的帮助.我看了您的博文 Nginx变量漫谈
> 系列,收获颇丰,先道声感谢.
谢谢阅读 :)
> 现请教您一下,用Nginx做负载均衡时候,想动态设置后端服务器的权重值,比如请求URL是http://localhost/setweight?index=0&weight=9
> 就将后端服务器1的权重值设置为9,即weight=9.
我有计划在 ngx_lua_upstream 模块中添加一个 set_peer_weight() 方法:
https://github.com/openresty/lua-upstream-nginx-module
届时你这种需求就很容易在 Lua 里面实现了(类似 lua-resty-upstream-healthcheck 库 [1] 的实现)。
欢迎贡献补丁 :)
值得一提的是,有一个哥们也在弄这个功能:
https://github.com/openresty/lua-upstream-nginx-module/pull/5
或许可以跟他协作一下?
值得一提的是,建议加入 openrsety 中文邮件列表讨论相关的技术细节,谢谢合作!请见
http://openresty.org/#Community 同时抄送给该列表。
Regards,
-agentzh
[1] https://github.com/openresty/lua-resty-upstream-healthcheck