【问题标题】:Autoscaling: Newly created instance always OutOfService自动缩放:新创建的实例总是 OutOfService
【发布时间】:2012-06-20 15:08:45
【问题描述】:

我已经使用这些步骤设置了自动缩放...

$ elb-create-lb autoscalelb --headers --listener "lb-port=80,instance-port=80,protocol=http" --listener “lb-port=443,instance-port=443,protocol=tcp”--可用性区域 us-east-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 --desired-capacity 1 --load-balancers 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 GROUP-NAME LAUNCH-CONFIG AVAILABILITY-ZONES 负载平衡器 最小尺寸 最大尺寸 所需容量 AUTO-SCALING-GROUP autoscleasg autoscalelc us-east-1d
autoscalelb 1 5 1 实例实例 ID 可用性-区域状态状态启动-配置实例 i-acf48bd5 us-east-1d InService 健康 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 次数。 实例

我的第一个问题是:

当主实例没有负载时,它会自动创建一个额外的实例。

其次, 新创建的实例总是 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 加载实例:

hg克隆http://xenbits.xensource.com/xen-unstable.hg

自动缩放不创建任何实例。即使我在最多 5 个会话上运行上述命令,CPU 利用率达到 100%,但仍然没有创建实例。

请帮帮我...

【问题讨论】:

    标签: amazon-ec2 amazon load-balancing autoscaling


    【解决方案1】:

    我不确定您想要实现什么,但如果您想使用自动缩放功能根据流量增加或减少添加更多实例,您需要使用负载均衡器参数(即延迟):

    把你的改成:
    --namespace='AWS/ELB'
    --metric-name 延迟
    --period 60(这是超级快)
    --threshold 2.0(这个很低)

    为了测试它是否有效,我使用 Apache Bench,我在多个微实例上运行以下命令

    $ ab -n 10000 -c 10 http://<your ELB>.us-east-1.elb.amazonaws.com/index.php
    

    【讨论】:

      猜你喜欢
      • 2017-08-15
      • 2016-09-21
      • 1970-01-01
      • 2017-01-13
      • 2022-11-10
      • 2017-11-15
      • 2019-10-09
      • 1970-01-01
      相关资源
      最近更新 更多