天天看點

openstack(四)元件部署Placement

一、環境簡介:

OS:CentOS Linux release 7.7.1908 (Core)

openstack:train

環境有限目前隻跑單台

mysql複用,rabbitmq和memcached

角色 ip位址 主機名
conroller1 192.168.39.239 controller.local
conroller1 192.168.39.239 controller.local
haproxy 192.168.39.241 haproxy.local vip 192.168.39.238
node1 192.168.39.240 node1.local
mysql 192.168.39.242 mysql.local

參考文檔:

https://docs.openstack.org/

stein版本拆分出來的一個元件,作用:起到node節點的可用資源統計,後被nova等服務調用

一、前提條件:在安裝和配置展示位置服務之前,必須建立資料庫,服務憑證和API端點

1、建立資料庫,并授權:

MariaDB [(none)]>  CREATE DATABASE placement;
Query OK, 1 row affected (0.000 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' \
    ->   IDENTIFIED BY 'placement123';
Query OK, 0 rows affected (0.000 sec)
           

二、配置使用者和端點

1、建立使用者

[[email protected] ~]# openstack user create --domain default --password-prompt placement
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 301b7a6262b4415e8f68e3ee67bb8149 |
| name                | placement                        |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
           

2、使用管理者角色将Placement使用者添加到服務項目中

3、在服務中建立Placement API條目

[[email protected] ~]# openstack service create --name placement   --description "Placement API" placement
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Placement API                    |
| enabled     | True                             |
| id          | a02f889f26184efab1d9a03fc7f66f43 |
| name        | placement                        |
| type        | placement                        |
+-------------+----------------------------------+
           

4、建立Placement API服務端點

[[email protected] ~]# openstack endpoint create --region RegionOne \
>   placement public http://openstack-vip.local:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | a2a3d5f6ad454d5b92101d598020fba4 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | a02f889f26184efab1d9a03fc7f66f43 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://openstack-vip.local:8778  |
+--------------+----------------------------------+
[[email protected] ~]# openstack endpoint create --region RegionOne \
>   placement internal http://openstack-vip.local:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 44bc4f425d484e73bd5e058939c03cdc |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | a02f889f26184efab1d9a03fc7f66f43 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://openstack-vip.local:8778  |
+--------------+----------------------------------+
[[email protected] ~]# openstack endpoint create --region RegionOne \
>   placement admin http://openstack-vip.local:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 50d2e489ea814f98bd8f2b09a1ab90ef |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | a02f889f26184efab1d9a03fc7f66f43 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://openstack-vip.local:8778  |
+--------------+----------------------------------+
[[email protected] ~]# openstack endpoint list
+----------------------------------+-----------+--------------+--------------+---------+-----------+-------------------------------------+
| ID                               | Region    | Service Name | Service Type | Enabled | Interface | URL                                 |
+----------------------------------+-----------+--------------+--------------+---------+-----------+-------------------------------------+
| 44bc4f425d484e73bd5e058939c03cdc | RegionOne | placement    | placement    | True    | internal  | http://openstack-vip.local:8778     |
| 50d2e489ea814f98bd8f2b09a1ab90ef | RegionOne | placement    | placement    | True    | admin     | http://openstack-vip.local:8778     |
| 6ad79472f34c46e48ec15b542f28ccf2 | RegionOne | keystone     | identity     | True    | admin     | http://openstack-vip.local:5000/v3/ |
| 82cfae061b9c48eda51e83b9263ddf9b | RegionOne | glance       | image        | True    | internal  | http://openstack-vip.local:9292     |
| 85458d74f2604f00b42d7ecfb210026e | RegionOne | keystone     | identity     | True    | public    | http://openstack-vip.local:5000/v3/ |
| 9661a293823c41daa852a5b368014637 | RegionOne | glance       | image        | True    | public    | http://openstack-vip.local:9292     |
| a2a3d5f6ad454d5b92101d598020fba4 | RegionOne | placement    | placement    | True    | public    | http://openstack-vip.local:8778     |
| e3b11d6690094c04975ea37c25ae3775 | RegionOne | glance       | image        | True    | admin     | http://openstack-vip.local:9292     |
| fba547d4e9aa452ca4e5eab8cf261b74 | RegionOne | keystone     | identity     | True    | internal  | http://openstack-vip.local:5000/v3/ |
+----------------------------------+-----------+--------------+--------------+---------+-----------+-------------------------------------+
           

haproxy也要開通vip的8778端口。

三、安裝和配置的部件

1、安裝軟體包:

2、編輯/etc/placement/placement.conf檔案并完成以下操作

[placement_database]
#
# The *Placement API Database* is a the database used with the placement
# service. If the connection option is not set, the placement service will
# not start.
connection = mysql+pymysql://placement:[email protected]-vip.local/placement

[api]
#
auth_strategy = keystone

[keystone_authtoken]
auth_url = http://openstack-vip.local:5000/v3
memcached_servers = openstack-vip.local:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = placement
password = placement
           

3、初始化資料庫:

4、官方提示:由于包裝錯誤,您必須通過将以下配置添加到來啟用對Placement API的通路 /etc/httpd/conf.d/00-nova-placement-api.conf:

<Directory /usr/bin>
   <IfVersion >= 2.4>
      Require all granted
   </IfVersion>
   <IfVersion < 2.4>
      Order allow,deny
      Allow from all
   </IfVersion>
</Directory>
           

如果不加會報403錯誤:

openstack(四)元件部署Placement

5、啟動apache并測試:

[[email protected] ~]# systemctl restart httpd
[[email protected] ~]# curl 192.168.39.238:8778
{"versions": [{"status": "CURRENT", "min_version": "1.0", "max_version": "1.36", "id": "v1.0", "links": [{"href": "", "rel": "self"}]}]}

[[email protected] ~]#  placement-status upgrade check
+----------------------------------+
| Upgrade Check Results            |
+----------------------------------+
| Check: Missing Root Provider IDs |
| Result: Success                  |
| Details: None                    |
+----------------------------------+
| Check: Incomplete Consumers      |
| Result: Success                  |
| Details: None                    |
+----------------------------------+
           

繼續閱讀