基于 CentOS 8 手工部署 OpenStack Victoria 版本(五)– 安装 Placement

一种高度抽象且统一的管理方法,让用户和代码能够便捷的使用、管理、监控整个 OpenStack 的系统资源,我们在控制节点安装 Placement

前提条件

  1. 以 root 身份登录数据库
[root@controller ~]# mysql -u root -p
Enter password:   //输入数据库的密码回车
  1. 创建 placement 数据库
MariaDB [(none)]> CREATE DATABASE placement;
Query OK, 1 row affected (0.001 sec)
  1. 为 placement 数据库赋予适当的访问权限
其中的 `openstack` 为设置的密码(生产环境中请勿使用该类弱口令作为密码)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' IDENTIFIED BY 'openstack';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY 'openstack';
  1. 退出数据库
MariaDB [(none)]> exit;
Bye

配置用户和端点

  1. 获取 admin 用户凭据来取得管理员的 CLI 命令权限
[root@controller ~]# . admin-openrc
  1. 创建一个服务用户
为新用户设置一个密码
[root@controller ~]# openstack user create --domain default --password-prompt placement
User Password:
Repeat User Password:

+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 08c2ab9686444fea8fe706d3cd3aeeaa |
| name                | placement                        |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

  1. 将 admin 角色添加到 placement 用户和 service 项目
[root@controller ~]# openstack role add --project service --user placement admin
  1. 创建 Placement API 服务实体
[root@controller ~]# openstack service create --name placement --description "Placement API" placement

+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Placement API                    |
| enabled     | True                             |
| id          | 090332a55d5147ab8bfccf057ee35eb2 |
| name        | placement                        |
| type        | placement                        |
+-------------+----------------------------------+

  1. 创建 Placement API 服务端点
[root@controller ~]# openstack endpoint create --region RegionOne placement public http://controller:8778

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 36173b14511c4a26b3d72adaa4e02047 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 090332a55d5147ab8bfccf057ee35eb2 |
| 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           | dc554c47636d46a5b58ded2589306559 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 090332a55d5147ab8bfccf057ee35eb2 |
| 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           | 82e25bd936074816b7bbc31de3c2e92e |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 090332a55d5147ab8bfccf057ee35eb2 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://controller:8778           |
+--------------+----------------------------------+

安装和配置组件

  1. 安装软件包
[root@controller ~]# yum install openstack-placement-api -y
  1. 编辑配置文件 vim /etc/placement/placement.conf ,并完成以下操作
  • 在 [placement_database] 部分中,配置连接数据库
将 PLACEMENT_DBPASS 替换为 placement 数据库的密码,这里我们设置的密码是 openstack
[placement_database]
# ...
connection = mysql+pymysql://placement:PLACEMENT_DBPASS@controller/placement
  • 在 [api] 和 [keystone_authtoken] 部分中,配置连接身份服务
将 PLACEMENT_PASS 替换为 placement 用户的密码,这里我们设置的密码是 openstack
[api]
# ...
auth_strategy = keystone
# ...
[keystone_authtoken]
# ...
auth_url = http://controller:5000/v3
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = placement
password = PLACEMENT_PASS
  1. 填充 placement 数据库
[root@controller ~]# su -s /bin/sh -c "placement-manage db sync" placement
  1. 编辑配置文件 vim /etc/httpd/conf.d/00-nova-placement-api.conf 启用对 Placement API 的访问
<Directory /usr/bin>
   <IfVersion >= 2.4>
      Require all granted
   </IfVersion>
   <IfVersion < 2.4>
      Order allow,deny
      Allow from all
   </IfVersion>
</Directory>
  1. 重启 httpd 服务,完成安装
[root@controller ~]# systemctl restart httpd
|| 版权声明
作者:Guangran
链接:https://www.rsecc.cn/archives/574.html
声明:如无特别声明本文即为原创文章仅代表个人观点,版权归《广然笔记》所有,欢迎转载,转载请保留原文链接。
THE END
分享
二维码
< <上一篇
下一篇>>
文章目录
关闭
目 录