In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
First, background needs
When you don't know which type of EC2 instance you should choose, and when the business will peak, we can easily solve our problem by using Auto Scaling, which automatically expands and downsizes according to the load pressure we set to ensure the normal operation of the business with minimum cost.
Second, configure step 2.1.Create AMI
First, make an image of the host of the EC2 we are running, and set the internal service to self-startup to ensure that all services are available when the capacity is expanded.
2.2. Create a load balancer target group
Auto Scaling is used with ELB to dynamically distribute the load to the back-end machines, and we need a target group to store our Auto Scaling cluster machines.
2.3.Create Classic Load Balancer
2.4. Create a startup configuration
In order for instances to start stably, you can choose on-demand instances or Spot instances that are higher than the market price, and try to have as many as possible to ensure the success rate.
2.5.Create Auto Scaling group
I chose a bidding instance here and failed to start it several times, so I changed the startup configuration of an on-demand instance.
2.6. Testing
We log in to the first machine in the group and use the following command to pressurize CPU to see if a new instance is automatically started when the threshold is exceeded.
For i in `seq 1 $(cat / proc/cpuinfo | grep "processor" | wc-l) `; do dd if=/dev/zero of=/dev/null; done &
As you can see, the load of CPU has gone up:
Let's take a look at the event and find that a new instance has been launched:
Then we stop the stress test and wait for a while to check:
So far we have finished this test.
Fun play
We can install the web service, load the ELB to the new instance, and configure the specific content for each instance. We select the metadata of the instance. During startup, we can enter the following startup parameters:
#! / bin/bashyum install nginx-ysystemctl start nginxcurl http://169.254.169.254/latest/meta-data/public-ipv4 > / var/www/html/index.html
Http://169.254.169.254/latest/meta-data/ is the metadata information interface of the instance.
Http://docs.amazonaws.cn/AWSEC2/latest/UserGuide/ec2-instance-metadata.html
Welcome to scan the code and follow us for more information.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.