1:创建placement的数据库:
MariaDB [(none)]> CREATE DATABASE placement;
Query OK, 1 row affected (0.004 sec)
2:授权
MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost'
-> IDENTIFIED BY 'huayun';
Query OK, 0 rows affected (0.004 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%'
-> IDENTIFIED BY 'huayun';
Query OK, 0 rows affected (0.003 sec)
3:创建placement-api
创建placement用户
[root@controller01 ~]# openstack user create --domain default --password=huayun placement
赋予placement用户admin的权限
[root@controller01 ~]# openstack role add --project service --user placement admin
创建placement实体
[root@controller01 ~]# openstack service create --name placement --description "Placement API" placement
创建placement的api
[root@controller01 ~]# openstack endpoint create --region RegionOne placement public http://10.100.214.200:8778
[root@controller01 ~]# openstack endpoint create --region RegionOne placement internal http://10.100.214.200:8778
[root@controller01 ~]# openstack endpoint create --region RegionOne placement admin http://10.100.214.200:8778
4. 安装placement软件包
[root@controller01 ~]# yum install openstack-placement-api -y
5:编辑/etc/placement/placement.conf
文件;
[root@controller01 ~]# egrep -v "^#|^$" /etc/placement/placement.conf
[DEFAULT]
[api]
auth_strategy = keystone
[cors]
[keystone_authtoken]
auth_url = http://10.100.214.200:5000/v3
memcached_servers = 10.100.214.200:11211,10.100.214.200:11211,10.100.214.200:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = placement
password = huayun
[oslo_policy]
[placement]
[placement_database]
connection = mysql+pymysql://placement:huayun@10.100.214.200/placement
[profiler]
[root@controller01 ~]# scp /etc/placement/placement.conf 10.100.214.202:/etc/placement/
[root@controller01 ~]# scp /etc/placement/placement.conf 10.100.214.203:/etc/placement/
同步数据库:
[root@controller01 ~]# su -s /bin/sh -c "placement-manage db sync" placement
[root@controller01 ~]# mysql -uroot -phuayun placement -e " 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 |
+------------------------------+
启动服务:
systemctl restart httpd