Nginx configuration files automatically loaded program

  

nginx automatically load the configuration file scheme
a, nginx + consul + consul-template
implementation process: consul as a service discovery software, consul-template as a template nginx configuration files, consul-template monitoring consul in data changes by dynamically modify nginx configuration template file, and then execute the purpose of nginx -s reload command routing updates, to achieve dynamic load balancing.
Pros: Dynamic load configuration files, configuration files modified in real time
Cons: Use reload to load the configuration file, if it is connected websocket long service, high traffic applications, users will have an impact, will lose some qps. Dependence on the consul, consul services hang or timeout nginx will have an impact, requires the use of cluster models ensuring stability consul consul services

Two, nginx + nginx-upsync-module + consul
implementation: nginx-upsync-module whose function is to pull the rear end of the list of the server's consul, and update the routing information of Nginx, no reload, a single point on the consul also good availability


Individual function modules:
ngx_http_dyups_module: After modifying the upstream information does not need to reload but directly upstream of the modified memory
nginx-upsync-module: based on dynamically updated routing Nginx nginx achieve three dynamic configuration module can pull the service information in the consul, and information
nginx_upstream_check_module: Physical examination specifically the load balancer node party modules, through which the rear end can be used to detect the state of health of realserver. If the backend realserver unavailable, subsequent requests will not be forwarded to the node, and continue to check the state of the node, the drawback is requested was not forwarded to the node to persist for some time after, consul own health checks can be resolved the problem

Guess you like

Origin www.cnblogs.com/lidong94/p/11543921.html