월간 인기 게시물

게시물 718건
   
로드밸랜스 생성 + 오토스케일링 - heat
글쓴이 : 최고관리자 날짜 : 2016-07-01 (금) 13:09 조회 : 820
                                

heat_template_version: 2015-10-15
description: add lbaas resource 
parameters:

  app_port:
    type: number
    default: 80
    description: Port used by the servers

  lb_port:
    type: number
    default: 80
    description: Port used by the load balancer

  image:
    type: string
    default: ubuntu
    description: Image used for servers
    constraints:
    - custom_constraint: glance.image

  flavor:
    type: string
    default: smile
    description: Flavor used for servers
    constraints:
    - custom_constraint: nova.flavor

  public_network:
    type: string
    default: c6bc83b9-1bde-4a8b-bfe5-090f98f89118
    description: Network used by the load balancer
    constraints:
    - custom_constraint: neutron.network

  networks:
    type: string
    default: 6bcf7324-99d9-4940-8c65-4a5312e8e864
    description: Network used by the servers
    constraints:
    - custom_constraint: neutron.network

  subnet:
    type: string
    default: 6041f625-224d-4111-8305-65730e6172a4
    description: Subnet on which the load balancer will be located
    constraints:
    - custom_constraint: neutron.subnet


resources:
  asg:
    type: OS::Heat::AutoScalingGroup
    properties:
      min_size: 1
      max_size: 5
      resource:
#        type: file:///root/hot/lbaasv2/lb_server.yaml
        type: lb_server.yaml
        properties:
          flavor: {get_param: flavor}
          image: {get_param: image}
          metadata: {"metering.stack": {get_param: "OS::stack_id"}}
          networks: {get_param: networks}
          subnet: {get_param: subnet}
          pool: {get_resource: pool}
          app_port: {get_param: app_port}

  scaleup:
    type: OS::Heat::ScalingPolicy
    properties:
      adjustment_type: change_in_capacity
      auto_scaling_group_id: {get_resource: asg}
      cooldown: 60
      scaling_adjustment: 1

  scaledown:
    type: OS::Heat::ScalingPolicy
    properties:
      adjustment_type: change_in_capacity
      auto_scaling_group_id: {get_resource: asg}
      cooldown: 60
      scaling_adjustment: -1

  cpu_alarm_high:
    type: OS::Ceilometer::Alarm
    properties:
      description: Scale-up if the average CPU > 50% for 1 minute
      meter_name: cpu_util
      statistic: avg
      period: 60
      evaluation_periods: 1
      threshold: 50
      alarm_actions:
        - {get_attr: [scaleup, alarm_url]}
      matching_metadata: {'metadata.user_metadata.stack': {get_param: "OS::stack_id"}}
      comparison_operator: gt

  cpu_alarm_low:
    type: OS::Ceilometer::Alarm
    properties:
      description: Scale-down if the average CPU < 15% for 10 minutes
      meter_name: cpu_util
      statistic: avg
      period: 60
      evaluation_periods: 1
      threshold: 15
      alarm_actions:
        - {get_attr: [scaledown, alarm_url]}
      matching_metadata: {'metadata.user_metadata.stack': {get_param: "OS::stack_id"}}
      comparison_operator: lt

  monitor:
    type: OS::Neutron::LBaaS::HealthMonitor
    properties:
      delay: 3
      type: HTTP
      timeout: 3
      max_retries: 3
      pool: { get_resource: pool }

  pool:
    type: OS::Neutron::LBaaS::Pool
    properties:
      lb_algorithm: ROUND_ROBIN
      protocol: HTTP
      listener: { get_resource: listener }

  listener:
    type: OS::Neutron::LBaaS::Listener
    properties:
      loadbalancer: { get_resource: loadbalancer }
      protocol: HTTP
      protocol_port: { get_param: lb_port }

  loadbalancer:
    type: OS::Neutron::LBaaS::LoadBalancer
    properties:
      vip_subnet: { get_param: subnet }

  floating_ip:
    type: OS::Neutron::FloatingIP
    properties:
      floating_network: { get_param: public_network }
      port_id: { get_attr: [loadbalancer, vip_port_id ]}


outputs:

  scale_up_url:
    description: >
      This URL is the webhook to scale up the autoscaling group.  You
      can invoke the scale-up operation by doing an HTTP POST to this
      URL; no body nor extra headers are needed.
    value: {get_attr: [scaleup, alarm_url]}

  scale_dn_url:
    description: >
      This URL is the webhook to scale down the autoscaling group.
      You can invoke the scale-down operation by doing an HTTP POST to
      this URL; no body nor extra headers are needed.
    value: {get_attr: [scaledown, alarm_url]}

  server_list:
    description: >
      List of server names that are part of the group.
    value: {get_attr: [asg, outputs_list, name]}

  lburl:
    description: URL of the loadbalancer
    value:
      str_replace:
        template: http://IP_ADDRESS:PORT
        params:
          IP_ADDRESS: { get_attr: [ floating_ip, floating_ip_address ] }
          PORT: { get_param: lb_port }
    description: >
      This URL is the "external" URL that can be used to access the
      load balancer.


# lb_server.yaml


heat_template_version: 2013-05-23

description: A Group of Load Balanced Servers

parameters:
  app_port:
    type: number
    description: Port used by the servers

  image:
    type: string
    description: Image used for servers
    constraints:
    - custom_constraint: glance.image

  flavor:
    type: string
    description: Flavor used for servers
    constraints:
    - custom_constraint: nova.flavor

  pool:
    type: string
    description: Pool to contact

  metadata:
    type: json

  networks:
    type: string
    description: Network used by the server

  subnet:
    type: string
    description: Subnet on which the load balancer will be located
    constraints:
    - custom_constraint: neutron.subnet


resources:
  server:
    type: OS::Nova::Server
    properties:
      flavor: {get_param: flavor}
      image: {get_param: image}
      metadata: {get_param: metadata}
      networks: [{network: {get_param: networks} }]

  pool_member:
    type: OS::Neutron::LBaaS::PoolMember
    properties:
      pool: { get_param: pool }
      address: { get_attr: [ server, first_address ]}
      protocol_port: { get_param: app_port }
      subnet: { get_param: subnet }


outputs:
  server_ip:
    description: IP Address of the load-balanced server.
    value: { get_attr: [server, first_address] }

  lb_member:
    description: LB member details.
    value: { get_attr: [pool_member, show] }
 - 스택이 생성되고 서버 증감소 안되는 경우가 간혹 있다.


이름 패스워드
스타일
굴림
10pt
<html> <body>
 
 
 
 
비밀글 (체크하면 글쓴이만 내용을 확인할 수 있습니다.)
왼쪽의 글자를 입력하세요.
   

 



 
사이트명 : 모지리네 | 대표 : 이경현 | 개인커뮤니티 : 랭키닷컴 운영체제(OS) | 경기도 성남시 분당구 | 전자우편 : mojily골뱅이chonnom.com Copyright ⓒ www.chonnom.com www.kyunghyun.net www.mojily.net. All rights reserved.