Heat高可用

2024-06-20 19:38
文章标签 可用 heat

本文主要是介绍Heat高可用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

Heat高可用部署


1 简介


The Orchestration service provides a template-based orchestration for describing a cloud application by running OpenStack API calls to generate running cloud applications. The software integrates other core components of OpenStack into a one-file template system. The templates allow you to create most OpenStack resource types, such as instances, floating IPs, volumes, security groups and users. It also provides advanced functionality, such as instance high availability, instance auto-scaling, and nested stacks. This enables OpenStack core projects to receive a larger user base.
The service enables deployers to integrate with the Orchestration service directly or through custom plug-ins.
The Orchestration service consists of the following components:
heat command-line client
A CLI that communicates with the heat-api to run AWS CloudFormation APIs. End developers can directly use the Orchestration REST API.
heat-api component
An OpenStack-native REST API that processes API requests by sending them to the heat-engine over Remote Procedure Call (RPC).
heat-api-cfn component
An AWS Query API that is compatible with AWS CloudFormation. It processes API requests by sending them to the heat-engine over RPC.
heat-engine
Orchestrates the launching of templates and provides events back to the API consumer.










2 安装和配置
启用OpenStack 库¶
# apt-get install software-properties-common
# add-apt-repository cloud-archive:liberty


1. 在主机上升级包:
# apt-get update && apt-get dist-upgrade
 
注解
如果更新了一个新内核,重启主机来使用新内核。
2. 安装 OpenStack 客户端:
# apt-get install python-openstackclient






以下部分将描述如何在控制节点上安装及配置 Orchestration 服务,即heat。
前提条件¶
在你安装和配置流程服务之前,你必须创建数据库,服务凭证和API端点。流程同时需要在认证服务中添加额外信息。
1. 完成下面的步骤以创建数据库:
o 用数据库连接客户端以 root 用户连接到数据库服务器:
o $ mysql -u root -p
o 创建 heat 数据库:
o CREATE DATABASE heat;
o 对``heat``数据库授予恰当的权限:
o GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'localhost' \
o  IDENTIFIED BY 'HEAT_DBPASS';
o GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'%' \
o  IDENTIFIED BY 'HEAT_DBPASS';
使用合适的密码替换``HEAT_DBPASS``。
o 退出数据库客户端。
2. 获得 admin 凭证来获取只有管理员能执行命令的访问权限:
3. $ source admin-openrc.sh
4. 要创建服务证书,完成这些步骤:
o 创建``heat`` 用户:
o $ openstack user create --domain default --password-prompt heat
o User Password:
o Repeat User Password:
o +-----------+----------------------------------+
o | Field     | Value                            |
o +-----------+----------------------------------+
o | domain_id | default                          |
o | enabled   | True                             |
o | id        | ca2e175b851943349be29a328cc5e360 |
o | name      | heat                             |
o +-----------+----------------------------------+
o 添加 admin 角色到 heat 用户上。
o $ openstack role add --project service --user heat admin
 
注解
这个命令执行后没有输出。
o 创建``heat`` 和 heat-cfn 服务实体:
o $ openstack service create --name heat \
o  --description "Orchestration" orchestration
o +-------------+----------------------------------+
o | Field       | Value                            |
o +-------------+----------------------------------+
o | description | Orchestration                    |
o | enabled     | True                             |
o | id          | 727841c6f5df4773baa4e8a5ae7d72eb |
o | name        | heat                             |
o | type        | orchestration                    |
o +-------------+----------------------------------+
o
o $ openstack service create --name heat-cfn \
o  --description "Orchestration"  cloudformation
o +-------------+----------------------------------+
o | Field       | Value                            |
o +-------------+----------------------------------+
o | description | Orchestration                    |
o | enabled     | True                             |
o | id          | c42cede91a4e47c3b10c8aedc8d890c6 |
o | name        | heat-cfn                         |
o | type        | cloudformation                   |
o +-------------+----------------------------------+
5. 创建 Orchestration 服务的 API 端点:
6. $ openstack endpoint create --region RegionOne \
7.  orchestration public http://controller:8004/v1/%\(tenant_id\)s
8. +--------------+-----------------------------------------+
9. | Field        | Value                                   |
10. +--------------+-----------------------------------------+
11. | enabled      | True                                    |
12. | id           | 3f4dab34624e4be7b000265f25049609        |
13. | interface    | public                                  |
14. | region       | RegionOne                               |
15. | region_id    | RegionOne                               |
16. | service_id   | 727841c6f5df4773baa4e8a5ae7d72eb        |
17. | service_name | heat                                    |
18. | service_type | orchestration                           |
19. | url          | http://controller:8004/v1/%(tenant_id)s |
20. +--------------+-----------------------------------------+
21.
22. $ openstack endpoint create --region RegionOne \
23.  orchestration internal http://controller:8004/v1/%\(tenant_id\)s
24. +--------------+-----------------------------------------+
25. | Field        | Value                                   |
26. +--------------+-----------------------------------------+
27. | enabled      | True                                    |
28. | id           | 9489f78e958e45cc85570fec7e836d98        |
29. | interface    | internal                                |
30. | region       | RegionOne                               |
31. | region_id    | RegionOne                               |
32. | service_id   | 727841c6f5df4773baa4e8a5ae7d72eb        |
33. | service_name | heat                                    |
34. | service_type | orchestration                           |
35. | url          | http://controller:8004/v1/%(tenant_id)s |
36. +--------------+-----------------------------------------+
37.
38. $ openstack endpoint create --region RegionOne \
39.  orchestration admin http://controller:8004/v1/%\(tenant_id\)s
40. +--------------+-----------------------------------------+
41. | Field        | Value                                   |
42. +--------------+-----------------------------------------+
43. | enabled      | True                                    |
44. | id           | 76091559514b40c6b7b38dde790efe99        |
45. | interface    | admin                                   |
46. | region       | RegionOne                               |
47. | region_id    | RegionOne                               |
48. | service_id   | 727841c6f5df4773baa4e8a5ae7d72eb        |
49. | service_name | heat                                    |
50. | service_type | orchestration                           |
51. | url          | http://controller:8004/v1/%(tenant_id)s |
52. +--------------+-----------------------------------------+
53. $ openstack endpoint create --region RegionOne \
54.  cloudformation public http://controller:8000/v1
55. +--------------+----------------------------------+
56. | Field        | Value                            |
57. +--------------+----------------------------------+
58. | enabled      | True                             |
59. | id           | b3ea082e019c4024842bf0a80555052c |
60. | interface    | public                           |
61. | region       | RegionOne                        |
62. | region_id    | RegionOne                        |
63. | service_id   | c42cede91a4e47c3b10c8aedc8d890c6 |
64. | service_name | heat-cfn                         |
65. | service_type | cloudformation                   |
66. | url          | http://controller:8000/v1        |
67. +--------------+----------------------------------+
68.
69. $ openstack endpoint create --region RegionOne \
70.  cloudformation internal http://controller:8000/v1
71. +--------------+----------------------------------+
72. | Field        | Value                            |
73. +--------------+----------------------------------+
74. | enabled      | True                             |
75. | id           | 169df4368cdc435b8b115a9cb084044e |
76. | interface    | internal                         |
77. | region       | RegionOne                        |
78. | region_id    | RegionOne                        |
79. | service_id   | c42cede91a4e47c3b10c8aedc8d890c6 |
80. | service_name | heat-cfn                         |
81. | service_type | cloudformation                   |
82. | url          | http://controller:8000/v1        |
83. +--------------+----------------------------------+
84.
85. $ openstack endpoint create --region RegionOne \
86.  cloudformation admin http://controller:8000/v1
87. +--------------+----------------------------------+
88. | Field        | Value                            |
89. +--------------+----------------------------------+
90. | enabled      | True                             |
91. | id           | 3d3edcd61eb343c1bbd629aa041ff88b |
92. | interface    | internal                         |
93. | region       | RegionOne                        |
94. | region_id    | RegionOne                        |
95. | service_id   | c42cede91a4e47c3b10c8aedc8d890c6 |
96. | service_name | heat-cfn                         |
97. | service_type | cloudformation                   |
98. | url          | http://controller:8000/v1        |
99. +--------------+----------------------------------+
100. 为了管理栈,在认证服务中Orchestration需要更多信息。为了添加这些信息,完成下面的步骤:
o 为栈创建 heat 包含项目和用户的域:
o $ openstack domain create --description "Stack projects and users" heat
o +-------------+----------------------------------+
o | Field       | Value                            |
o +-------------+----------------------------------+
o | description | Stack projects and users         |
o | enabled     | True                             |
o | id          | 0f4d1bd326f2454dacc72157ba328a47 |
o | name        | heat                             |
o +-------------+----------------------------------+
o 在 heat 域中创建管理项目和用户的``heat_domain_admin``用户:
o $ openstack user create --domain heat --password-prompt heat_domain_admin
o User Password:
o Repeat User Password:
o +-----------+----------------------------------+
o | Field     | Value                            |
o +-----------+----------------------------------+
o | domain_id | 0f4d1bd326f2454dacc72157ba328a47 |
o | enabled   | True                             |
o | id        | b7bd1abfbcf64478b47a0f13cd4d970a |
o | name      | heat_domain_admin                |
o +-----------+----------------------------------+
o 添加``admin``角色到 heat 域 中的``heat_domain_admin``用户,启用``heat_domain_admin``用户管理栈的管理权限:
o $ openstack role add --domain heat --user heat_domain_admin admin
 
注解
这个命令执行后没有输出。
o 创建 heat_stack_owner 角色:
o $ openstack role create heat_stack_owner
o +-------+----------------------------------+
o | Field | Value                            |
o +-------+----------------------------------+
o | id    | 15e34f0c4fed4e68b3246275883c8630 |
o | name  | heat_stack_owner                 |
o +-------+----------------------------------+
o 添加``heat_stack_owner`` 角色到``demo`` 项目和用户,启用``demo`` 用户管理栈。
o $ openstack role add --project demo --user demo heat_stack_owner
 
注解
这个命令执行后没有输出。
 
注解
你必须添加 heat_stack_owner 角色到每个管理栈的用户。
o 创建 heat_stack_user 角色:
o $ openstack role create heat_stack_user
o +-------+----------------------------------+
o | Field | Value                            |
o +-------+----------------------------------+
o | id    | 88849d41a55d4d1d91e4f11bffd8fc5c |
o | name  | heat_stack_user                  |
o +-------+----------------------------------+
 
注解
Orchestration 自动地分配 ``heat_stack_user``角色给在 stack 部署过程中创建的用户。默认情况下,这个角色会限制 API 的操作。为了避免冲突,请不要为用户添加 ``heat_stack_owner``角色。
安全并配置组件¶
 
注解
默认配置文件在各发行版本中可能不同。你可能需要添加这些部分和选项而不是修改已经存在的部分和选项。另外,在配置片段中的省略号(...)表示默认的配置选项你应该保留。
1. 安装软件包:
2. # apt-get install heat-api heat-api-cfn heat-engine \
3.  python-heatclient
2. 编辑文件 /etc/heat/heat.conf 并完成如下动作:
o 在 [database] 部分,配置数据库访问:
o [database]
o ...
o connection = mysql+pymysql://heat:HEAT_DBPASS@controller/heat
将 HEAT_DBPASS 替换为你为 Orchestration 数据库选择的密码。
o 在 “[DEFAULT]” 和 “[oslo_messaging_rabbit]”部分,配置 “RabbitMQ” 消息队列访问:
o [DEFAULT]
o ...
o rpc_backend = rabbit
o
o [oslo_messaging_rabbit]
o ...
o rabbit_host = controller
o rabbit_userid = openstack
o rabbit_password = RABBIT_PASS
用你在 “RabbitMQ” 中为 “openstack” 用户选择的密码替换 “RABBIT_PASS”。
o 在``[keystone_authtoken]``, [trustee],[clients_keystone]``和 ``[ec2authtoken] 部分,配置认证服务访问:
o [keystone_authtoken]
o ...
o auth_uri = http://controller:5000
o auth_url = http://controller:35357
o auth_plugin = password
o project_domain_id = default
o user_domain_id = default
o project_name = service
o username = heat
o password = HEAT_PASS
o
o [trustee]
o ...
o auth_plugin = password
o auth_url = http://controller:35357
o username = heat
o password = HEAT_PASS
o user_domain_id = default
o
o [clients_keystone]
o ...
o auth_uri = http://controller:5000
o
o [ec2authtoken]
o ...
o auth_uri = http://controller:5000/v3
将``HEAT_PASS`` 替换为你在认证服务中为 heat 用户选择的密码。
o 在``[DEFAULT]`` 部分,配置元数据和 等待条件URLs:
o [DEFAULT]
o ...
o heat_metadata_server_url = http://controller:8000
o heat_waitcondition_server_url = http://controller:8000/v1/waitcondition
o 在 [DEFAULT] 部分,配置栈域与管理凭据:
o [DEFAULT]
o ...
o stack_domain_admin = heat_domain_admin
o stack_domain_admin_password = HEAT_DOMAIN_PASS
o stack_user_domain_name = heat
将 HEAT_DOMAIN_PASS 替换为你在认证服务中为``heat_domain_admin`` 用户选择的密码。
o (可选的)为帮助排错,在 “[DEFAULT]”部分启用详细日志。
o [DEFAULT]
o ...
o verbose = True
3. 同步Orchestration数据库:
4. # su -s /bin/sh -c "heat-manage db_sync" heat
完成安装¶
1. 重启Orchestration服务:
2. # service heat-api restart
3. # service heat-api-cfn restart
4. # service heat-engine restart
2. 默认情况下,Ubuntu 上的安装包会自动创建一个 SQLite 数据库。
因为这里配置使用SQL 数据库服务器,所以你可以SQLite 服务库文件:
# rm -f /var/lib/heat/heat.sqlite


验证操作
验证Orchestration服务的相关操作。
 
注解
在控制节点上执行这些命令。
1. 执行租户凭证``admin`脚本:
2. $ source admin-openrc.sh
3. 列出服务组件,以验证是否成功启动并注册了每个进程:
4. $ heat service-list
5. +------------+-------------+--------------------------------------+------------+--------+----------------------------+--------+
6. | hostname   | binary      | engine_id                            | host       | topic  | updated_at                 | status |
7. +------------+-------------+--------------------------------------+------------+--------+----------------------------+--------+
8. | controller | heat-engine | 3e85d1ab-a543-41aa-aa97-378c381fb958 | controller | engine | 2015-10-13T14:16:06.000000 | up     |
9. | controller | heat-engine | 45dbdcf6-5660-4d5f-973a-c4fc819da678 | controller | engine | 2015-10-13T14:16:06.000000 | up     |
10. | controller | heat-engine | 51162b63-ecb8-4c6c-98c6-993af899c4f7 | controller | engine | 2015-10-13T14:16:06.000000 | up     |
11. | controller | heat-engine | 8d7edc6d-77a6-460d-bd2a-984d76954646 | controller | engine | 2015-10-13T14:16:06.000000 | up     |
12. +------------+-------------+--------------------------------------+------------+--------+----------------------------+--------+
 
注解
该输出显示表明在控制节点上有应该四个``heat-engine``组件。










3 创建一个启动实例的栈
创建一个模板¶
Orchestration服务使用模版来描述栈。想要学习模版语言,参考`Heat developer documentation <http://docs.openstack.org/developer/heat/index.html>`__中的`the Template Guide <http://docs.openstack.org/developer/heat/template_guide/index.html>`__ 。`
使用下面的内容创建``demo-template.yml``文件:
heat_template_version: 2015-10-15
description: Launch a basic instance using the ``m1.tiny`` flavor and one network.

parameters:
 ImageID:
   type: string
   description: Image to use for the instance.
 NetID:
   type: string
   description: Network ID to use for the instance.

resources:
 server:
   type: OS::Nova::Server
   properties:
     image: { get_param: ImageID }
     flavor: m1.tiny
     networks:
     - network: { get_param: NetID }

outputs:
 instance_name:
   description: Name of the instance.
   value: { get_attr: [ server, name ] }
 instance_ip:
   description: IP address of the instance.
   value: { get_attr: [ server, first_address ] }
创建一个栈¶
使用``demo-template.yml`` 模版创建一个栈。
1. 加载 ``demo``凭证,作为非管理员项目执行下面的步骤:
$ source demo-openrc.sh
2. 检测可用网络。
$ neutron net-list
+--------------------------------------+---------+-----------------------------------------------------+
| id                                   | name    | subnets                                             |
+--------------------------------------+---------+-----------------------------------------------------+
| 9c13da20-4c4f-486f-a4e9-692e9ea397f1 | public  | 85140549-1f54-4bc6-a2c5-f08428de3f7a 203.0.113.0/24 |
| 303a9aaf-40fd-4fc8-9213-39bff933467b | private | ddeba0b1-21eb-471a-8f31-10f0e290cc36 172.16.1.0/24  |
+--------------------------------------+---------+-----------------------------------------------------+
 
注解
这个输出可能跟你的环境有所不同。
3. 设置``NET_ID``环境变量表示网络ID。例如,使用``public`` 网络:
$ export NET_ID=$(neutron net-list | awk '/ public / { print $2 }')
4. 在公共网络上创建一个CirrOS实例的栈:
$ heat stack-create -f demo-template.yml -P "ImageID=cirros;NetID=$NET_ID" stack
+--------------------------------------+------------+--------------------+---------------------+--------------+
| id                                   | stack_name | stack_status       | creation_time       | updated_time |
+--------------------------------------+------------+--------------------+---------------------+--------------+
| dbf46d1b-0b97-4d45-a0b3-9662a1eb6cf3 | stack      | CREATE_IN_PROGRESS | 2015-10-13T15:27:20 | None         |
+--------------------------------------+------------+--------------------+---------------------+--------------+
5. 等一段时间,验证栈的创建是否成功:
$ heat stack-list
+--------------------------------------+------------+-----------------+---------------------+--------------+
| id                                   | stack_name | stack_status    | creation_time       | updated_time |
+--------------------------------------+------------+-----------------+---------------------+--------------+
| dbf46d1b-0b97-4d45-a0b3-9662a1eb6cf3 | stack      | CREATE_COMPLETE | 2015-10-13T15:27:20 | None         |
+--------------------------------------+------------+-----------------+---------------------+--------------+
6. 查看实例的名称和IB地址并和``nova`` 命令的输出比较:
$ heat output-show --all stack
[
  {
    "output_value": "stack-server-3nzfyfofu6d4",
    "description": "Name of the instance.",
    "output_key": "instance_name"
  },
  {
    "output_value": "10.4.31.106",
    "description": "IP address of the instance.",
    "output_key": "instance_ip"
  }
]


$ nova list
+--------------------------------------+---------------------------+--------+------------+-------------+---------------------------------+
| ID                                   | Name                      | Status | Task State | Power State | Networks                        |
+--------------------------------------+---------------------------+--------+------------+-------------+---------------------------------+
| 0fc2af0c-ae79-4d22-8f36-9e860c257da5 | stack-server-3nzfyfofu6d4 | ACTIVE | -          | Running     | public=10.4.31.106              |
+--------------------------------------+---------------------------+--------+------------+-------------+---------------------------------+
7. 删除栈。
$ heat stack-delete stack




http://blog.csdn.net/tantexian/article/details/44959977




这篇关于Heat高可用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1079071

相关文章

centos7基于keepalived+nginx部署k8s1.26.0高可用集群

《centos7基于keepalived+nginx部署k8s1.26.0高可用集群》Kubernetes是一个开源的容器编排平台,用于自动化地部署、扩展和管理容器化应用程序,在生产环境中,为了确保集... 目录一、初始化(所有节点都执行)二、安装containerd(所有节点都执行)三、安装docker-

Sentinel 高可用流量管理框架

Sentinel 是面向分布式服务架构的高可用流量防护组件,主要以流量为切入点,从限流、流量整形、熔断降级、系统负载保护、热点防护等多个维度来帮助开发者保障微服务的稳定性。 Sentinel 具有以下特性: 丰富的应用场景:Sentinel 承接了阿里巴巴近 10 年的双十一大促流量的核心场景,例如秒杀(即突发流量控制在系统容量可以承受的范围)、消息削峰填谷、集群流量控制、实时熔断下游不可用应

JAVA用最简单的方法来构建一个高可用的服务端,提升系统可用性

一、什么是提升系统的高可用性 JAVA服务端,顾名思义就是23体验网为用户提供服务的。停工时间,就是不能向用户提供服务的时间。高可用,就是系统具有高度可用性,尽量减少停工时间。如何用最简单的方法来搭建一个高效率可用的服务端JAVA呢? 停工的原因一般有: 服务器故障。例如服务器宕机,服务器网络出现问题,机房或者机架出现问题等;访问量急剧上升,导致服务器压力过大导致访问量急剧上升的原因;时间和

VMware8实现高可用(HA)集群

陈科肇 =========== 操作系统:中标麒麟高级操作系统V6 x86-64 实现软件:中标麒麟高可用集群软件 ======================== 1.环境的规划与配置 硬件要求 服务器服务器至少需要 2 台,每台服务器至少需要 2 块网卡以做心跳与连接公网使用存储环境 建议使用一台 SAN/NAS/ISCSI 存储作为数据共享存储空间 软

用Cri-O,Sealos CLI,Kubeadm方式部署K8s高可用集群

3.6 Cri-O方式部署K8s集群 注意:基于Kubernetes基础环境 3.6.1 所有节点安装配置cri-o [root@k8s-all ~]# VERSION=1.28[root@k8s-all ~]# curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensu

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

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

Kubernetes高可用集群搭建(kubeadm)

1 Kubernetes高可用集群介绍 前面已经介绍了Kubernetes的集群部署,但是都只是介绍的单master节点的情况,由于单master节点的可靠性不高,不适合实际的生产环境,此处介绍如何实现多master节点的高可用集群的搭建。 2 安装要求 一台或多台机器,操作系统CentOS7.x-x86_64硬件配置:2G或更多ARM,2个CPU或更多CPU,硬盘20G及以上集群中所有机器

# 高可用的并发解决方案nginx+keepalived(一)

高可用的并发解决方案nginx+keepalived(一) 段子手 一、课程计划介绍 1、课程标题 为并发量高的优质网站量身定制高可用的并发解决方案 nginx+keepalived。 2、引导语 在这个互联网飞速发展的时代,人们已经离不开网络,其中网购最为常见。在家网购,上班路上网购,吃饭也购物,下班还网购,2017年双十一天猫支付峰值达到了25.6万笔/秒。热点网站中频繁出现的大量

HBase抗战总结 | 阿里巴巴HBase高可用8年抗战回忆录

前言 2011年毕玄和竹庄两位大神将HBase引入阿里技术体系,2014年接力棒转到东8区第一位HBase commiter天梧手中,多年来与淘宝、旺旺、菜鸟、支付宝、高德、大文娱、阿里妈妈等几乎全BU合作伙伴携手共进,支撑了双十一大屏、支付宝账单、支付宝风控、物流详情等核心业务。2018年双十一,HBase全天处理请求2.4万亿行,单集群吞吐达到千万级别。从一个婴儿成长为青年,阿里HBase

正面超越Spark | 几大特性垫定Flink1.12流计算领域真正大规模生产可用(下)

点击上方蓝色字体,选择“设为星标” 回复”资源“获取更多资源 我们书接上文,我们在之前的文章《正面超越Spark | 几大特性垫定Flink1.12流计算领域真正大规模生产可用(上)》详细描述了Flink的生产级别Flink on K8s高可用方案和DataStream API 对批执行模式的支持。 接下来是另外的几个特性增强。 第三个,Flink对SQL操作的全面支持 再很早之前,我在浏览社