Article directory
OpenStack (T version)—Placement introduction and installation
OpenStack Placement is a sub-module of the OpenStack Nova project and an independent service used to manage and allocate resources of computing nodes. Its main function is to maintain the resource list of OpenStack computing nodes, including virtual CPU, memory, disk space, etc., and allocate virtual machine instances to appropriate computing nodes.
Prepare
(1)Create database
① Connect to the database in the operating system terminal
[root@controller ~]# mysql -uroot -p000000
②Create placement
database
MariaDB [(none)]> CREATE DATABASE placement;
③Authorization
MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY '000000';
④Exit the database
MariaDB [(none)]> exit
(2) Load environment variables
[root@controller ~]# source admin-openrc.sh
(3)Configure user and endpoints
①Create a planment user
[root@controller ~]# openstack user create --domain default --password-prompt placement
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | ae86e7a743e6445693f85a08d1cd0cf5 |
| name | placement |
| options | {
} |
| password_expires_at | None |
+---------------------+----------------------------------+
# --password-prompt:表示通过交互式方式来设置用户的密码。
②Assign admin role to placement user and service project
[root@controller ~]# openstack role add --project service --user placement admin
③Create Placement API in the service directory
[root@controller ~]# openstack service create --name placement --description "Placement API" placement
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Placement API |
| enabled | True |
| id | 745514229805484d93877bc06c3b9dec |
| name | placement |
| type | placement |
+-------------+----------------------------------+
(4) Create service endpoints of Placement API
[root@controller ~]# openstack endpoint create --region RegionOne placement public http://controller:8778
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | b3d82027aec44ac299221fe434f9f790 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 745514229805484d93877bc06c3b9dec |
| service_name | placement |
| service_type | placement |
| url | http://controller:8778 |
+--------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne placement internal http://controller:8778
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | ae2f75d146b14ed8aee0831a482b4e1f |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 745514229805484d93877bc06c3b9dec |
| service_name | placement |
| service_type | placement |
| url | http://controller:8778 |
+--------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne placement admin http://controller:8778
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | ab895b813d9a4f1f8de3fad91a84e222 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 745514229805484d93877bc06c3b9dec |
| service_name | placement |
| service_type | placement |
| url | http://controller:8778 |
+--------------+----------------------------------+
Install and configure the Placement component
(1)Install software package
[root@controller ~]# yum install -y openstack-placement-api
(2) Edit the file /etc/placement/placement.conf and complete the following operations
①In the [plancement_database] item, configure the database connection
[root@controller ~]# vim /etc/placement/placement.conf
[placement_database]
# ...
connection = mysql+pymysql://placement:000000@controller/placement
② In the [api] and [keystone_authtoken] items, configure identity service access
[api]
# ...
auth_strategy = keystone
[keystone_authtoken]
# ...
auth_url = http://controller:5000/v3 # 指定了keystone服务的URL地址,用于进行身份验证和授权
memcached_servers = controller:11211 #指定了Memcached服务的地址和端口号,用于缓存身份验证令牌和其他数据。
auth_type = password # 指定了身份验证的类型,设置为 password,表示使用用户名和密码进行身份验证。
project_domain_name = Default # 指定了项目域名,用于区分不同的项目之间的资源和权限
user_domain_name = Default # 指定了用户域名,用于区分不同的用户之间的资源和权限。
project_name = service # 指定了项目名称,表示要访问的 OpenStack 项目的名称。
username = placement # 指定了用于身份验证的用户名。
password = 000000 # password:指定了用于身份验证的密码。
(3) Synchronize database
[root@controller ~]# su -s /bin/sh -c "placement-manage db sync" placement
Set access permissions for the /usr/bin directory to allow access to the directory by all users or hosts, depending on the Apache version
[root@controller ~]# vim /etc/httpd/conf.d/00-placement-api.conf
<Directory /usr/bin> # 表示如果 Apache 版本大于等于 2.4,则执行以下语句
<IfVersion >= 2.4>
Require all granted # 表示允许所有用户访问该目录
</IfVersion>
<IfVersion < 2.4> # 表示如果 Apache 版本小于 2.4,则执行以下语句
Order allow,deny # 表示允许 allow 所列出的主机访问该目录
Allow from all # 表示允许所有主机访问该目录
</IfVersion>
</Directory>
The installation is complete
Restart httpd service
[root@controller ~]# systemctl restart httpd
verify
(1) Load environment variables
[root@controller ~]# source admin-openrc.sh
(2) Perform status checks to ensure everything is OK
[root@controller ~]# placement-status upgrade check
+----------------------------------+
| Upgrade Check Results |
+----------------------------------+
| Check: Missing Root Provider IDs |
| Result: Success |
| Details: None |
+----------------------------------+
| Check: Incomplete Consumers |
| Result: Success |
| Details: None |
+----------------------------------+
本文参考视频
:https://www.bilibili.com/video/BV1fL4y1i7NZ?p=7&vd_source=7c7cb4224e0c273f28886e581838b110