简体   繁体   中英

Understanding how amazon Autoscale will Autoscale

I've been setting a prestashop server architecture on amazon aws since 3 days and now everything is up and running. I have an ELB, RDS and an auto-scaling group set up with alarm (add one instance if cpu > 80% ). I have only ONE instance that runs my prestashop website, attached to an extra EBS volume where I uploaded the website.

Now what I don't understand is how auto-scaling will act if the CPU is greater that 80%? Will it create automatically a new instance that is the exact copy of the running instance? If yes then will it copy also the attached EBS volume? Because I add product everyday, so if a new instance is created it HAVE to be the exact same as the original one otherwise customers won't find the new products they came for.

To use autoscaling your instances have to be stateless. When AS group is scaling out, it winds up an instance from an AMI you have set in AS launch configuration.

It will be the exact copy if this image, not of an instance that is already running.

State (products, sessions, whatnot) should be stored elsewhere, in some DB for example (you have mentioned RDS).

Your current setup will not work, since each container running in the cluster needs to share certain directories amongst each other. This is because PrestaShop v1.7 at the time of writing stores certain stateful information in the file system.

I feel the accepted answer is incorrect. Rather, "To use autoscaling it is best that your instances are stateless" - but it's not a hard requirement. To this point, I've successfully run PrestaShop in an autoscaling ECS cluster by storing certain shared directories on EFS, and then mounting those directories from each container running in the cluster. The directories that need to be shared are:

  • Img
  • Modules
  • Override
  • Cache
  • Theme
  • Config

More information along with code can be found here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM