一、环境简介:
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错误:
![](https://img.laitimes.com/img/9ZDMuAjOiMmIsIjOiQnIsICM38FdsYkRGZkRG9lcvx2bjxiNx8VZ6l2cs0TPB5UeZpmTzMmaNBDOsJGcohVYsR2MMBjVtJWd0ckW65UbM5WOHJWa5kHT20ESjBjUIF2X0hXZ0xCMx81dvRWYoNHLrdEZwZ1Rh5WNXp1bwNjW1ZUba9VZwlHdssmch1mclRXY39CXldWYtlWPzNXZj9mcw1ycz9WL49zZuBnLyATO1MjNxkDM3EDNwAjMwIzLc52YucWbp5GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.png)
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 |
+----------------------------------+