openresty - Use lua-nginx-module to modify the content in upstream and reload
阿神
阿神 2017-05-16 17:10:36
0
2
687

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.

阿神
阿神

闭关修行中......

reply all(2)
曾经蜡笔没有小新

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.

漂亮男人

Do you want to implement a function similar to dynamic load? If so, I think you can use openrestyngx.balancer来解决。这样无需重启nginx to dynamically change the backend server.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!