开发者

Syncing between Amazon EBS Devices

I have 2 EC2 instances, each with their own EBS attached. Sitting infront of the EC2s is a load balancer.

These instances run CMS driven sites, where uses can upload files.

What would 开发者_开发技巧be the best solution to the problem of a file getting uploaded to one EBS and the load balancer sending a visitor to the EC2 instance whose EBS does not have the file? Some sort of cron which runs an rsync?

Suggestions very welcome!

Thanks

S


I believe the best solution would be to use single shared storage like Amazon S3. It's better to use some plugin for your CMS to store users' files on S3. But if there is no such plugin you can use Fuse s3fs adapter to mount the file system on both instances and configure your CMS to store those files in that specified directory.


there are several solutions to this problem from top of my head i think

  • nfs/samba shared dir between instances
  • svn deploy
  • cluster file systems - OCFS/GFS
  • cloud management such as capistrano and trriger a deploy when you need
  • and of course cron jobs when you can do ftp, scp, rsync, s3sync/copy etc


Or possibly, create one EC2 instance as NFS and share it's directories with your other instances.


There are multiple solutions to keep data in both EC2 in sync with or without using EBS volumes.

  1. Can use AWS EFS service instead of using EBS volumes. EFS volume can be shared between EC2 instances within a VPC, and both instances will have data in sync on the mountpath where EFS is mounted on instances.
  2. Another solution is using Gluster File Storage. This can also work between EBS volumes in different AWS region. Refer this link: http://sanketdangi.com/post/5601762671/gluster-config-aws-multi-az
  3. Can mount S3 bucket on your EC2 instances using S3 Fuse. Refer this link: https://github.com/s3fs-fuse/s3fs-fuse/wiki/Fuse-Over-Amazon
  4. May be you can also use "s3 sync" on both ebs volumes. This way both ebs will be in sync via S3. Refer this link: https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜