OpenStack离线Train版安装系列—10.控制节点-Heat服务组件

本系列文章包含从OpenStack离线源制作到完成OpenStack安装的全部过程。
在本系列教程中使用的OpenStack的安装版本为第20个版本Train(简称T版本),2020年5月13日,OpenStack社区发布了第21个版本Ussuri(简称U版本)。

OpenStack部署系列文章
OpenStack Victoria版 安装部署系列教程
OpenStack Ussuri版 离线安装部署系列教程(全)
OpenStack Train版 离线安装部署系列教程(全)
欢迎留言沟通,共同进步。



OpenStack离线Train版安装系列—10.控制节点-Heat服务组件

在控制节点安装Heat编排服务

官方参考:
https://docs.openstack.org/install-guide/openstack-services.html
https://docs.openstack.org/train/install/
https://docs.openstack.org/heat/train/
https://docs.openstack.org/heat/train/install/
https://docs.openstack.org/heat/train/install/install-rdo.html
https://docs.openstack.org/heat/train/install/verify.html
https://docs.openstack.org/heat/train/install/launch-instance.html
https://docs.openstack.org/mitaka/zh_CN/install-guide-rdo/
https://docs.openstack.org/mitaka/zh_CN/install-guide-rdo/common/get_started_orchestration.html

一、创建heat相关数据库、服务凭证和API端点

https://docs.openstack.org/heat/train/install/install-rdo.html

1.创建heat数据库,并授予合适的访问权限

#用数据库连接客户端以 root 用户连接到数据库服务器:
mysql -u root -proot

#创建 heat 数据库:
MariaDB [(none)]> CREATE DATABASE heat;

#对``heat``数据库授予恰当的权限:
MariaDB [(none)]> GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'localhost' \
  IDENTIFIED BY 'HEAT_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'%' \
  IDENTIFIED BY 'HEAT_DBPASS';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> show databases;
MariaDB [(none)]> select user,host from mysql.user;

#退出数据库客户端。
MariaDB [(none)]> exit

请自行设置HEAT_DBPASS为合适的密码。

2.获得 admin 凭证来获取只有管理员能执行的命令的访问权限

cd
source admin-openrc.sh

3.创建服务证书

(1)创建heat 用户:

openstack user create --domain default --password=HEAT_USER_PASS heat

or

openstack user create --domain default --password-prompt heat

(2)添加 admin 角色到 heat 用户上

openstack role add --project service --user heat admin
#This command provides no output.

这个命令执行后没有输出。

(3)创建heat和 heat-cfn 服务实体

openstack service create --name heat \
  --description "Orchestration" orchestration
openstack service create --name heat-cfn \
  --description "Orchestration"  cloudformation  

4.创建 Orchestration 服务的 API 端点

openstack endpoint create --region RegionOne \
  orchestration public http://controller:8004/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne \
  orchestration internal http://controller:8004/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne \
  orchestration admin http://controller:8004/v1/%\(tenant_id\)s

openstack endpoint create --region RegionOne \
  cloudformation public http://controller:8000/v1
openstack endpoint create --region RegionOne \
  cloudformation internal http://controller:8000/v1
openstack endpoint create --region RegionOne \
  cloudformation admin http://controller:8000/v1

5.为了管理栈,在认证服务中Orchestration需要更多信息

(1)为栈创建 heat 包含项目和用户的域

openstack domain create --description "Stack projects and users" heat

(2)在 heat 域中创建管理项目和用户的heat_domain_admin用户:

openstack user create --domain heat --password=HEAT_DOMAIN_USER_PASS heat_domain_admin

or

openstack user create --domain heat --password-prompt heat_domain_admin

(3)添加admin角色到 heat 域 中的heat_domain_admin用户,启用heat_domain_admin用户管理栈的管理权限

openstack role add --domain heat --user-domain heat --user heat_domain_admin admin

这个命令执行后没有输出。

(4)创建 heat_stack_owner 角色:

openstack role create heat_stack_owner

(5)添加heat_stack_owner 角色到demo 项目和用户,启用demo 用户管理栈。

openstack role add --project demo --user demo heat_stack_owner

这个命令执行后没有输出。
必须添加 heat_stack_owner 角色到每个管理栈的用户。

(6)创建 heat_stack_user 角色

openstack role create heat_stack_user

二、安装并配置Heat组件相关软件

1.安装软件包

yum install openstack-heat-api openstack-heat-api-cfn \
  openstack-heat-engine -y

2.修改heat配置

/etc/heat/heat.conf

(1)详细配置

在 [database] 部分,配置数据库访问:

[database]
...
connection = mysql+pymysql://heat:HEAT_DBPASS@controller/heat

将 HEAT_DBPASS 替换为 之前设置heat数据库步骤中的Orchestration 数据库密码。

在 [DEFAULT]部分,配置 “RabbitMQ” 消息队列访问:

[DEFAULT]
...
transport_url = rabbit://openstack:RABBIT_USER_PASS@controller

用你在 “RabbitMQ” 中为 “openstack” 用户选择的密码替换 “RABBIT_USER_PASS”。

在[keystone_authtoken], [trustee],[clients_keystone] 部分,配置认证服务访问

[keystone_authtoken]
...
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = heat
password = HEAT_USER_PASS

[trustee]
...
auth_type = password
auth_url = http://controller:5000
username = heat
password = HEAT_USER_PASS
user_domain_name = default

[clients_keystone]
...
auth_uri = http://controller:5000

HEAT_PASS 替换为在认证服务中为 heat 用户选择的密码

[DEFAULT] 部分,配置元数据和 等待条件URLs:

[DEFAULT]
...
heat_metadata_server_url = http://controller:8000
heat_waitcondition_server_url = http://controller:8000/v1/waitcondition

在 [DEFAULT] 部分,配置栈域与管理凭据:

[DEFAULT]
...
stack_domain_admin = heat_domain_admin
stack_domain_admin_password = HEAT_DOMAIN_USER_PASS
stack_user_domain_name = heat

3.同步Orchestration数据库

su -s /bin/sh -c "heat-manage db_sync" heat

忽略输出中任何不推荐使用的信息。

三、启动 Orchestration 编排服务heat组件并将其设置为随系统启动

systemctl enable openstack-heat-api.service \
  openstack-heat-api-cfn.service openstack-heat-engine.service

systemctl restart openstack-heat-api.service \
  openstack-heat-api-cfn.service openstack-heat-engine.service
  
systemctl list-unit-files |grep openstack-heat*

四、验证操作

https://docs.openstack.org/heat/train/install/verify.html

1.获得 admin 凭证来获取只有管理员能执行的命令的访问权限

[root@controller ~]# cd
[root@controller ~]# source admin-openrc.sh

2.列出服务组件,以验证是否成功启动并注册了每个进程:

[root@controller ~]# openstack service list
+----------------------------------+-----------+----------------+
| ID                               | Name      | Type           |
+----------------------------------+-----------+----------------+
| 1ebdb5b3fe424b6cbecfc7f8531e01f7 | neutron   | network        |
| 4cc7d70db6eb4af58b0c81579f272e81 | heat      | orchestration  |
| 93ad2a6a475b434da264ae730761279c | placement | placement      |
| be75e5a33bd94739a71998d5f90a6cdc | keystone  | identity       |
| c73205af0de142b8b9481adf0d52a110 | cinderv3  | volumev3       |
| cce9ddafb0ce4114aef077d9d960cdf5 | glance    | image          |
| e2347aa92b0443539cd53c8b08650b68 | nova      | compute        |
| e601c6afb77f4153b0e37c7a2a3f10df | heat-cfn  | cloudformation |
| f4b15cb55246411ca5c15e7dee1c0326 | cinderv2  | volumev2       |
+----------------------------------+-----------+----------------+
[root@controller ~]# 
[root@controller ~]# openstack orchestration service list
+------------+-------------+--------------------------------------+------------+--------+----------------------------+--------+
| hostname   | binary      | engine_id                            | host       | topic  | updated_at                 | status |
+------------+-------------+--------------------------------------+------------+--------+----------------------------+--------+
| controller | heat-engine | 3e85d1ab-a543-41aa-aa97-378c381fb958 | controller | engine | 2015-10-13T14:16:06.000000 | up     |
| controller | heat-engine | 45dbdcf6-5660-4d5f-973a-c4fc819da678 | controller | engine | 2015-10-13T14:16:06.000000 | up     |
| controller | heat-engine | 51162b63-ecb8-4c6c-98c6-993af899c4f7 | controller | engine | 2015-10-13T14:16:06.000000 | up     |
| controller | heat-engine | 8d7edc6d-77a6-460d-bd2a-984d76954646 | controller | engine | 2015-10-13T14:16:06.000000 | up     |
+------------+-------------+--------------------------------------+------------+--------+----------------------------+--------+

该输出显示表明在控制节点上有应该四个heat-engine组件。

3.PS查看进程

依次使用以下命令

ps aux | grep heat
ps -A | grep heat
netstat -ltunp | grep 8000
netstat -ltunp | grep 8004

具体过程如下

[root@controller ~]# ps aux | grep heat
heat       5414  0.0  0.1 403852  2296 ?        Ss   12:11   0:01 /usr/bin/python2 /usr/bin/heat-api-cfn --config-file /usr/share/hea 
/heat-dist.conf --config-file /etc/heat/heat.conf
heat       5417  0.0  0.1 404740  3068 ?        Ss   12:11   0:01 /usr/bin/python2 /usr/bin/heat-api --config-file /usr/share/heat/heat-dist.conf --config-file /etc/heat/heat.conf
heat       5424  1.2  0.2 439952  3860 ?        Ss   12:11   1:41 /usr/bin/python2 /usr/bin/heat-engine --config-file /usr/share/heat 
heat-dist.conf --config-file /etc/heat/heat.conf
heat       5449  0.0  0.9 412964 16976 ?        S    12:12   0:05 /usr/bin/python2 /usr/bin/heat-api --config-file /usr/share/heat/heat-dist.conf --config-file /etc/heat/heat.conf
heat       5450  0.0  1.0 447288 19616 ?        S    12:12   0:04 /usr/bin/python2 /usr/bin/heat-engine --config-file /usr/share/heat 
heat-dist.conf --config-file /etc/heat/heat.conf
heat       5451  0.0  1.0 447288 19620 ?        S    12:12   0:03 /usr/bin/python2 /usr/bin/heat-engine --config-file /usr/share/heat 
heat-dist.conf --config-file /etc/heat/heat.conf
heat       5452  0.0  1.0 447288 19620 ?        S    12:12   0:04 /usr/bin/python2 /usr/bin/heat-engine --config-file /usr/share/heat 
heat-dist.conf --config-file /etc/heat/heat.conf
heat       5453  0.0  1.0 447288 19620 ?        S    12:12   0:04 /usr/bin/python2 /usr/bin/heat-engine --config-file /usr/share/heat 
heat-dist.conf --config-file /etc/heat/heat.conf
root      16112  0.0  0.0 112684   696 pts/0    R+   14:29   0:00 grep --color=auto heat
[root@controller ~]#  ps -A | grep heat
  5414 ?        00:00:01 heat-api-cfn
  5417 ?        00:00:01 heat-api
  5424 ?        00:01:41 heat-engine
  5449 ?        00:00:05 heat-api
  5450 ?        00:00:04 heat-engine
  5451 ?        00:00:03 heat-engine
  5452 ?        00:00:04 heat-engine
  5453 ?        00:00:04 heat-engine
[root@controller ~]# netstat -ltunp | grep 8000
tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN      5414/python2
[root@controller ~]# netstat -ltunp | grep 8004
tcp        0      0 0.0.0.0:8004            0.0.0.0:*               LISTEN      5417/python2
[root@controller ~]#

五、启动一个实例

官方文档
https://docs.openstack.org/heat/train/install/launch-instance.html
https://docs.openstack.org/mitaka/zh_CN/install-guide-rdo/launch-instance.html#launch-instance

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

北观止

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值