亚马逊EC2:负载均衡/方法来同步文件/ EC2 + CF [英] Amazon EC2: load balancing / way to sync files / EC2 + CF

查看:316
本文介绍了亚马逊EC2:负载均衡/方法来同步文件/ EC2 + CF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我了解,我可以使用EC2作为Web服务器我的应用程序。但是,如何负载均衡器的工作?

  1. 例如我有一个EC2实例。这样,负载平衡器将无法正常工作。我说得对?

  2. 例如我有几个EC2实例。这样,我可以配置负载平衡器我所有的EC2服务器之间的平衡。 我说得对?

  3. 在所有的情况下,申请文件应同步?是否有任何亚马逊工具同步?或者我应该使用类似的rsync或交的承诺挂钩EC2实例之间同步文件?

  4. 是否有可能使用的Web应用程序(PHP + nginx的)一个EC2实例和CDN(云锋)?或者有什么更好的方式来达到这一点:我需要存储静态文件,但我应该从Web应用程序(PHP脚本)通过文件系统访问它们。因此,我将使用EC2和土块接待。但是,我怎么能访问?

感谢您的时间。

解决方案
  1. 从技术上讲,负载belancer会的工作,它只是它只会平衡流量到一个实例。
  2. 修正。您注册与弹性负载均衡器的实例,而这些实例是健康的 - 它会回应他们
  3. 有许多不同的方式来同步文件 - 这一切都取决于你想要同步的内容。云架构是一个有点不同,以传统的建筑风格。例如,而不是装载图像到EBS卷,你会尝试卸载它们(和为他们服务)的S3。因此,你需要同步的唯一的东西是Web服务器文件本身。你可以使用CloudFormation来推出更新后提交挂钩和rsync也是不错的选择。我们面临的挑战是要记住,它可以扩展/几乎不能随意 - 所以你需要确保每个实例都知道如何获得信息,并保持自身孤立更新
  4. 是。这就是所谓的一个习俗起源 。你想要做什么,虽然是把那个重写本地URL到CloudFront的域的出站服务器的URL重写。

希望帮助

As I understand I can use EC2 as web server for my application. But how load balancer is working?

  1. For example I have one EC2 instance. In this way load balancer will not work. Am I right?

  2. For example I have few EC2 instances. In this way I can configure load balancer to balance between all my EC2 servers. Am I right?

  3. Application files at all instances should be synced? Is there is any Amazon tool to sync? Or I should use something like rsync or post commit hooks to sync files between EC2 instances?

  4. Is it possible to use one EC2 instance for web application (php + nginx) and for CDN (Cloud Front)? Or what is the better way to reach this: I need to store static files but I should access them from web application (php scripts) through file system. So I am going to use EC2 and Clod Front. But how can I get access?

Thanks for your time.

解决方案

  1. Technically, the load belancer will work, it's just that it'll only balance the traffic to one instance.
  2. Correct. You register the instances with the elastic load balancer, and whilst those instances are healthy - it will respond to them.
  3. There's many different ways to sync files - it all depends on what you want to sync. Cloud Architecture is a little different to traditional architecture. For example, rather than loading the images onto the EBS volume, you'd try and offload them (and serve them) from S3. Therefore the only things you'd need to "sync" would be the webserver files themselves. You could use CloudFormation to roll out updates, post commit hooks and rsync are also good options. The challenge is to remember that it can scale / fail almost at will - so you need to ensure that each instance knows how to get the information and keep itself updated in isolation.
  4. Yes. It's called a custom origin. What you want to do though is put a url rewrite on the outbound server that rewrites the local urls to cloudfront domains.

Hope that helps

这篇关于亚马逊EC2:负载均衡/方法来同步文件/ EC2 + CF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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