我已使用这些步骤设置自动缩放...
$ elb-create-lb autoscalelb --headers --listener “lb-port = 80,instance-port = 80,protocol = http”--listener “lb-port = 443,instance-port = 443,protocol = tcp”--availability-zones 我们 - 东 - 1D
$ elb-describe-lbs autoscalelb
$ elb-register-instances-with-lb autoscalelb --instances i-ee364697
$ elb-configure-healthcheck autoscalelb --headers --target“TCP:80” --interval 5 --timeout 3 --unhealthy-threshold 2 --healthy-threshold 4
$ as-create-launch-config autoscalelc --image-id ami-baba68d3 --instance-type t1.micro
$ as-create-auto-scaling-group autoscleasg --availability-zones us-east-1d --launch-configuration autoscalelc --min-size 1 --max-size 5 - 所需容量1 - 负载平衡器autoscalelb
$ as-describe-auto-scaling-groups autoscleasg
$ as-put-scaling-policy MyScaleUpPolicy --auto-scaling-group autoscleasg --adjustment = 1 --type ChangeInCapacity --cooldown 300
$ mon-put-metric-alarm MyHighCPUAlarm --comparison-operator GreaterThanThreshold --evaluation-periods 1 --metric-name CPUUtilization --namespace“AWS / EC2”--period 600 --statistic Average --threshold 80 --alarm-actions arn:aws:autoscaling:us-east-1:616259365041:scalingPolicy:46c2d3b3-7f29-42b6-ab64-548f45de334f:autoScalingGroupName / autoscleasg:policyName / MyScaleUpPolicy --dimensions“AutoScalingGroupName = autoscleasg”
$ as-put-scaling-policy MyScaleDownPolicy --auto-scaling-group autoscleasg --adjustment = -1 --type ChangeInCapacity --cooldown 300
$ mon-put-metric-alarm MyLowCPUAlarm --comparison-operator LessThanThreshold --evaluation-periods 1 --metric-name CPUUtilization --namespace“AWS / EC2”--period 600 --statistic Average --threshold 50 --alarm-actions arn:aws:autoscaling:us-east-1:616259365041:scalingPolicy:30ccd42c-06fe-401a-8b8f-a4e49bbb9c7d :autoScalingGroupName / autoscleasg:policyName / MyScaleDownPolicy --dimensions“AutoScalingGroupName = autoscleasg”
在此之后我正在运行此命令:
$ as-describe-auto-scaling-groups autoscleasg --headers
响应:
自动缩放 - 群组 - 名称发射 - 配置可用区域 负载平衡器最小尺寸最大尺寸所需容量 AUTO-SCALING-GROUP autoscleasg autoscalelc us-east-1d
autoscalelb 1 5 1 INSTANCE INSTANCE-ID 可用性区域状态发布 - 配置实例 i-acf48bd5 us-east-1d InService Healthy autoscalelc
然后:
$ elb-describe-instance-health autoscalelb --headers
它显示:
INSTANCE_ID INSTANCE_ID状态说明
原因代码INSTANCE_ID i-ee364697 InService N / A
N / A INSTANCE_ID i-acf48bd5 OutOfService实例失败了 至少连续健康状况检查的UnhealthyThreshold数。 实例
我的第一个问题是:
当Main实例上没有加载时,它会自动创建一个额外的实例。
其次, 新创建的实例始终是OutOfService。
如果我使用以下命令将Min Size更改为0:
$ as-update-auto-scaling-group autoscleasg --launch-configuration autoscalelc --availability-zones us-east-1d --min-size 0 --max-size 5
尝试使用xen将负载放在实例上:
自动缩放不创建任何实例。即使我在最多5个会话上运行命令,CPU利用率达到100%仍然没有创建实例。
请帮帮我......
答案 0 :(得分:2)
我不确定您想要实现什么,但如果您想使用自动缩放功能根据流量增加或减少添加更多实例,则需要使用负载均衡器参数(即延迟):
将您的更改为:
--namespace = 'AWS / ELB'
--metric-name Latency
- 期间60(这是超级快)
--threshold 2.0(非常低)
为了测试它是否有效,我使用Apache Bench,我在多个微实例上运行命令
$ ab -n 10000 -c 10 http://<your ELB>.us-east-1.elb.amazonaws.com/index.php