Can you provide some ideas? For example, I have the following upstream block in nginx.conf:
upstream value{
server 127.0.0.1:1234;
server 127.0.0.1:5678;
}
nginx provides external interfaces, such as 127.0.0.1/change, you can clear the contents of the above upstream, and reload all back-end server information from redis and write it to the above upstream in the nginx.conf file. Finally execute ./nginx -s reload.
曾经蜡笔没有小新2017-05-16 17:12:36
Check whether lua has a file module that can operate on files, and also see if lua can call a shell or similar nginx signal to reload the nginx configuration file.
漂亮男人2017-05-16 17:12:36
Do you want to implement a function similar to dynamic load? If so, I think you can use openresty
的 ngx.balancer
来解决。这样无需重启nginx
to dynamically change the backend server.