Openstack Heat try-out

  • What’s Heat ?

How to install Heat and make it ready to use?

  • 1.Installation
  • 2.Prepare JEOS(Just enough OS)

Use cases

  • 1.Deploy a single WordPress blog server with a floating IP associated.
  • 2.Deploy wordpress blog server with 2 VM instances(front-end + back-end topology)
  • 3.Deploy a wordpress blog server with EBS volume as mysql DB storage
  • 4.Deploy a wordpress blog server with HA protection enabled

What’s Heat ?

Heat is a service to orchestrate multiple composite cloud applications using the AWS CloudFormation template format, it’s Openstack’s implementation of CloudFormation and CloudWatch.

Heat integrates other core components of OpenStack into a one-file template system. The templates allow creation of most OpenStack resource types, the main functions of Heat cover:

-vAPP stack creation/update/deletion (suspend/resume will be added in Havana)
-High Availability
-Autoscaling
-Manual scale in/out(in Havana)

How to install Heat and make it ready to use?

1.Installation

->Heat has been included in RDO repo, installation can be done by Yum:

yum install openstack-heat-api openstack-heat-api-cfn openstack-heat-api-cloudwatch openstack-heat-cli openstack-heat-common openstack-heat-engine python-heatclient python-heatclient-doc heat-cfntools heat-jeos

->Comment out following line since we use RabbitMQ instead of QPID as message queue. Do this for heat-api-cfn.conf, heat-api-cloudwatch.conf, heat-api.conf, heat-engine.conf under /etc/heat.

#rpc_backend=heat.openstack.common.rpc.impl_qpid

->Configure [filter:authtoken] section of heat-api-cfn-paste.ini  heat-api-cloudwatch-paste.ini  heat-api-paste.ini under /etc/heat

[filter:authtoken]
paste.filter_factory = heat.common.auth_token:filter_factory
service_protocol = http
service_host = api-vip
service_port = 5000
auth_host = api-vip
auth_port = 35357
auth_protocol = http
auth_uri = http://api-vip:35357/v2.0admin_tenant_name = service
admin_user = heat
admin_password = password

->Configure [filter:ec2authtoken] section of  heat-api-cfn-paste.ini  heat-api-cloudwatch-paste.ini under /etc/heat

[filter:ec2authtoken]
paste.filter_factory = heat.api.aws.ec2token:EC2Token_filter_factory
auth_uri = http://api-vip:5000/v2.0
keystone_ec2_uri = http://api-vip:5000/v2.0/ec2tokens

>Update /etc/heat/heat-engine.conf as below:

heat_metadata_server_url = http://10.68.125.11:8000
heat_waitcondition_server_url = http://10.68.125.11:8000/v1/waitcondition
heat_watch_server_url = http://10.68.125.11:8003
sql_connection = mysql://heat:heat@db-vip/heat

#The IP for metadata, watchcondition and watch_server should be the host IP of heat services are running on, and should be reachable from VM instance.

->Setup database for heat:

heat-db-setup rpm -y -r <root password of mysql>

->Setup keystone entries for heat:

heat-keystone-setup

->Start heat services:

service openstack-heat-api start
service openstack-heat-api-cfn start
service openstack-heat-api-cloudwatch start
service openstack-heat-engine start

2.Prepare JEOS(Just enough OS)

JEOS image is basic OS image with cloud-init  and heat-cfn-tools pre-installed, they are the keys for Heat and VM exchanging information and doing post and regular jobs.

Pre-built JEOS of Fedora 17 and 18 can be downloaded from: http://fedorapeople.org/groups/heat/prebuilt-jeos-images/

To make our own JEOS on RHEL, following the steps:

a.Assume we have a RHEL 6.3 image registered in Glance already, launch a VM instance from it.
b.Log into the VM, install cloud-init and heat-cfn-tools

yum -y update
export http_proxy=<http proxy server IP>   #This is needed if lab has no direct internet access
curl -O http://ftp.ps.pl/pub/Linux/fedora-epel/6/i386/epel-release-6-7.noarch.rpm
rpm -Uvh epel-release-6-7.noarch.rpm
yum -y install perl python python-setuptools cloud-init python-pip
pip-python install argparse ‘boto==2.5.2′ heat-cfntools
cfn-create-aws-symlinks –source /usr/bin
rm -rf /etc/udev/rules.d/70-persistent-net.rules

c.From Horizon GUI or CLI, make a snapshot for this VM, name it as “rhel63-x86_64-cfntools”.  This snapshot actually becomes a valid JEOS image.

Use cases

1.Deploy a single WordPress blog server with a floating IP associated.

This templates deploy a single VM instance with a associated floating IP, then install mysql-server, httpd and wordpress packages, initial database, integrate each other and finally start up wordpress web service.

->Download the template file:

wget https://github.com/abckey/heat-templates/raw/master/WordPress_Single_Instance_With_EIP.template

->Source a tenant credential

source /root/nceprc

>Create a key-pair

nova  keypair-add ncepkey > ncepkey.pem

chmod 400 ncepkey.pem

->Deploy this template by heat

heat stack-create wordpress  -f WordPress_Single_Instance_With_EIP.template -P “InstanceType=m1.medium;DBUsername=wordpress;DBPassword=worldpress;KeyName=ncepkey;LinuxDistribution=RHEL-6.3″

#Parameters followed after “-P” are needed for instance type selection, DB access setup, key-pair selection and image selection.

->Check stack creation process

Once the stack-create is issued, we should see the stack in “CREATE_IN_PROGRESS” status from output of “heat list”

Once creation is complete, we can see the status will change to “CREATE_COMPLETE”.

[root@controller-1 heat(keystone_ncep)]# heat list
+————————————–+————–+—————–+———————-+
| ID | Name | Status | Created |
+————————————–+————–+—————–+———————-+
| a6740599-2c98-41b8-a55e-490f28f6f6f8 | wordpress | CREATE_COMPLETE | 2013-08-05T06:57:40Z |
+————————————–+————–+—————–+———————-+

We can also see detailed resource status in the stack by:

[root@controller-1 heat(keystone_ncep)]# heat resource-list wordpress
+————————+————————–+—————–+———————-+
| Name | Type | Status | Updated |
+————————+————————–+—————–+———————-+
| IPAddress | AWS::EC2::EIP | CREATE_COMPLETE | 2013-08-05T06:57:40Z |
| WebServerSecurityGroup | AWS::EC2::SecurityGroup | CREATE_COMPLETE | 2013-08-05T06:57:41Z |
| IPAssoc | AWS::EC2::EIPAssociation | CREATE_COMPLETE | 2013-08-05T06:57:52Z |
| WebServer | AWS::EC2::Instance | CREATE_COMPLETE | 2013-08-05T06:57:52Z |
+————————+————————–+—————–+———————-+

Also heat stack-show wordpress can be used to show detailed information of the stack

->Try to access the wordpress web UI

From nova list, we could see a VM named “wordpress.WebServer” is created with internal IP and floating IP:

[root@controller-1 heat(keystone_ncep)]# nova list
+————————————–+——————————————–+——–+————————————-+
| ID | Name | Status | Networks |
+————————————–+——————————————–+——–+————————————-+|
| 02da7185-a0a6-44cf-8076-875754163dac | wordpress.WebServer | ACTIVE | ncep-net=10.20.20.17, 10.68.124.102 |
+————————————–+——————————————–+——–+————————————-+

Try to access the wordpress website by its floating IP

http://10.68.124.102/wordpress

You should see the login page in the browser!!!

2.Deploy wordpress blog server with 2 VM instances(front-end + back-end topology)

This template deploy a 2 VM wordpress solution, one VM running web server, 2nd VM running Mysql DB.

->Download the template:

wget https://github.com/abckey/heat-templates/raw/master/WordPress_2_Instances.template

->Deploy the template by heat

heat stack-create wp-2-vm  -f WordPress_2_Instances.template -P “InstanceType=m1.medium;DBUsername=wordpress;DBPassword=worldpress;KeyName=ncepkey;LinuxDistribution=RHEL-6.3″

>From heat resource-list wp-2-vm, we can see 2 VM instances are created, also a floating IP and association with Webserver is there

[root@controller-1 heat(keystone_ncep)]# heat resource-list wp-2-vm
+—————-+————————–+—————–+———————-+
| Name | Type | Status | Updated |
+—————-+————————–+—————–+———————-+
| DatabaseServer | AWS::EC2::Instance | CREATE_COMPLETE | 2013-08-05T07:14:04Z |
| IPAddress | AWS::EC2::EIP | CREATE_COMPLETE | 2013-08-05T07:14:13Z |
| WebServer | AWS::EC2::Instance | CREATE_COMPLETE | 2013-08-05T07:14:13Z |
| IPAssoc | AWS::EC2::EIPAssociation | CREATE_COMPLETE | 2013-08-05T07:14:14Z |
+—————-+————————–+—————–+———————-+

->Try wordpress website with floating IP of WebServer VM instance

[root@controller-1 heat(keystone_ncep)]# nova list
+————————————–+——————————————–+——–+————————————-+
| ID | Name | Status | Networks |
+————————————–+——————————————–+——–+————————————-+
| 4879bb03-bc20-4c33-91e2-d4a7e197d2e5 | wp-2-vm.DatabaseServer | ACTIVE | ncep-net=10.20.20.18 |
| 8e1dc2c7-bc34-4e5d-b833-b64dc8a12c9b | wp-2-vm.WebServer | ACTIVE | ncep-net=10.20.20.19, 10.68.124.103 |
+————————————–+——————————————–+——–+————————————-+

http://10.68.124.103/wordpress

3.Deploy a wordpress blog server with EBS volume as mysql DB storage

This template deploy a VM instance with httpd, wordpress and mysql-server installed, a EBS volume is attached to instance as Mysql DB storage point.

->Download the template

wget https://github.com/abckey/heat-templates/raw/master/WordPress_Single_Instance_With_EBS_EIP.template

->Deploy

heat stack-create wp-ebs -f WordPress_Single_Instance_With_EBS_EIP.template -P “VolumeSize=5;InstanceType=m1.medium;DBUsername=wordpress;DBPassword=worldpress;KeyName=ncepkey;LinuxDistribution=RHEL-6.3″

#Here we need use parameter “VolumeSize” to specify the volume size we intend to use as DB storage.

->From resource list , we can see it has volume and volume attachment there

[root@controller-1 heat(keystone_ncep)]# heat resource-list wp-ebs
+————————-+—————————-+—————–+———————-+
| Name | Type | Status | Updated |
+————————-+—————————-+—————–+———————-+
| DataVolume | AWS::EC2::Volume | CREATE_COMPLETE | 2013-08-05T07:35:48Z |
| WikiServerSecurityGroup | AWS::EC2::SecurityGroup | CREATE_COMPLETE | 2013-08-05T07:35:48Z |
| IPAddress | AWS::EC2::EIP | CREATE_COMPLETE | 2013-08-05T07:35:59Z |
| WikiServer | AWS::EC2::Instance | CREATE_COMPLETE | 2013-08-05T07:35:59Z |
| IPAssoc | AWS::EC2::EIPAssociation | CREATE_COMPLETE | 2013-08-05T07:36:00Z |
| MountPoint | AWS::EC2::VolumeAttachment | CREATE_COMPLETE | 2013-08-05T07:36:02Z |
+————————-+—————————-+—————–+———————-+

->Check volume and attachment

[root@controller-1 heat(keystone_ncep)]# cinder list
+————————————–+——–+————————-+——+————-+———-+————————————–+
| ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
+————————————–+——–+————————-+——+————-+———-+————————————–+
| 16c9c84f-9bf3-43c7-853d-453ec161b170 | in-use | wp-ebs.DataVolume | 5 | None | false | 0738154d-8d58-4a84-a5fc-71774228105d |
+————————————–+——–+————————-+——+————-+———-+————————————–+

Inside vm, we can check mounts:

[root@wp-ebs ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 5.0G 1.6G 3.1G 34% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/vdb1 938M 39M 853M 5% /var/lib/mysql

->Try to access wordpress by floating IP.

4.Deploy a wordpress blog server with HA protection enabled

This template deploy a VM instance with wordpress server installed, and HA is enabled to monitor httpd/mysqld services to make sure they are already running.

->Download template:

wget https://github.com/abckey/heat-templates/raw/master/WordPress_Single_Instance_With_HA.template

->Assign admin role to the tenant user by “ keystone user-role-add” command.

To use HA, waitcondition resource is needed, which needs to create an ec2signed url and to do that it creates a restricted user in keystone. To create any user in keystone we need admin rights:(

This issue has been addressed by a bug ticket: https://bugs.launchpad.net/bugs/1089261

keystone user-role-add –user <ncep user id> –role <admin role id>  –tenant-id <ncep tenant id>

->Deploy

heat stack-create wp-ha -f WordPress_Single_Instance_With_HA.template -P “HupPollInterval=1;InstanceType=m1.medium;DBUsername=wordpress;DBPassword=worldpress;KeyName=ncepkey;LinuxDistribution=RHEL-6.3″

#Parameter “HupPollInterval” is needed to specify the cfn-hup process running interval in minutes, cfn-hup is to check services status, and restart them if return code of “service <service name> status” is not “0″.

->Check resource

[root@controller-1 heat(keystone_ncep)]# heat resource-list wp-ha
+—————+——————————————+—————–+———————-+
| Name | Type | Status | Updated |
+—————+——————————————+—————–+———————-+
| CfnUser | AWS::IAM::User | CREATE_COMPLETE | 2013-08-05T07:53:30Z |
| WaitHandle | AWS::CloudFormation::WaitConditionHandle | CREATE_COMPLETE | 2013-08-05T07:53:30Z |
| WebServerKeys | AWS::IAM::AccessKey | CREATE_COMPLETE | 2013-08-05T07:53:30Z |
| WaitCondition | AWS::CloudFormation::WaitCondition | IN_PROGRESS | 2013-08-05T07:53:41Z |
| WikiDatabase | AWS::EC2::Instance | CREATE_COMPLETE | 2013-08-05T07:53:41Z |
+—————+——————————————+—————–+———————-+

Here “WaitCondition” actually is waiting VM instance is properly started and configured, then goes to next step

Whole resource list after create_complete:

[root@controller-1 heat(keystone_ncep)]# heat resource-list wp-ha
+————————+——————————————+—————–+———————-+
| Name | Type | Status | Updated |
+————————+——————————————+—————–+———————-+
| CfnUser | AWS::IAM::User | CREATE_COMPLETE | 2013-08-05T07:53:30Z |
| WebServerKeys | AWS::IAM::AccessKey | CREATE_COMPLETE | 2013-08-05T07:53:30Z |
| WaitHandle | AWS::CloudFormation::WaitConditionHandle | CREATE_COMPLETE | 2013-08-05T07:54:41Z |
| WikiDatabase | AWS::EC2::Instance | CREATE_COMPLETE | 2013-08-05T07:54:41Z |
| HttpFailureAlarm | AWS::CloudWatch::Alarm | CREATE_COMPLETE | 2013-08-05T07:54:47Z |
| WaitCondition | AWS::CloudFormation::WaitCondition | CREATE_COMPLETE | 2013-08-05T07:54:47Z |
| WebServerRestartPolicy | OS::Heat::HARestarter | CREATE_COMPLETE | 2013-08-05T07:54:47Z |
+————————+——————————————+—————–+———————-+

Resource “OS::Heat::HARestart” takes care of service HA.

->Try to access wordpress web by floating IP

Login page should show up.

->Try HA by stopping httpd service

In the VM, do service httpd stop.

Check cfn-hup.log

[root@wp-ha ~]# tail -f /var/log/cfn-hup.log

DEBUG [2013-08-05 16:28:02,552] Running command: /sbin/service httpd status
DEBUG [2013-08-05 16:28:02,609] Return code of 3 after executing: ‘['su', 'root', '-c', u'/sbin/service httpd status']‘
WARNING [2013-08-05 16:28:02,610] Restarting service httpd
DEBUG [2013-08-05 16:28:02,610] Running command: /sbin/service httpd start
DEBUG [2013-08-05 16:28:02,732] Running command: /etc/cfn/notify-on-httpd-restarted
DEBUG [2013-08-05 16:28:03,634] Running command: /sbin/service mysqld status
DEBUG [2013-08-05 16:28:03,714] Running command: /sbin/service crond status

We can see once cfn-hup found httpd service has problem, it tried to start httpd service.

->Check wordpress web access again, it should work again.

原文处处不明,此处为笔记,侵删。

OpenStack:heat安装使用-Openstack Heat try-out相关推荐

  1. OpenStack Orchestration service (编排服务Heat)

    官方文档安装在 on the controller node,本文档使用新的节点安装 Heat编排服务组件 The Orchestration service consists of the foll ...

  2. (十)OpenStack---M版---双节点搭建---Heat安装和配置

    ↓↓↓↓↓↓↓↓视频已上线B站↓↓↓↓↓↓↓↓ >>>>>>传送门 本章节仅在Controller节点执行 1.Controller节点执行安装和配置 2.验证操作 ...

  3. OpenStack Pike安装学习笔记

    此文原创,绝大部分资料翻译自OpenStack官方安装GUIDE,转载请注明出处. 目录 目录... 1 前言... 4 OpenStack参考架构... 4 硬件架构及配置... 5 控制器节点.. ...

  4. OpenStack Ussuri 安装的OS环境要求初探

    近期准备将OpenStack平台升级到Ussuri版本.考虑到现在在用的整个OpenStack环境并不复杂,仅有一个 AIO 的单节点,以往升级是在两台服务器间交替进行的,相当于重新部署OpenSta ...

  5. CentOS7.4安装部署openstack[Liberty版](1)

    一.OpenStack简介 OpenStack是一个由NASA(美国国家航空航天局)和Rackspace合作研发并发起的,以Apache许可证授权的自由软件和开放源代码项目. OpenStack 是一 ...

  6. 安装部署OpenStack(添加资源)

    文章目录 安装OpenStack 页面操作添加镜像 安装OpenStack 开启 YUM缓存,等会做一键部署分装包 [root@localhost ~]# vi /etc/yum.conf ##kee ...

  7. openstack一键安装脚本(转载)

    #!/bin/sh # openstack pike 单机 一键安装 # 环境 centos 7.4.1708 x86_64 # 更多内容 http://dwz.cn/openstack # Myde ...

  8. Openstack的安装部署教程

    Openstack的安装部署教程 一.环境规划 二.全部节点环境配置工作 1.配置hosts 2.关闭所有防火墙和selinux 3.关闭NetworkManager服务 三.配置openstack的 ...

  9. 2022年openstack快速安装 Skyline 组件安装,支持极简化配置

    [摘要] Skyline 是一个经过 UI 和 UE 优化过的 OpenStack 仪表盘,支持 OpenStack Train 及以上版本.Skyline 拥有现代化的技术栈和生态,更易于开发者维护 ...

最新文章

  1. css3 混合,瞧瞧CSS3的混合模式
  2. Java网络编程从入门到精通(14):多种多样的建立网络连接的方式
  3. 10分钟部署一个数据中心
  4. 你没有权限在此位置中保持文件 java_Java路径问题解决方案收集
  5. 为div添加滚动效果:
  6. linux脚本awk,如何在awk脚本中使用shell变量?
  7. 旧服务器如何虚拟化,4个步骤教你如何重复利用旧虚拟化主机
  8. beeline hiveserver2 start
  9. wls12C启用Gzip
  10. NYOJ 49 开心的小明(01背包)
  11. “OneNMP”-超高性价比的实用网管工具
  12. java batik 乱码_Batik渲染png图片异常的bug修复
  13. Android中的Builder模式
  14. SmartSens在ISSCC 2019 图像传感器技术领域报告会作开场报告,收录论文抢先披露
  15. PFC离散元程序及其在工程领域中的应用(新手必看)
  16. 干货 | 扫了那么多二维码,15款工具打造你的专属二维码
  17. Linux命令大全(最详细)Linux操作系统上课笔记整理
  18. matlab中signal pulses,MATLAB信号处理仿真-基带脉冲成形的数字滤波器
  19. libxml2 使用教程
  20. R语言中的导出为pdf文件或txt文件的注意事项

热门文章

  1. linux 设置交换文件格式,使用linux的mkswap命令建立和设置SWAP交换分区
  2. leetcode题解15-三数之和(双指针经典)
  3. Spring Bean的实例化时机与ApplicationContext中单例bean的延迟初始化
  4. 迅雷精简版-纪念走过的时光
  5. 【medium】220. Contains Duplicate III
  6. linux改目录权限和宿主。
  7. Python学习笔记14(socket编程)
  8. 《暗时间》这本书内容丰富,思路明晰,是学习思维方法的好参考书
  9. mapxtreme java manger web 应用程序牛刀小试
  10. android 8 wifi 不稳定,Android 8.0又背锅?网络兼容问题导致WiFi狂掉线