Heat的安装,配置以及核心概念
Heat作为相对独立的模块建立在其他模块之上。Havana版中主要与Heat交互的模块是Nova和Ceilometer。下一版本Ice House还会有Swift,Glance, Neutron。
安装和配置篇
推荐的安装方式是用Redhat的packstack或Ubuntu的Juju直接安装,因为Heat在Havana 版本已经是正式的模块了。我主要用的是Redhat RDO,所以一条命令就能搞定。
packstack--install-hosts=x.x.x.x,x.x.x.x--os-heat-install=y
gitclone git://github.com/openstack/heat.git
cd heat; gitcheckout remotes/origin/stable/grizzly
git checkout�Cb grizzly
yum install -y libxslt-develpython-devel gcc python-pip
pythonsetup.py install
./install.sh
配置Heat
yum install -ypython-paste-deploy.noarch python-routes.noarch
source/root/keystonerc_admin
打开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)
执行heat/bin/heat-keystone-setup,创建heat用户
'catpackstack-answers-20130912-124830.txt |grep MYSQL'. 拿到mysql的密码,这个用来创建heat的数据库.
CONFIG_MYSQL_PW=4ad9837a8e5e473a
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_url从127.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-images/中下载F17-x86_64-cfntools.qcow2, 然后用glance把它导入:
glanceimage-create --name=F17-x86_64-cfntools --disk-format=qcow2--container-format=bare < /var/lib/libvirt/images/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 | +---------------------+---------------------------------------+-----------------+----------------------+