How do I update multiple EC2 instances that are lo

2019-04-08 00:49发布

问题:

So, I have been playing around with Amazon Cloud (AWS) and I am trying to figure out how to get files on to all server's if they are load balanced.

At first I thought I could tie 3 different instances to a load-balancer and then have each instance utilize the same volume. That way all I would have to do is update the one volume with the recent build of the site and each instance would then access that. However, I have read that you can't share volumes across instances.

So what is the solution? Would I have to have the three instances all with the same data, and a forth that I could update? Then the forth would replicate the data across the other three.

Just trying to figure out how to update update the production files, and have all servers that are handling the load to pull in the most recent code base.

回答1:

Yes all servers need to have identical content. You could do this by creating an NFS share or similar, and mounting it at the same point on each server. But apparently a decent workaround is to create snapshots of an EBS volume and then mount them on each instance. See http://linuxforlovers.wordpress.com/2009/04/11/sharing-amazon-elastic-block-store-among-multiple-instances/ for more details. Every time you want to commit your changes, you commit to the EBS volume only.