我刚刚阅读了这个数字海洋项目,并想知道最后一个示例中的拓扑学是否可以用nginx实现。
我感兴趣的是负载均衡器如何处理两个不在应用服务器前面的专用缓存服务器。他们这样描述这个过程:
我想负载均衡器应该在上游指令中包含这两组:
upstream cachebackend {
server cache-1.example.com;
server cache-2.example.com;
}
upstream appbackend {
server app-1.example.com;
server app-2.example.com;
}然后从服务器指令内部:
location / {
proxy_pass http://cachebackend;
# if that one is a MISS, request this one:
# proxy_pass http://appbackend;
# and then save the response on the cachebackend
# before returning it to the client
}我想知道如何告诉nginx遵循上面的步骤,或者是否有可能。
谢谢:)
发布于 2015-09-23 17:39:09
Nginx可以同时负载平衡和缓存,您只需要使用proxy_cache_path指令配置缓存区域,并使用proxy_cache将其分配给特定的server {}或location {}。因此,最后,如果使用nginx作为负载均衡器和缓存,则数字海洋体系结构看起来是多余的。
https://serverfault.com/questions/724341
复制相似问题