如何将子域路由到集群内的一个或多个合适的节点?
我正在尝试解决分布式计算架构问题。这是场景。
用户访问我的网站并注册。作为注册过程的一部分,他们获得一个子域名。例如,foo.xyz.com。
现在,每个用户网站都使用某种任意方案位于/复制在一个或多个集群节点上。
当用户请求进来时(通过浏览器的HTTP请求),适当的子域必须被重定向到匹配的集群节点。本质上,我想要自己的动态域名。我需要以快速有效的方式实施它。
我有一个基于 java 的 Web 应用程序,它在 Jetty7 容器内运行。
谢谢,
NG
I am trying to solve a distributed computing architecture problem. Here is the scenario.
Users come to my website and registers. As a part of the registration process they get a subdomain. For example, foo.xyz.com.
Now each users website is located/replicated on a one or more cluster nodes using some arbitrary scheme.
When the user request comes in (HTTP request via browser) , appropriate subdomain must be redirected to the matching cluster node. Essentially, I want my own dynamic domain name. I need to implement it in a fast and efficient way.
I've a java based web application which runs inside a Jetty7 container.
thanks,
NG
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这绝对应该在您的应用程序之外实现。您的 Web 应用程序应该尽可能与集群中请求平衡的方式无关。您将获得的最佳性能是使用硬件负载均衡器这个例子。
如果您想进行基于软件的平衡,我将配置 Apache 作为入口点,并使用 mod_proxy 之类的工具平衡集群的流量。 请参阅此涉及 Jetty 的教程。
This definitely should be implemented outside of your application. Your Web application should be, as much as possible, agnostic from the way that requests get balanced in a cluster. The best performance you would get would be with hardware load balancers this one for example.
If you want to go for software based balancing I would configure Apache to serve as entry point and balance the traffic for your cluster with something like mod_proxy. See this tutorial that refers to Jetty.
您看过 Nginx 吗?Nginx 可能超出您的需求,但它可以有效地将子域路由到特定节点。
have you taken a look at Nginx?Nginx may be more than your needs but it does effective job of routing subdomains to particular nodes.