独角兽多机设置 [英] Unicorn multiple machines setup

查看:129
本文介绍了独角兽多机设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对结合Nginx的Unicorn配置有很好的经验,经过优化和调整过程后,它的工作效果非常好.但是现在我有一个问题,那就是用Unicorns在多台计算机上分散负载的最佳方法是什么.

I have a good experience with Unicorn configuration with conjunction of Nginx, it works really well after optimizations and tuning procedures. But now I have got a question what is the best way to spread the load across multiple machines with Unicorns.

问题是您有3台计算机(Nginx负载平衡器,2台装有Unicorns的APP服务器),如何管理通过提供静态资产的Unicorns的负载平衡.

The question is you have 3 machines (Nginx load balancer, 2 APP servers with Unicorns), how do you manage load balancing of Unicorns with serving static assets.

您现在在通过TCP与Unicorn连接时是否存在任何弊端(超时,连接丢失),是否还有其他方法可以通过网络与上游套接字进行连接(可能是通过SSH进行端口转发)?独角兽设计为无状态,但是您如何管理极端情况?

Do you now any drawbacks with connection to Unicorn over TCP (timeouts, connection lost), is there any other way to upstream socket connection over the network (maybe port forwarding over SSH)? Unicorn designed to be stateless, but how do you manage the edge cases?

我不想从均衡器节点提供静态服务,因此可以在每台APP服务器上设置Nginx并在它们前面设置哑巴Nginx均衡器吗?

I don't want to serve static from balancer node, so would it be ok to setup Nginx on each of APP server and setup dumb Nginx balancer in front of them?

P.S.我当前的配置已经过充分测试,可以在 Github 上找到,但是使用Nginx + Unicorn进行设置成为瓶颈的同一台机器.

P.S. My current configuration is well-tested and can be found on Github, but the setup with Nginx+Unicorn on the same machine that already became a bottleneck.

更新:开发严格取决于特定的服务器配置.瓶颈的发生不仅是由于开发人员的决定,而且还取决于开发人员的运行环境. Stackoverlow充满了带有高度标记的Q& A,与常见的有关特定配置的详细信息有关.以下回答的亚历克斯与Github一起工作,我非常感谢有这样资格的人的答复!

UPDATE: Development is rigidly depends on the specific server configuration. Bottlenecks are going to happen not just because of developer's decisions, but also with the environment where he run it. Stackoverlow is full with highly marked Q&A related to the hard-to-know details about specific configuration. Alex who answered below works with Github I'm really appreciate to have a reply by such qualified person!

推荐答案

不要通过TCP/网络访问独角兽.

Don't access the Unicorns over TCP/network.

您的设置似乎很好,您只需在APP服务器前面添加一个负载均衡器,但我建议 Keepalived (LVS ftw)作为负载平衡器,而不是Nginx.

Your setup seems just fine, you can simply add a load-balancer in front of the APP servers, but I would suggest Keepalived (LVS ftw) as load-balancer instead of Nginx.

您可以让它们平衡通过套接字运行Nginx + Unicorns的APP服务器的连接.

You can have them balance connections to the APP servers running Nginx+Unicorns over sockets.

这篇关于独角兽多机设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆