gpt4 book ai didi

linux - Amazon EC2 上未发生自动缩放

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:59:37 25 4
gpt4 key购买 nike

我正在尝试使用以下命令在 Amazon EC2 上执行自动缩放:

elb-create-lb nalb1 --headers --listener "lb-port=80,instance-port=80,protocol=http" --availability-zones us-east-1c  

elb-register-instances-with-lb nalb1 --headers --instances i-1ecef57c

elb-configure-healthcheck nalb1 --headers --target "HTTP:80/" --interval 30 --timeout 3 --unhealthy-threshold 2 --healthy-threshold 10

as-create-launch-config nalc1 --image-id ami-cdd306a4 --instance-type t1.micro

as-create-auto-scaling-group naasg1 --launch-configuration nalc1 --availability-zones us-east-1c --min-size 0 --max-size 10 --load-balancers nalb1
as-put-scaling-policy --auto-scaling-group naasg1 --name policy-scaleup --adjustment 100 --type PercentChangeInCapacity
as-put-scaling-policy --auto-scaling-group naasg1 --name policy-scaledown --adjustment=-1 --type ChangeInCapacity

as-create-or-update-trigger nat1 \
--auto-scaling-group naasg1 --namespace "AWS/EC2" \
--measure CPUUtilization --statistic Average \
--dimensions "AutoScalingGroupName=naasg1" \
--period 60 --lower-threshold 30 --upper-threshold 60 \
--lower-breach-increment=-1 --upper-breach-increment=1 \
--breach-duration 120

以下命令描述了执行上述命令后各种参数的状态。

root@domU-12-31-39-09-B8-12 ~# elb-describe-lbs  
LOAD_BALANCER nalb1 nalb1-1717211844.us-east-1.elb.amazonaws.com 2012-01-24T09:45:11.440Z
root@domU-12-31-39-09-B8-12 ~# as-describe-launch-configs
LAUNCH-CONFIG nalc1 ami-cdd306a4 t1.micro
root@domU-12-31-39-09-B8-12 ~# as-describe-auto-scaling-groups
AUTO-SCALING-GROUP naasg1 nalc1 us-east-1c nalb1 0 10 0
root@domU-12-31-39-09-B8-12 ~# as-describe-policies
No policies found
root@domU-12-31-39-09-B8-12 ~# as-describe-triggers --auto-scaling-group naasg1
DEPRECATED: This command is deprecated and included only to facilitate migration to the new trigger mechanism. You should use this command for migration purposes only.
TRIGGER nat1 naasg1 NoData AWS/EC2 CPUUtilization Average 60
root@domU-12-31-39-09-B8-12 ~#

尽管如此,自动缩放并没有发生
可能是什么原因?

感谢帮助

最佳答案

下面的命令有效:)

elb-create-lb nalb1 --headers --listener "lb-port=80,instance-port=80,protocol=http" --availability-zones us-east-1c

elb-register-instances-with-lb nalb1 --headers --instances i-1ecef57c

elb-configure-healthcheck nalb1 --headers --target "HTTP:80/" --interval 30 --timeout 3 --unhealthy-threshold 2 --healthy-threshold 10

as-create-launch-config nalc1 --image-id ami-cdd306a4 --instance-type t1.micro

as-create-auto-scaling-group naasg1 --launch-configuration nalc1 --availability-zones us-east-1c --min-size 2 --max-size 10 --load-balancers nalb1
as-put-scaling-policy --auto-scaling-group naasg1 --name policy-scaleup --adjustment=2 --type ChangeInCapacity
as-put-scaling-policy --auto-scaling-group naasg1 --name policy-scaledown --adjustment=-1 --type ChangeInCapacity
as-set-desired-capacity naasg1 -c 2

当然,您需要在 CloudWatch 上创建警报并将这些策略关联到两个警报,每个警报都处理升压和降压。

关于linux - Amazon EC2 上未发生自动缩放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9000673/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com