Heat的安装,配置以及核心概念


OpenStack Heat服务介绍 (二)_第1张图片

Heat独立的模建立在其他模之上。Havana版中主要与Heat交互的模NovaCeilometer。下一版本Ice House还会有Swift,Glance, Neutron


安装和配置篇

推荐的安装方式是用RedhatpackstackUbuntuJuju直接安装,因HeatHavana 版本已是正式的模了。我主要用的是Redhat RDO,所以一条命令就能搞定。

packstack--install-hosts=x.x.x.x,x.x.x.x--os-heat-install=y


如果你是在 Grizzly 版上装就只能手 安装了。
  1. gitclone git://github.com/openstack/heat.git

  2. cd heat; gitcheckout remotes/origin/stable/grizzly

  3. git checkout–b grizzly

  4. yum install -y libxslt-develpython-devel gcc python-pip

  5. pythonsetup.py install

  6. ./install.sh


配置Heat

  1. yum install -ypython-paste-deploy.noarch python-routes.noarch

  2. source/root/keystonerc_admin

  3. 打开heat/bin/heat-keystone-setup,修改201:
    SERVICE_TENANT=$(get_data 2 service 1keystone tenant-list)
    to:
    SERVICE_TENANT=$(get_data 2 services 1keystone tenant-list)

  4. heat/bin/heat-keystone-setupheat

  5. 'catpackstack-answers-20130912-124830.txt |grep MYSQL'. 拿到mysql的密个用来创建heat的数据.

    CONFIG_MYSQL_PW=4ad9837a8e5e473a

  6. heat/bin/heat-db-setup rpm. 脚本会入密,在个例子里面密码就 '4ad9837a8e5e473a'.

Installing on an RPM system.
Please enter the password for the 'root' MySQL user:
Verified connectivity to MySQL.
Creating 'heat' database.
/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/pool.py:683:SADeprecationWarning: The 'listeners' argument to Pool (and create_engine()) isdeprecated.  Use event.listen().
  Pool._init_(self,creator, **kw)
/usr/lib64/python2.6/site-packages/SQLAlchemy-0.7.8-py2.6-linux-x86_64.egg/sqlalchemy/pool.py:159:SADeprecationWarning: Pool.add_listener is deprecated.  Use event.listen()
  self.add_listener(l)


7.

`cat keystonerc_admin |grep OS_PASSWORD`, 修改/etc/heat/heat-api-paste.ini:

admin_tenant_name= services <-- orignial it is 'service'
admin_password =7d1642ae2c1c4aff

8. 修改/etc/heat/heat-api-cfn-paste.ini/etc/heat/heat-api-cloudwatch-paste.ini里的admin_tenant_name and admin_password.

9. heat-engine.conf中的heat_metadata_server_url,heat_waitcondition_server_url, heat_watch_server_url127.0.0.1改成你机器的外网ip

10. yum install -y python-heatclient

11. Heat:

heat-api &

heat-engine &

heat-api-cfn &

heat-cloud-watch &


启动第一个stack

Stack这个概念来源于AWS,Stack管理的是resource。而resource是个抽象的概念,它可以是虚拟机,可以是网络等等。Stack就是Heat管理应用程序的逻辑单元。

1. http://fedorapeople.org/groups/heat/prebuilt-jeos-p_w_picpaths/中下载F17-x86_64-cfntools.qcow2, 然后用glance把它导入:

glancep_w_picpath-create --name=F17-x86_64-cfntools --disk-format=qcow2--container-format=bare < /var/lib/libvirt/p_w_picpaths/F17-x86_64-cfntools.qcow2

2. 通过Horizon或者命令行注册一个SSH key-pair,下面的例子生成root_key

novakeypair-add --pub_key ~/.ssh/id_rsa.pub root_key

3. git clone https://github.com/openstack/heat-templates.git', 从这里可以下载很多heat的参考模版

4. 创建名为demo的Stack

heatstack-create demo --template-file=/root/heat-templates/cfn/F17/getting_started.template --parameters="KeyName=root_key"

5. 观察stack启动的状态

# heat list
+--------------------------------------+------------+-----------------+----------------------+
| id                                   | stack_name | stack_status    | creation_time        |
+--------------------------------------+------------+-----------------+----------------------+
| 543b64c7-3165-4939-a249-ba68d8cb54b0 | demo       | CREATE_COMPLETE | 2013-10-21T10:03:06Z |
+--------------------------------------+------------+-----------------+----------------------+


heat resource-list 543b64c7-3165-4939-a249-ba68d8cb54b0
+---------------------+---------------------------------------+-----------------+----------------------+
| logical_resource_id | resource_type                         | resource_status | updated_time         |
+---------------------+---------------------------------------+-----------------+----------------------+
| JsmLaunchConfig     | AWS::AutoScaling::LaunchConfiguration | CREATE_COMPLETE | 2013-10-21T10:03:06Z |
| CfnUser             | AWS::IAM::User                        | CREATE_COMPLETE | 2013-10-21T10:03:07Z |
| VcsKeys             | AWS::IAM::AccessKey                   | CREATE_COMPLETE | 2013-10-21T10:03:17Z |
| CPUAlarmHigh        | AWS::CloudWatch::Alarm                | CREATE_COMPLETE | 2013-10-21T10:03:35Z |
| CPUAlarmLow         | AWS::CloudWatch::Alarm                | CREATE_COMPLETE | 2013-10-21T10:03:35Z |
| JsmScaleUpPolicy    | AWS::AutoScaling::ScalingPolicy       | CREATE_COMPLETE | 2013-10-21T11:13:20Z |
| VM                  | AWS::AutoScaling::AutoScalingGroup    | CREATE_COMPLETE | 2013-10-21T11:18:55Z |
| JsmScaleDownPolicy  | AWS::AutoScaling::ScalingPolicy       | CREATE_COMPLETE | 2013-10-28T12:52:40Z |
+---------------------+---------------------------------------+-----------------+----------------------+