5 Openstack-Ussuri-Placement部署-ubuntu1804

Placement具体功能如下:
1 通过HTTP请求来跟踪和过滤资源
2 数据保存在本地数据库中
3 具备丰富的资源管理和筛选策略

5.1 配置Placement数据库

#使用root登陆数据库:

mysql -u root -p

#创建placement数据库:

CREATE DATABASE placement;

#授予对placement数据库的访问权限,刷新退出数据库:

GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' \
IDENTIFIED BY 'placement.123';
GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' \
IDENTIFIED BY 'placement.123';
flush privileges;
exit

5.2 加载管理凭证

source adminrc.sh

5.3 创建Placement相关服务凭证

#创建Placement服务用户,并设置密码为placement.123

openstack user create --domain default --password-prompt placement

#输出

User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | d061f7c67d29416dac324a51d5c93279 |
| name                | placement                        |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

#赋予Placement服务用户服务管理员权限及角色,无输出

openstack role add --project service --user placement admin

#创建Placement服务

openstack service create --name placement --description "Placement API" placement

#输出

+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Placement API                    |
| enabled     | True                             |
| id          | 0d9cdd8f207147bf93b573203c8e78a3 |
| name        | placement                        |
| type        | placement                        |
+-------------+----------------------------------+

5.4 创建Placement API endpoints

#public

openstack endpoint create --region RegionOne placement public http://controller160:8778

#输出

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | d1bc3892f19a4f63b5c48c7ebb75f9b8 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 0d9cdd8f207147bf93b573203c8e78a3 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://controller160:8778        |
+--------------+----------------------------------+

#internal

openstack endpoint create --region RegionOne placement internal http://controller160:8778

#输出

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 1986f413ea1d4ed98059443ffde65b7d |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 0d9cdd8f207147bf93b573203c8e78a3 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://controller160:8778        |
+--------------+----------------------------------+

#admin

openstack endpoint create --region RegionOne placement admin http://controller160:8778

#输出

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | fd18f8b54f4441c6bbe4eacb42d1a415 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 0d9cdd8f207147bf93b573203c8e78a3 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://controller160:8778        |
+--------------+----------------------------------+

5.5 部署与配置Placement

#安装包

apt install placement-api -y

#备份Placement配置

cp /etc/placement/placement.conf /etc/placement/placement.conf.bak
egrep -v "^$|^#" /etc/placement/placement.conf.bak >/etc/placement/placement.conf

#配置Placement配置文件,在对应项底下增加以下字段
#vim /etc/placement/placement.conf

[placement_database]
# ...
connection = mysql+pymysql://placement:placement.123@controller160/placement

[api]
# ...
auth_strategy = keystone

[keystone_authtoken]
# ...
www_authenticate_uri = http://controller160:5000
auth_url = http://controller160:5000
memcached_servers = controller160:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = placement
password = placement.123

#填充placement数据库,无输出

su -s /bin/sh -c "placement-manage db sync" placement

#验证placement数据库是否正常写入:

mysql -h controller160 -uplacement -pplacement.123 -e "use placement;show tables;"

#重启apache服务,并配置开机启动:

systemctl restart apache2.service
systemctl status glance-api.service

5.6 Placement服务验证

#加载管理凭证

source adminrc.sh

#执行状态检查,都为success为正常

placement-status upgrade check

#输出

+----------------------------------+
| Upgrade Check Results            |
+----------------------------------+
| Check: Missing Root Provider IDs |
| Result: Success                  |
| Details: None                    |
+----------------------------------+
| Check: Incomplete Consumers      |
| Result: Success                  |
| Details: None                    |
+----------------------------------+

至此,Placement服务已部署完毕,如有问题请联系我改正,感激不尽!

5.x 部署过程遇到的问题汇总

eg.1 执行su -s /bin/sh -c "placement-manage db sync" placement 报错 
1044, "Access denied for user 'placement'@'%' to database 'placement'"
解决方案:
1 查看授权表,发现权限没有被打开
SELECT host,user,password,Grant_priv,Super_priv FROM mysql.user;
+-----------+-----------+-------------------------------------------+------------+------------+
| host      | user      | password                                  | Grant_priv | Super_priv |
+-----------+-----------+-------------------------------------------+------------+------------+
| localhost | root      | *2683A2B8A9DE120C7B5CC6D45B5F7A2E708FAFCF | Y          | Y          |
| localhost | keystone  | *2431959D1DBB9DEF2BB0E90F0C08387220989A5F | N          | N          |
| %         | keystone  | *2431959D1DBB9DEF2BB0E90F0C08387220989A5F | N          | N          |
| %         | root      | *2683A2B8A9DE120C7B5CC6D45B5F7A2E708FAFCF | N          | N          |
| localhost | glance    | *4BED54445326D0D3477C30025D66AF8911CA854F | N          | N          |
| %         | glance    | *4BED54445326D0D3477C30025D66AF8911CA854F | N          | N          |
| localhost | placement | *7F75AD3C141B7CD8E66685A5505B1630D896092F | N          | N          |
| %         | placement | *7F75AD3C141B7CD8E66685A5505B1630D896092F | N          | N          |
+-----------+-----------+-------------------------------------------+------------+------------+
2 更新用户权限:
UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root';
或者 
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'devops';
FLUSH PRIVILEGES;
+-----------+-----------+-------------------------------------------+------------+------------+
| host      | user      | password                                  | Grant_priv | Super_priv |
+-----------+-----------+-------------------------------------------+------------+------------+
| localhost | root      | *2683A2B8A9DE120C7B5CC6D45B5F7A2E708FAFCF | Y          | Y          |
| localhost | keystone  | *2431959D1DBB9DEF2BB0E90F0C08387220989A5F | N          | N          |
| %         | keystone  | *2431959D1DBB9DEF2BB0E90F0C08387220989A5F | N          | N          |
| %         | root      | *2683A2B8A9DE120C7B5CC6D45B5F7A2E708FAFCF | Y          | Y          |
| localhost | glance    | *4BED54445326D0D3477C30025D66AF8911CA854F | N          | N          |
| %         | glance    | *4BED54445326D0D3477C30025D66AF8911CA854F | N          | N          |
| localhost | placement | *7F75AD3C141B7CD8E66685A5505B1630D896092F | N          | N          |
| %         | placement | *7F75AD3C141B7CD8E66685A5505B1630D896092F | N          | N          |
+-----------+-----------+-------------------------------------------+------------+------------+

eg2.root@controller160:~# placement-status upgrade check
SQL connection failed. 10 attempts left.
SQL connection failed. 9 attempts left.
SQL connection failed. 8 attempts left.
SQL connection failed. 7 attempts left.
SQL connection failed. 6 attempts left.
SQL connection failed. 5 attempts left.
解决方案:
1 检查mysql 3306是否启用
2 检查connection URL是否配置及密码是否正确
3 检查本机hosts文件是否有录入各节点对应的host列表

eg3.查看Resource Provider:资源提供者,实际提供资源的实体,例如:Compute Node、Storage Pool、IP Pool 等。 
Inventory:资源清单,资源提供者所拥有的资源清单,例如:Compute Node 拥有的 vCPU、Disk、RAM 等 inventories。
解决方案:
yum install python3-osc-placement.noarch
[root@controller160 ~]# export OS_PLACEMENT_API_VERSION=1.28
[root@controller160 ~]# openstack resource class list
+----------------------------+
| name                       |
+----------------------------+
| VCPU                       |
| MEMORY_MB                  |
| DISK_GB                    |
| PCI_DEVICE                 |
| SRIOV_NET_VF               |
| NUMA_SOCKET                |
| NUMA_CORE                  |
| NUMA_THREAD                |
| NUMA_MEMORY_MB             |
| IPV4_ADDRESS               |
| VGPU                       |
| VGPU_DISPLAY_HEAD          |
| NET_BW_EGR_KILOBIT_PER_SEC |
| NET_BW_IGR_KILOBIT_PER_SEC |
| PCPU                       |
| MEM_ENCRYPTION_CONTEXT     |
| FPGA                       |
| PGPU                       |
+----------------------------+
[root@controller160 ~]# openstack resource provider list
+--------------------------------------+------------+------------+--------------------------------------+----------------------+
| uuid                                 | name       | generation | root_provider_uuid                   | parent_provider_uuid |
+--------------------------------------+------------+------------+--------------------------------------+----------------------+
| f4021a77-37d8-4325-84a4-b47b0443aa02 | compute163 |          2 | f4021a77-37d8-4325-84a4-b47b0443aa02 | None                 |
| f76880fb-90b7-47fc-8105-68f8f3e08914 | compute164 |          2 | f76880fb-90b7-47fc-8105-68f8f3e08914 | None                 |
+--------------------------------------+------------+------------+--------------------------------------+----------------------+
[root@controller160 ~]# openstack resource provider inventory list f4021a77-37d8-4325-84a4-b47b0443aa02
+----------------+------------------+----------+----------+----------+-----------+-------+
| resource_class | allocation_ratio | min_unit | max_unit | reserved | step_size | total |
+----------------+------------------+----------+----------+----------+-----------+-------+
| VCPU           |             16.0 |        1 |        1 |        0 |         1 |     1 |
| MEMORY_MB      |              1.5 |        1 |     1826 |      512 |         1 |  1826 |
| DISK_GB        |              1.0 |        1 |       14 |        0 |         1 |    14 |
+----------------+------------------+----------+----------+----------+-----------+-------+
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值