nginx-lua-ds-loadbalancer 介绍
Nginx-lua-ds-loadbalancer 是一个HTTP负载均衡器,基于liseen/lua-resty-http
A http loadbalancer which is based on liseen/lua-resty-http
Put the code into the directory lua/ds_lb which is located in the root
directory of the Nginx
Add the config below to the http seg in Nginx.conf:
lua_package_path "/u/Nginx/lua/ds_lb/?.lua;;"; lua_need_request_body on; init_by_lua_file lua/ds_lb/init.lua;
Add the config below to the location seg in Nginx.conf:
location / { content_by_lua_file lua/ds_lb/lb.lua; }
You can config loadbalancer with the file config.lua
可以自己定制调度策略,只需在sched文件夹下创建相关的调度策略文件,在其中提供get_selected_server()函数即可
You can custom your sched strategy by just creating the sched file in the
“sched” directory,and provide the function get_selected_server()