开发者

Load balancing web servers + keeping content synced

I'm considering implementing EC2's Elastic Load Balancing features, but I'm running 开发者_如何学Ca web application (on the LAMP stack) that has frequent changes and wondering what the most common strategy is for keeping the application in sync between the servers that are load balanced. The database would live elsewhere, so I'm only worried (at this point) about keeping the actual scripts in sync when I make changes.


It depends how frequently you're going to update the scripts:

  • The most common solution is to store your shared components in an EBS volume, create a snapshot and then mount that from the instances - either as the root device (allowing you to keep the entire code state in sync across all instances) or as a secondary volume (containing just your code, allowing you to use AMIs built by other users, like Canonical)
  • With frequent updates a simple solution like rsync is likely the winner, alternatively you could keep them on S3 and use the S3 fuse module to mount the scripts directly from S3 (with this solution you may end up spending slightly more on the number of S3 GET requests depending on how S3 fuse caches).


The one way of addressing this problem is using a continuous integration which can transfer your files with rsync and build the project on the servers, this is not just yet.

There are quite a bunch of plugins available (PHPUnit, Code Coverage, Code Analysis, etc):

Jenkins

How:

  1. Install Jenkins
  2. Configure your project (probably you code should be in some code-version-system) with Jenkins
    1. Configure the servers, project-path, pre-job, post-job, etc.
  3. Schedule the work/job.
  4. That's it, done.

Reference:

  1. Configuration:
    1. configuring - ex.1
    2. Initial configuration
      1. Configuring the jobs
  2. http://agile.dzone.com/news/continuous-integration-php


You can run Chef/Puppet on AWS Infra. Have this integrated to Git/SVN. New changes will be automatically picked up by Chef from SVN and moved into your Amazon EC2 web servers periodically.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜