如何正确设置 EC2 负载平衡以允许实时文件同步? [英] How do I get EC2 load balancing properly set up to allow for real time file syncing?

查看:37
本文介绍了如何正确设置 EC2 负载平衡以允许实时文件同步?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 EC2 的新手.我已经阅读了很多关于它的内容,观看了许多视频和教程,并且非常熟悉一切是如何工作的.我仍然有几个问题似乎无法找到直接答案.

I'm new to EC2. I have read a lot about it, watched many videos and tutorial and pretty much familiar with how everything work. I still have few question that I can't seem to find direct answers to.

如果我有 3 个负载均衡的实例 (linux),它们都服务于同一个站点,并且该站点是一个动态的 php/mysql 驱动,用户每秒发布文件论坛线程,数据库和文件如何同步到所有 3 个实例中即时的.

If I have 3 instances (linux) with load balancing all serving the same site and the site is a dynamic php/mysql driven where users post files forum threads every second, how is the database and files synced to all 3 instances in real time.

  1. 我是否需要在 RDS 上拥有每个实例都指向它的数据库.
  2. 用户文件怎么样.如果用户将文件上传到站点,那么该文件应该立即在所有实例上可用,这怎么可能.我不认为在 3 个实例上有 3 个副本是非常实用的.
  3. 如果我修改了站点,比如说更改 CSS 文件中的某些内容,我如何将更改同步到所有实例.
  4. EBS 或 S3 如何在这一切中发挥作用.

推荐答案

我是否需要在 RDS 上拥有每个实例都简单指向它的数据库.

Do I need to have the database on RDS where every instance simply points to it.

这是一种选择,或者您可以启动另一个实例以位于应用服务器后面,将 MySQL 放在上面并让它们都连接到该实例.需要注意的一件事是,请确保使用私有 IP 通过内部网络进行连接,并确保您的所有安全措施都非常严密.

That is one option, or you can boot up another instance to sit behind the app servers, put MySQL on it and have them all connect to that instance. One thing to note, make sure to connect over the internal network using the private ip and make sure all your security is tight.

用户文件怎么样.如果用户将文件上传到站点,则该文件应立即在所有实例上可用马上,这怎么可能.我不认为在 3 上有 3 个副本实例非常实用.

How about user files. If a user uploaded a file to the site, then this file should be available immediately on all instances immediately, how is this possible. I don't think having 3 copies on 3 instances is very practical.

不,那不实用.您可以将其上传到他们都有权访问的后端数据库实例,但实际上您应该将其上传到所有实例都可以与 s3tools 或其他东西一起使用的存储桶中的 S3.

No that is not practical. You could upload it to that backend db instance that they all have access to, but really you should probably upload it to S3 in a bucket that all your instances can use with s3tools or something.

如果我修改了站点,比如说更改 CSS 文件中的某些内容,我如何将更改同步到所有实例.

If i modify the site, let's say change the something in the CSS file, how do i sync the changes to all instances.

吉特.(或 svn)但是您可以将 cloudfront 用于您的 JS 和 CSS 文件......不是一个坏主意.并使用 S3 存储桶作为源...

Git. (or svn) But you could use cloudfront for your JS and CSS files.... not a bad idea. And use a S3 bucket as your source...

EBS 或 S3 如何在这一切中发挥作用.

How do EBS or S3 play a role in all of this.

您的数据库应始终位于 ebs 卷上,以免丢失.S3 可用于在整个环境中廉价且轻松地共享和存储文件.

Your database should always be on ebs volumes so you dont lose it. S3 can be used to share and store files cheaply and easily across your entire environment.

这篇关于如何正确设置 EC2 负载平衡以允许实时文件同步?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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