OpenStack Orchestration service (编排服务Heat)

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介:

官方文档安装在 on the controller node,本文档使用新的节点安装


Heat编排服务组件

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.

1、创建数据库

root@storage:~# apt-get install mysql-server -y

root@storage:~# mysql -uroot -p

Enter password:  zoomtech

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 5

Server version: 5.7.13-0ubuntu0.16.04.2 (Ubuntu)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE DATABASE heat;

Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'localhost' \

    -> IDENTIFIED BY 'heat';

Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'%' \

    -> IDENTIFIED BY 'heat';

Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> exit

Bye

2、向Keystone注册Heat服务

安装OpenStack和Keystone客户端

root@storage:~# apt install python-openstackclient -y

root@storage:~# apt-get install python-keystoneclient -y

准备admin用户身份环境

root@storage:~# cat admin-openrc

export OS_PROJECT_DOMAIN_NAME=default

export OS_USER_DOMAIN_NAME=default

export OS_PROJECT_NAME=admin

export OS_USERNAME=admin

export OS_PASSWORD=nova

export OS_AUTH_URL=http://controller:35357/v3

export OS_IDENTITY_API_VERSION=3

export OS_IMAGE_API_VERSION=2

root@storage:~# . admin-openrc

创建heat用户

root@storage:~# openstack user create --domain default --password-prompt heat

User Password:   heat

Repeat User Password:   heat

+-----------+----------------------------------+

| Field     | Value                            |

+-----------+----------------------------------+

| domain_id | 336cb165bf0b49668e2d63d31d5d0501 |

| enabled   | True                             |

| id        | 748b4048ebb94b16920205f85e420f5f |

| name      | heat                             |

+-----------+----------------------------------+


给heat添加admin角色

root@storage:~# openstack role add --project service --user heat admin


root@storage:~# vim /etc/heat/heat.conf

[DEFAULT]

#In the [DEFAULT] and [oslo_messaging_rabbit] sections, configure RabbitMQ message queue access:

rpc_backend = rabbit

auth_strategy = keystone

#In the [DEFAULT] section, configure the metadata and wait condition URLs:

heat_metadata_server_url = http://controller:8000

heat_waitcondition_server_url = http://controller:8000/v1/waitcondition

#In the [DEFAULT] section, configure the stack domain and administrative credentials:

stack_domain_admin = heat_domain_admin

stack_domain_admin_password = $heat_passwd

stack_user_domain_name = heat

#Replace heat with the password you chose for the heat_domain_admin user in the Identity service.

[oslo_messaging_rabbit]

rabbit_host = controller

rabbit_userid = openstack

rabbit_password = nova

#Replace nova with the password you chose for the openstack account in RabbitMQ.

[database]

connection = mysql+pymysql://heat:heat@localhost/heat

#Replace heat with the password you chose for the Orchestration database.

#Replace mysql node "storage"  with your heat node.

#In the [keystone_authtoken], [trustee], [clients_keystone], and [ec2authtoken] sections, configure Identity service access:

[keystone_authtoken]

auth_uri = http://controller:5000

auth_url = http://controller:35357

memcached_servers = controller:11211

auth_type = password

project_domain_name = default

user_domain_name = default

project_name = service

username = heat

password = heat

#Replace heat with the password you chose for the heat user in the Identity service.

[trustee]

auth_plugin = password

auth_url = http://controller:35357

username = heat

password = heat

user_domain_name = default

[clients_keystone]

auth_uri = http://controller:35357

[ec2authtoken]

auth_uri = http://controller:5000

同步数据库

root@storage:/etc/heat# su -s /bin/sh -c "heat-manage db_sync" heat

启动服务

root@storage:~# service heat-api restart

root@storage:~# service heat-api-cfn restart

root@storage:~# service heat-engine restart


服务验证:三个服务的进程

root@storage:~# ps -A | grep heat

 48413 ?        00:00:02 heat-engine

 48733 ?        00:00:00 heat-api

 48786 ?        00:00:01 heat-api-cfn

root@storage:~# ps aux | grep heat

root      39866  0.0  0.0  16192  6208 pts/1    S+   Aug17   0:00 mysql -u heat -p -h localhost

heat      48265  1.3  0.1 166400 127360 ?       Ss   11:04   0:03 /usr/bin/python /usr/bin/heat-engine --config-file=/etc/heat/heat.conf --log-file=/var/log

/heat/heat-engine.log

heat      48628  0.0  0.1 158080 102528 ?       S    11:05   0:00 /usr/bin/python /usr/bin/heat-api --config-file=/etc/heat/heat.conf --log-file=/var/log/he

at/heat-api.log

heat      48786  0.5  0.1 157568 117376 ?       Ss   11:05   0:01 /usr/bin/python /usr/bin/heat-api-cfn --config-file=/etc/heat/heat.conf --log-file=/var/lo

g/heat/heat-api-cfn.log


查询端口:heat服务工作在8000和8004端口

root@storage:~# netstat -ltunp | grep 8000

tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN      46595/python   

root@storage:~# netstat -ltunp | grep 8004

tcp        0      0 0.0.0.0:8004            0.0.0.0:*               LISTEN      46434/python


查询heat日志,确认服务是否正常运行

root@storage:~# tail -n 10  /var/log/heat/heat-api.log

2016-08-18 09:59:02.676 46434 INFO heat.common.wsgi [-] Started child 46575

2016-08-18 09:59:02.678 46575 INFO eventlet.wsgi.server [-] (46575) wsgi starting up on http://0.0.0.0:8004

2016-08-18 09:59:02.678 46434 INFO heat.common.wsgi [-] Started child 46576

2016-08-18 09:59:02.681 46576 INFO eventlet.wsgi.server [-] (46576) wsgi starting up on http://0.0.0.0:8004

2016-08-18 09:59:02.681 46434 INFO heat.common.wsgi [-] Started child 46577

2016-08-18 09:59:02.683 46577 INFO eventlet.wsgi.server [-] (46577) wsgi starting up on http://0.0.0.0:8004

2016-08-18 09:59:02.684 46434 INFO heat.common.wsgi [-] Started child 46578

2016-08-18 09:59:02.685 46578 INFO eventlet.wsgi.server [-] (46578) wsgi starting up on http://0.0.0.0:8004

2016-08-18 09:59:02.686 46434 INFO heat.common.wsgi [-] Started child 46579

2016-08-18 09:59:02.688 46579 INFO eventlet.wsgi.server [-] (46579) wsgi starting up on http://0.0.0.0:8004

root@storage:~# tail -n 10  /var/log/heat/heat-api-cfn.log

2016-08-17 16:54:14.711 38821 WARNING keystonemiddleware.auth_token [-] Configuring admin URI using auth fragments was deprecated in the Kilo release, and will be removed in the N release, use 'identity_uri\ instead.

2016-08-17 16:54:14.711 38821 WARNING keystonemiddleware.auth_token [-] Configuring auth_uri to point to the public identity endpoint is required; clients may not be able to authenticate against an admin endpoint

2016-08-17 16:54:14.715 38821 INFO heat.api.cfn [-] Starting Heat API on 0.0.0.0:8000

2016-08-17 16:54:14.716 38821 WARNING oslo_reports.guru_meditation_report [-] Guru mediation now registers SIGUSR1 and SIGUSR2 by default for backward compatibility. SIGUSR1 will no longer be registered in a future release, so please use SIGUSR2 to generate reports.

2016-08-17 16:54:14.717 38821 INFO heat.common.wsgi [-] Starting single process server

2016-08-17 16:54:14.717 38821 INFO eventlet.wsgi.server [-] (38821) wsgi starting up on http://0.0.0.0:8000

2016-08-18 09:59:12.225 46595 INFO heat.api.cfn [-] Starting Heat API on 0.0.0.0:8000

2016-08-18 09:59:12.226 46595 WARNING oslo_reports.guru_meditation_report [-] Guru mediation now registers SIGUSR1 and SIGUSR2 by default for backward compatibility. SIGUSR1 will no longer be registered in a future release, so please use SIGUSR2 to generate reports.

2016-08-18 09:59:12.227 46595 INFO heat.common.wsgi [-] Starting single process server

2016-08-18 09:59:12.227 46595 INFO eventlet.wsgi.server [-] (46595) wsgi starting up on http://0.0.0.0:8000

root@storage:~# tail /var/log/heat/heat-engine.log

2016-08-18 11:06:54.708 48290 INFO heat.engine.service [req-dab8b000-ec0e-4208-986f-568d79ba2b44 - - - - -] Service 6e4d85aa-a0c4-42ba-93bb-f3e045f7c876 is updated

2016-08-18 11:06:54.708 48322 INFO heat.engine.service [req-4f6ad467-2e80-407f-92ab-7adc888f8b13 - - - - -] Service 1b9829bd-6540-4534-a0cb-8ff78578e0b9 is updated

2016-08-18 11:06:54.708 48329 INFO heat.engine.service [req-3f5e440b-e308-46bc-9e82-450d189cba53 - - - - -] Service 012ed06b-cc22-49d5-ad8f-27ad3af38691 is updated

2016-08-18 11:06:54.708 48352 INFO heat.engine.service [req-111f1975-3118-44db-93f2-1ad828342e07 - - - - -] Service 61883e3c-265d-495b-8f36-241d6909e491 is updated

2016-08-18 11:06:54.708 48284 INFO heat.engine.service [req-2d808b38-8746-409f-8c1f-225ee5fdf83f - - - - -] Service b531cd81-60d3-4841-a738-e74f49ca1606 is updated

2016-08-18 11:06:54.753 48317 INFO heat.engine.service [req-324789aa-0dee-4f76-ad80-a360155d49fe - - - - -] Service a37cf2eb-d7af-4d2d-97bc-0d71858cf318 is updated

2016-08-18 11:06:54.783 48345 INFO heat.engine.service [req-b5607198-0b7d-4138-adfa-6cef3ae673b4 - - - - -] Service 36b200b2-2eaf-42e7-8910-315728834961 is updated

2016-08-18 11:06:54.783 48298 INFO heat.engine.service [req-37254e4e-e2bc-4a2e-8437-e982167ac392 - - - - -] Service 85978b07-1189-4ded-a46a-6a9fc23f386f is updated

2016-08-18 11:06:54.783 48422 INFO heat.engine.service [req-79b2feb3-657c-4ec1-8add-5d8b15910e1b - - - - -] Service 37a99d3b-6309-42de-b922-152673f8caa6 is updated

2016-08-18 11:06:54.783 48299 INFO heat.engine.service [req-77caaa7d-f263-448a-b4a6-060da57cc81a - - - - -] Service a9a02e13-bc27-4d9e-833a-6e1cbb68fcdb is updated

 

root@storage:~/heat# openstack service list

+----------------------------------+----------+----------------+

| ID                               | Name     | Type           |

+----------------------------------+----------+----------------+

| 3cb8f6fab4e54437a4ecf4007a9fc0a6 | cinder   | volume         |

| 440962187ab0433b9e27ac8b7f181a7c | keystone | identity       |

| 87cee2d4b1d445c9bc8715b1b83bbf6c | nova     | compute        |

| b4020f307f8a47bab274adb8d00dd954 | cinderv2 | volumev2       |

| c6960664ab714336b085a59fff5ae68a | swift    | object-store   |

| c75b4f0612f64e31bf4710ee1cbb0066 | glance   | image          |

| cfb21a0c73704d51848ce208bce62cec | heat-cfn | cloudformation |

| d4de96e73e184eaea59776fd549900d3 | neutron  | network        |

| ef1a98be03014f3a86e891569b074d16 | heat     | orchestration  |

| f95cb598c8134a6a834f7d435c433985 | swift    | object-store   |

+----------------------------------+----------+----------------+

root@storage:~#

root@storage:~# openstack orchestration service list


创建template

root@storage:~/heat# cat demo-template.yml

heat_template_version: 2015-10-15

description: Launch a basic instance with CirrOS image using the

             ``m1.tiny`` flavor, ``mykey`` key,  and one network.

parameters:

  NetID:

    type: string

    description: Network ID to use for the instance.

resources:

  server:

    type: OS::Nova::Server

    properties:

      image: { get_parm: Image_ID }

      flavor: zoom.medium

      key_name: key

      networks:

      - network: { get_param: Net_ID }

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 ] }


创建Stack

root@storage:~/heat# vim create_stack.sh

IMAGE_ID=$(nova image-list | awk '/ Ubuntu16.04-server-clouding-powerpc64el / { print $2 }')

NET_ID=$(openstack network list | awk '/ private / { print $2 }')

heat stack-create Ubuntu-clouding.stack -f demo-template.yml \

-P Image_ID=$IMAGE_ID \

-P Net_ID=$NET_ID \

#openstack stack create -t demo-template.yml --parameter "NetID=$NET_ID" --parameter "Net_ID=$IMAGE_ID" stack




本文转自 OpenStack2015 51CTO博客,原文链接:http://blog.51cto.com/andyliu/1840112,如需转载请自行联系原作者

相关实践学习
如何在云端创建MySQL数据库
开始实验后,系统会自动创建一台自建MySQL的 源数据库 ECS 实例和一台 目标数据库 RDS。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
6月前
|
存储 消息中间件 数据库
云计算|OpenStack|社区版OpenStack安装部署文档(八--- 存储服务cinder的安装部署---Rocky版)
云计算|OpenStack|社区版OpenStack安装部署文档(八--- 存储服务cinder的安装部署---Rocky版)
279 0
|
6月前
|
运维 数据可视化 Linux
云计算|OpenStack|社区版OpenStack安装部署文档(七--- 仪表盘服务dashboard的安装部署---Rocky版)
云计算|OpenStack|社区版OpenStack安装部署文档(七--- 仪表盘服务dashboard的安装部署---Rocky版)
161 0
|
Linux 数据库
【Openstack】排错:Glance服务安装后HTTP 500解决
在搭建Openstack平台时,装完各个组件后发现了glance无法正常使用
2663 0
【Openstack】排错:Glance服务安装后HTTP 500解决
|
3月前
|
安全 API 网络安全
OpenStack的 网络服务(Neutron)
【8月更文挑战第23天】
246 10
|
6月前
|
存储 关系型数据库 MySQL
云计算|OpenStack|社区版OpenStack安装部署文档(四 --- 镜像服务glance安装部署---Rocky版)
云计算|OpenStack|社区版OpenStack安装部署文档(四 --- 镜像服务glance安装部署---Rocky版)
177 0
|
2月前
|
存储 消息中间件 算法
深入解析OpenStack Cinder:块存储服务详解
本文介绍了OpenStack及其块存储服务Cinder。OpenStack是一个开源云计算管理平台,提供基础设施即服务(IaaS),核心服务包括计算、网络、存储等。Cinder主要用于为虚拟机提供持久性块存储,具备多种功能,如卷操作、备份、快照及与实例的交互等。此外,还详细介绍了Cinder的工作流程、命令行操作及不同存储插件的使用。
457 8
|
6月前
|
Linux 网络安全 API
云计算|OpenStack|社区版OpenStack安装部署文档(五 --- 计算服务nova安装部署---Rocky版)
云计算|OpenStack|社区版OpenStack安装部署文档(五 --- 计算服务nova安装部署---Rocky版)
367 0
|
API 数据库 数据安全/隐私保护
(五)Open Stack(M)----Neutron服务安装与配置(上)
(五)Open Stack(M)----Neutron服务安装与配置(上)
120 0
|
6月前
|
Linux API 数据库
云计算|OpenStack|社区版OpenStack安装部署文档(六 --- 网络服务neutron的安装部署---Rocky版)
云计算|OpenStack|社区版OpenStack安装部署文档(六 --- 网络服务neutron的安装部署---Rocky版)
199 0
|
6月前
|
关系型数据库 MySQL 数据库
云计算|OpenStack|社区版OpenStack安装部署文档(三 --- 身份认证服务keystone安装部署---Rocky版)
云计算|OpenStack|社区版OpenStack安装部署文档(三 --- 身份认证服务keystone安装部署---Rocky版)
182 0