Openstack Mitaka安裝手順(10)編排服務

十、編排服務mysql

這個部分將描述如何在控制節點上安裝及配置 Orchestration 服務,即heat。sql

10.一、先決條件:建立數據庫,服務憑證和API端點。流程同時須要在認證服務中添加額外信息。數據庫

10.1.一、完成下面的步驟以建立數據庫:api

用數據庫鏈接客戶端以 root 用戶鏈接到數據庫服務器:安全

$ mysql -u root -p服務器


CREATE DATABASE heat;dom

GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'localhost' IDENTIFIED BY 'P@sswrd';tcp

GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'%' IDENTIFIED BY 'P@ssw0rd';ide


10.1.二、得到 admin 憑證來獲取只有管理員能執行的命令的訪問權限:memcached

$ . admin-openrc


10.1.三、要建立服務證書,完成這些步驟:

建立``heat`` 用戶:

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


添加 admin 角色到 heat 用戶上。

$ openstack role add --project service --user heat admin

註解:這個命令執行後沒有輸出。


建立``heat`` 和 heat-cfn 服務實體:

$ openstack service create --name heat --description "Orchestration" orchestration


$ openstack service create --name heat-cfn --description "Orchestration"  cloudformation


10.1.四、建立 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


控制節點防火牆開放端口:8000、8004

# firewall-cmd --permanent --add-port=8000/tcp

# firewall-cmd --permanent --add-port=8004/tcp

# firewall-cmd --reload


確認端口開放成功

# firewall-cmd --list-all


10.1.五、爲了管理棧,在認證服務中Orchestration須要更多信息。爲了添加這些信息,完成下面的步驟:

爲棧建立 heat 包含項目和用戶的域:

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


在 heat 域中建立管理項目和用戶的``heat_domain_admin``用戶:

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


添加``admin``角色到 heat 域 中的``heat_domain_admin``用戶,啓用``heat_domain_admin``用戶管理棧的管理權限:

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

註解:這個命令執行後沒有輸出。


建立 heat_stack_owner 角色:

$ openstack role create heat_stack_owner

image.png


添加``heat_stack_owner`` 角色到``demo`` 項目和用戶,啓用``demo`` 用戶管理棧。

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


註解:這個命令執行後沒有輸出。

註解:你必須添加 heat_stack_owner 角色到每一個管理棧的用戶。


建立 heat_stack_user 角色:

$ openstack role create heat_stack_user

image.png

註解:Orchestration 自動地分配 heat_stack_user角色給在 stack 部署過程當中建立的用戶。

默認狀況下,這個角色會限制 API 的操做。爲了不衝突,請不要爲用戶添加 heat_stack_owner角色。


10.二、安全並配置組件 

10.2.一、安裝軟件包:

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


10.2.二、編輯文件 vi /etc/heat/heat.conf 並完成以下動做:

在 [database] 部分,配置數據庫訪問:

connection = mysql+pymysql://heat:P@ssw0rd@controller/heat


在 [DEFAULT]部分,配置

rpc_backend = rabbit

heat_metadata_server_url = http://controller:8000

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

stack_domain_admin = heat_domain_admin

stack_domain_admin_password = P@ssw0rd

stack_user_domain_name = heat


在[oslo_messaging_rabbit]」部分,配置 「RabbitMQ」 消息隊列訪問:

rabbit_host = controller

rabbit_userid = openstack

rabbit_password = P@ssw0rd


在 [keystone_authtoken] 部分,配置認證服務訪問

[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 = P@ssw0rd

註解:本段爲全新配置,默認配置文檔都沒有這個部分


在 [trustee] 部分,配置認證服務訪問

auth_plugin = password

auth_url = http://controller:35357

username = heat

password = P@ssw0rd

user_domain_name = default


在 [clients_keystone] 部分,配置認證服務訪問

auth_uri = http://controller:35357


在 [ec2authtoken] 部分,配置認證服務訪問

auth_uri = http://controller:5000/v2.0


10.2.三、同步Orchestration數據庫:

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

image.png

註解:忽略輸出中任何不推薦使用的信息。


10.三、完成安裝,啓動 Orchestration 服務並將其設置爲隨系統啓動:

# systemctl enable openstack-heat-api openstack-heat-api-cfn openstack-heat-engine

# systemctl start openstack-heat-api openstack-heat-api-cfn openstack-heat-engine

# systemctl status openstack-heat-api openstack-heat-api-cfn openstack-heat-engine


10.四、驗證操做,在控制節點上執行這些命令:

10.4.一、source 租戶``admin`的憑證腳本:

$ . admin-openrc


10.4.二、列出服務組件,以驗證是否成功啓動並註冊了每一個進程:

$ openstack orchestration service list

image.png

註解:該輸出顯示代表在控制節點上有應該四個``heat-engine``組件。

相關文章
相關標籤/搜索