有没有任何方式配置nginx(或其他快速反向代理)动态? [英] Is there any way to configure nginx (or other quick reverse proxy) dynamically?
问题描述
所以我们假设我们执行一个命令,只改变node1上的数据,节点2的时间段不同于节点1。我们要代理将所有特殊请求(需要特定数据)重定向到node1,直到所有信息都迁移到node2,node2与node1具有相同的数据。
有什么办法让nginx(或其他代理)从Apache ZooKeeper读取其配置?或更广泛:有什么办法来有效地切换代理配置飞行?当然,应该在没有整个系统的停机时间(或最少)的情况下完成。因此,重启nginx不是选项。
p>不确定是否可以动态更改 nginx
配置而不重新启动服务器。
如果我有一个同样的要求我可能会挖掘 nodejs
和 zookeeper
集成。
$ b b
有几个有趣的开源项目:
node-zookeeper 整合 nodejs
与 zookeeper
;
$ b b
node-http-proxy 代理http服务器,可用于负载平衡。
当然,他们没有成熟,但他们可能对你很有趣。
Suppose we have several identical nodes which are the application servers of some n-tier service. And suppose we use Apache ZooKeeper to keep all the config's of our distributed application. Plus we have an nginx as a load balancer and reverse proxy in front of this application.
So let's say we perform a command which changes data only on node1, and for some period of time node2 differs from node1. And we want proxy to redirect all that special requests (which need that specific data) to node1 until all the infomation has migrated to node2 and node2 has the same data as node1.
Is there any way to make nginx (or other proxy) read its config from Apache ZooKeeper? Or more broader: is there any way to effectively switch proxy configuration on fly? And of course it should be done without (or with minimal) downtime of the whole system - so restarting nginx is not the option.
Not sure that it is possible to dynamicaly change nginx
configuration without restarting a server.
If I had a same requirement I'd probably dug into nodejs
and zookeeper
integration.
There are several interesting opensource projects:
node-zookeeper integrates nodejs
with zookeeper
;
node-http-proxy proxy http server that can be used for load balancing.
Of course they lack maturity but they might be interesting for you.
这篇关于有没有任何方式配置nginx(或其他快速反向代理)动态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!