2015年12月11日 星期五

RHEL 的 OpenStack (十二)--管理 Heat Orchestration 服務

Heat Orchestration 服務

Heat Orchestration 服務是為了 OpenStack 雲,提供一種基於樣板的編制工程方式,用於建立、管理雲端架構資源!
Hear Orchestration 服務,由下列幾項元件組成:
  • heat-cfn
  • heat-api
  • heat-api-cfn
  • heat-engine
  • heat-api-cloudwatch
  • heat-cfntools 以及 cloud-init 套件
練習1:
  1. # source /root/keystonerc_admin
  2. # yum list openstack-heat* python-heatclient heat-cfntools
  3. # grep 10.1.1.1 /etc/heat/heat.conf
  4. # keystone user-get heat
  5. # keystone service-get heat
  6. # keystone catalog --service orchestration
  7. # keystone user-get heat-cfn
  8. # keystone service-get heat-cfn
  9. # keystone catalog --service cloudformation
  10. # keystone user-role-list --user heat --tenant services
  11. # openstack-service status heat

設定Heat Orchestration 服務

設定檔包含項目:
  • 建立預設的 Nova 浮動IP池,Heat 將會從這個池分配浮動IP
  • 指定預設的浮動IP池
  • 設定 DNS 轉址
  • 建立各式 Nova 樣板,管理員可以用於 Heat 樣板中
  • 建立 Heat 可用的 Keystone 使用者
練習2:
  1. # source /root/keystonerc_admin
  2. # nova floating-ip-pool-list
  3. # crudini --get /etc/nova/nova.conf DEFAULT default_floating_pool
  4. # crudini --set /etc/nova/nova.conf DEFAULT default_floating_pool public
  5. # openstack-service restart nova
  6. # crudini --set /etc/neutron/dhcp_agent.ini DEFAULT dnsmasq_dns_servers 10.1.1.254
  7. # openstack-service restart neutron --> 另一部主機也需要做
  8. # nova flavor-create web.tiny auto 1024 20 1
  9. # keystone tenant-create --name heatproject
  10. # keystone user-create --name heatuser --pass redhat
  11. # keystone user-role-add --user heatuser --role _member_ --tenant heatproject
  12. # keystone user-role-add --user heatuser --tenant heatproject --role heat_stack_owner
  13. # vim /root/keystonerc_heatuser
  14. # source /root/keystonerc_heatuser
  15. # glance image-list
  16. # neutron net-list
  17. # neutron net-create net1
  18. # neutron subnet-create --name subnet1 net1 192.168.0.0/24
  19. # neutron router-create router1
  20. # neutron router-gateway-set router1 public
  21. # neutron router-interface-add router1
  22. # nova keypair-add --pub-key /root/.ssh/id_rsa.pub heatkey
  23. # nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
  24. # nova secgroup-add-rule default tcp 80 80 0.0.0.0/0
  25. # nova secgroup-add-rule default tcp 443 443 0.0.0.0/0
  26. # nova secgroup-add-rule default tcp 3306 3306 0.0.0.0/0
  27. # nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0

啟動與驗證 Stack

太複雜,先跳過...
練習3:
  1. 先編好一個檔案:multi.template
  2. # source /root/keystonerc_heatuser
  3. # neutron subnet-list
  4. # neutron net-list
  5. # vim /root/env.yaml
    parameters:
    key_name: heatkey
    public_net_id: <上一項指令的ID>
    private_net_id: <上一項指令的ID>
    private_subnet_id: <上兩項指令的ID>
  6. # heat stack-create -r -f multi.tempate -e /root/env.yaml multi
  7. # heat stack-list
  8. 在一部主機上 # virsh list
  9. # heat stack-show multi
  10. # heat event-list multi
  11. # nova list
  12. # ssh root@10.1.1.10
  13. # ssh ec2-user@10.1.1.10
  14. $ su - 
  15. # systemctl status httpd.service
  16. # exit
  17. $ exit
  18. # ssh ec2-user@10.1.1.11
  19. $ sudo systemctl status mariadb.service
  20. $ exit
  21. 移除 Stack
    • # heat stack-delete multi
除錯
練習4: