openstack v版 centos stream 8 手工搭建——Placement搭建(四)
本文最后更新于85 天前,其中的信息可能已经过时,如有错误请发送邮件到2639131093@qq.com

注意

1.本教程为openstack 搭建平台victoria 版,虚拟机为centos stream 8

2.本教程设计内容非常多,很复杂,但也很有技巧,请注意每一步,我说可以更改的地方可以更改,其余建议和我一样

3.内容板块大体包括:基础环境设置, keystone组建安装,glance组建安装,placement组建安装,nova组建安装,neutron组建安装,dashboard组建安装

4.密码约定:本文所有和数据库及消息队列相关的密码统一设定 rootroot,openstack 组件用户密码统一设定 redhat

5.学习此章节,你需要了解的知识:数据库sql中dcl用户管理的知识,linux基础命令,openstack基础命令

6.官方网址:

OpenStack Docs: Install and configure Placement for Red Hat Enterprise Linux and CentOS

7.环境配置:

环境用到 2台 虚拟机,单网卡,并为其配置 静态 IP 及 DNS

主机名ip网关DNScpu/内存磁盘角色备注
controller192.168.100.128192.168.100.2114.114.114.1144c/6g100g控制节点开启虚拟化引擎
compute192.168.100.129192.168.100.2114.114.114.1144c/6g100g计算节点开启虚拟化引擎

建库及授权(仅控制节点)

[root@controller ~(admin)]$ mysql -u root -prootroot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 38
Server version: 10.3.28-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database placement;
Query OK, 1 row affected (0.013 sec)

MariaDB [(none)]> grant all privileges on placement.* to 'placement'@'localhost' identified by 'rootroot';
##为placement用户在本地对placement数据库所有对象给予全部权限,指定密码为rootroot
Query OK, 0 rows affected (0.007 sec)

MariaDB [(none)]> grant all privileges on placement.* to 'placement'@'%' identified by 'rootroot';
##为placement用户在任何地点对placement数据库所有对象给予全部权限,指定密码为rootroot
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| glance             |
| information_schema |
| keystone           |
| mysql              |
| performance_schema |
| placement          |
+--------------------+
6 rows in set (0.012 sec)

创建用户及关联角色(仅控制节点)

[root@controller ~(admin)]$ source keystonerc_admin
[root@controller ~(admin)]$ openstack user create --domain default --password-prompt placement 
User Password:          ##密码依旧redhat
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 3e66c60b57354be89ac3d5e85fb2f485 |
| name                | placement                        |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
[root@controller ~(admin)]$ openstack role add --project service --user placement admin
##placement用户作为admin角色绑定service项目
[root@controller ~(admin)]$ openstack role assignment list --user placement
##查看placement用户的项目绑定
+----------------------------------+----------------------------------+-------+----------------------------------+--------+--------+-----------+
| Role                             | User                             | Group | Project                          | Domain | System | Inherited |
+----------------------------------+----------------------------------+-------+----------------------------------+--------+--------+-----------+
| 35eb6220a4b14503b1672de9f0ffcae9 | 3e66c60b57354be89ac3d5e85fb2f485 |       | 578eca45e7e549858c97314e3f2ec1e3 |        |        | False     |
+----------------------------------+----------------------------------+-------+----------------------------------+--------+--------+-----------+
[root@controller ~(admin)]$ openstack user list
+----------------------------------+-----------+
| ID                               | Name      |
+----------------------------------+-----------+
| cda7fc3c6ff74289b8f40e149d397710 | admin     |
| 9688822b0dcd41929430ab48335fceb2 | myuser    |
| 2c401bee20a245ac88cf4629ed4ee440 | glance    |
| 3e66c60b57354be89ac3d5e85fb2f485 | placement |
+----------------------------------+-----------+

创建服务及注册API(仅控制节点)

[root@controller ~(admin)]$ openstack service create --name placement --description "Placement API" placement
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Placement API                    |
| enabled     | True                             |
| id          | 3a634a06b4864190bb69cf15bea97a19 |
| name        | placement                        |
| type        | placement                        |
+-------------+----------------------------------+
[root@controller ~(admin)]$ openstack endpoint create --region RegionOne placement public http://controller:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | deb57dd079d1434b8ba2560d13aa8757 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 3a634a06b4864190bb69cf15bea97a19 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://controller:8778           |
+--------------+----------------------------------+
[root@controller ~(admin)]$ openstack endpoint create --region RegionOne placement internal http://controller:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 5b07ad93e892406da4bac5dd0338e3cf |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 3a634a06b4864190bb69cf15bea97a19 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://controller:8778           |
+--------------+----------------------------------+
[root@controller ~(admin)]$ openstack endpoint create --region RegionOne placement admin http://controller:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | dc77bcd015344f4c9406495cba143841 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 3a634a06b4864190bb69cf15bea97a19 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://controller:8778           |
+--------------+----------------------------------+
[root@controller ~(admin)]$ openstack endpoint list
+----------------------------------+-----------+--------------+--------------+---------+-----------+----------------------------+
| ID                               | Region    | Service Name | Service Type | Enabled | Interface | URL                        |
+----------------------------------+-----------+--------------+--------------+---------+-----------+----------------------------+
| 0347ebc573814319b61f2b061d12a76d | RegionOne | glance       | image        | True    | internal  | http://controller:9292     |
| 5b07ad93e892406da4bac5dd0338e3cf | RegionOne | placement    | placement    | True    | internal  | http://controller:8778     |
| 6395f0c625274f4b90e9137f38e93882 | RegionOne | keystone     | identity     | True    | admin     | http://controller:5000/v3/ |
| 810eab1198cc44dc8a2f4de04d227da4 | RegionOne | glance       | image        | True    | admin     | http://controller:9292     |
| 861dc3b20d324e4892e506058c2c7b1f | RegionOne | glance       | image        | True    | public    | http://controller:9292     |
| ca45bbfeef81436688974a8d04e75d88 | RegionOne | keystone     | identity     | True    | internal  | http://controller:5000/v3/ |
| dc77bcd015344f4c9406495cba143841 | RegionOne | placement    | placement    | True    | admin     | http://controller:8778     |
| deb57dd079d1434b8ba2560d13aa8757 | RegionOne | placement    | placement    | True    | public    | http://controller:8778     |
| ff9d2f5be3c54026a27d8661b68460b9 | RegionOne | keystone     | identity     | True    | public    | http://controller:5000/v3/ |
+----------------------------------+-----------+--------------+--------------+---------+-----------+----------------------------+

安装placement(仅控制节点)

[root@controller ~(admin)]$ yum install openstack-placement-api -y
上次元数据过期检查:3:54:32 前,执行于 2024年08月28日 星期三 02时44分32秒。
依赖关系解决。
================================================================================================================================================
 软件包                                      架构                   版本                        仓库                                       大小
================================================================================================================================================
安装:
 openstack-placement-api                     noarch                 4.0.0-1.el8                 centos-openstack-victoria                  12 k
安装依赖关系:
 openstack-placement-common                  noarch                 4.0.0-1.el8                 centos-openstack-victoria                  25 k
 python3-microversion-parse                  noarch                 1.0.1-1.el8                 centos-openstack-victoria                  32 k
 python3-os-resource-classes                 noarch                 1.0.0-1.el8                 centos-openstack-victoria                  17 k
 python3-os-traits                           noarch                 2.4.0-2.el8                 centos-openstack-victoria                  43 k
 python3-placement                           noarch                 4.0.0-1.el8                 centos-openstack-victoria                 250 k

事务概要
================================================================================================================================================
安装  6 软件包

总下载:379 k
安装大小:1.2 M
下载软件包:
(1/6): openstack-placement-common-4.0.0-1.el8.noarch.rpm                                                         86 kB/s |  25 kB     00:00    
(2/6): openstack-placement-api-4.0.0-1.el8.noarch.rpm                                                            38 kB/s |  12 kB     00:00    
(3/6): python3-os-resource-classes-1.0.0-1.el8.noarch.rpm                                                        62 kB/s |  17 kB     00:00    
(4/6): python3-os-traits-2.4.0-2.el8.noarch.rpm                                                                 159 kB/s |  43 kB     00:00    
(5/6): python3-microversion-parse-1.0.1-1.el8.noarch.rpm                                                         54 kB/s |  32 kB     00:00    
(6/6): python3-placement-4.0.0-1.el8.noarch.rpm                                                                 445 kB/s | 250 kB     00:00    
------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                            333 kB/s | 379 kB     00:01     
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                                                                 1/1 
  安装    : python3-os-traits-2.4.0-2.el8.noarch                                                                                            1/6 
  安装    : python3-os-resource-classes-1.0.0-1.el8.noarch                                                                                  2/6 
  安装    : python3-microversion-parse-1.0.1-1.el8.noarch                                                                                   3/6 
  安装    : python3-placement-4.0.0-1.el8.noarch                                                                                            4/6 
  运行脚本: openstack-placement-common-4.0.0-1.el8.noarch                                                                                   5/6 
  安装    : openstack-placement-common-4.0.0-1.el8.noarch                                                                                   5/6 
  安装    : openstack-placement-api-4.0.0-1.el8.noarch                                                                                      6/6 
  运行脚本: openstack-placement-api-4.0.0-1.el8.noarch                                                                                      6/6 
  验证    : openstack-placement-api-4.0.0-1.el8.noarch                                                                                      1/6 
  验证    : openstack-placement-common-4.0.0-1.el8.noarch                                                                                   2/6 
  验证    : python3-microversion-parse-1.0.1-1.el8.noarch                                                                                   3/6 
  验证    : python3-os-resource-classes-1.0.0-1.el8.noarch                                                                                  4/6 
  验证    : python3-os-traits-2.4.0-2.el8.noarch                                                                                            5/6 
  验证    : python3-placement-4.0.0-1.el8.noarch                                                                                            6/6 

已安装:
  openstack-placement-api-4.0.0-1.el8.noarch      openstack-placement-common-4.0.0-1.el8.noarch  python3-microversion-parse-1.0.1-1.el8.noarch 
  python3-os-resource-classes-1.0.0-1.el8.noarch  python3-os-traits-2.4.0-2.el8.noarch           python3-placement-4.0.0-1.el8.noarch          

完毕!

编辑配置文件(仅控制节点)


##老方法 很多~
[placement_database]
connection = mysql+pymysql://placement:rootroot@controller/placement  ##大约510行

[api]
auth_strategy = keystone                 ##大约190行

[keystone_authtoken]
auth_url = http://controller:5000/v3                           ##大约240行
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = placement
password = redhat

初始化数据库(仅控制节点)

[root@controller ~(admin)]$ su -s /bin/sh -c "placement-manage db sync" placement
##初始化placement 库
[root@controller ~(admin)]$ mysql -u root -prootroot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 41
Server version: 10.3.28-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| glance             |
| information_schema |
| keystone           |
| mysql              |
| performance_schema |
| placement          |
+--------------------+
6 rows in set (0.001 sec)

MariaDB [(none)]> use placement;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [placement]> show tables;
+------------------------------+
| Tables_in_placement          |
+------------------------------+
| alembic_version              |
| allocations                  |
| consumers                    |
| inventories                  |
| placement_aggregates         |
| projects                     |
| resource_classes             |
| resource_provider_aggregates |
| resource_provider_traits     |
| resource_providers           |
| traits                       |
| users                        |
+------------------------------+
12 rows in set (0.000 sec)

重启服务并测试(仅控制节点)

[root@controller ~(admin)]$ systemctl restart httpd
[root@controller ~(admin)]$ placement-status upgrade check
+----------------------------------+
| Upgrade Check Results            |
+----------------------------------+
| Check: Missing Root Provider IDs |
| Result: Success                  |
| Details: None                    |
+----------------------------------+
| Check: Incomplete Consumers      |
| Result: Success                  |
| Details: None                    |
+----------------------------------+
文末附加内容
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇