简体   繁体   English

在Amazon EC2上自动缩放

[英]Auto scaling on amazon ec2

I have deployed my application on amazon ec2. 我已在Amazon EC2上部署了我的应用程序。 I have installed tomcat and mysql on ec2 instance. 我已经在ec2实例上安装了tomcat和mysql。 What will happen if auto scale creates new instance? 如果自动缩放创建新实例会怎样? will it copy tomcat and mysql on new instance? 它将在新实例上复制tomcat和mysql吗? Appreciate the answer provided. 感谢提供的答案。

Thanks Inderjeet 感谢Inderjeet

No it won't automatically copy any of that. 不,它不会自动复制任何内容。 You need to move your database outside the autoscaling group, probably into RDS. 您需要将数据库移至自动扩展组之外,可能移至RDS。 And you need to configure startup scripts that will install your application on a new instance, or create a custom AMI for the autoscaling group to use. 而且,您需要配置启动脚本,这些脚本将在新实例上安装您的应用程序,或者创建供自动缩放组使用的自定义AMI。

You can install and setup tomcat in ec2.and then create an ami. 您可以在ec2中安装和设置tomcat,然后创建一个ami。 Then attach that ami to auto scalling configuration. 然后将该ami附加到自动缩放配置。 Also you need to write a statup script that will get updated code on tomcat. 另外,您需要编写一个statup脚本,该脚本将在tomcat上获取更新的代码。 And use rds for mysql. 并将rds用于mysql。

Auto Scaling requires you to define a Launch Configuration . Auto Scaling要求您定义启动配置

The Launch Configuration tells Auto Scaling how to launch new instances . 启动配置告诉Auto Scaling 如何启动新实例 It includes: 这包括:

  • AMI 急性心肌梗死
  • User Data script (that is run after it boots) 用户数据脚本(在启动后运行)
  • Instance Type 实例类型
  • Network settings 网络设置

Therefore, if you want software to be installed on an instance that is created by Auto Scaling, you can do it via two methods: 因此,如果要在通过Auto Scaling创建的实例上安装软件,则可以通过两种方法进行操作:

  • Create an AMI with all software pre-loaded, or 创建一个预先加载了所有软件的AMI ,或者
  • Provide a User Data script that will install the software 提供将安装软件的用户数据脚本
  • ...or a bit of both! ...或两者兼而有之!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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