placement服务安装配置(controller)
###1. 创建数据库
mysql
CREATE DATABASE placement;
GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' IDENTIFIED BY 'PLACEMENT_DBPASS';
GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY 'PLACEMENT_DBPASS';
flush privileges;
exit
###2.创建服务用户
openstack user create --domain default --password-prompt placement
User Password: (placement)
Repeat User Password: (placement)
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 1fcb401b0e66471c8676f5707ace9226 |
| name | placement |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+
###3.角色授权
openstack role add --project service --user placement admin
###4.创建placement api
openstack service create --name placement --description "Placement API" placement
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Placement API |
| enabled | True |
| id | bf73f66c601d4f65b9eba63c031350dc |
| name | placement |
| type | placement |
+-------------+----------------------------------+
openstack endpoint create --region RegionOne placement public http://controller:8778
openstack endpoint create --region RegionOne placement internal http://controller:8778
openstack endpoint create --region RegionOne placement admin http://controller:8778
[root@controller ~(keystone)]# openstack endpoint list | grep placement
| 6114f1639b6f4202bbc54ef58704d59e | RegionOne | placement | placement | True | internal | http://controller:8778 |
| a53f092944d64e0d9db8695ed9a7094e | RegionOne | placement | placement | True | public | http://controller:8778 |
| e86798b7f4244c9683aaa5e6fb513122 | RegionOne | placement | placement | True | admin | http://controller:8778 |
###5.安装glance软件包
yum --enablerepo=centos-openstack-train,epel -y install openstack-placement-api
###6./etc/placement/placement.conf 配置
[root@controller ~(keystone)]# egrep -v "^$|^#" /etc/placement/placement.conf
[DEFAULT]
[api]
auth_strategy = keystone
[cors]
[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
[oslo_policy]
[placement]
[placement_database]
connection = mysql+pymysql://placement:PLACEMENT_DBPASS@controller/placement
[profiler]
##### 编辑 /etc/httpd/conf.d/00-placement-api.conf
添加
.....
<Directory /usr/bin>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
</Directory>
.....
###7.填充数据库
su -s /bin/sh -c "placement-manage db sync" placement
###8.重启服务
systemctl restart httpd
###9.验证
##检查服务是否启动成功,使用netstat -tnlup查看端口情况
[root@controller ~]# lsof -i:8778
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 25799 root 6u IPv6 89336 0t0 TCP *:8778 (LISTEN)
httpd 26075 apache 6u IPv6 89336 0t0 TCP *:8778 (LISTEN)
httpd 27158 apache 6u IPv6 89336 0t0 TCP *:8778 (LISTEN)
httpd 27165 apache 6u IPv6 89336 0t0 TCP *:8778 (LISTEN)
httpd 27181 apache 6u IPv6 89336 0t0 TCP *:8778 (LISTEN)
httpd 27186 apache 6u IPv6 89336 0t0 TCP *:8778 (LISTEN)
httpd 27194 apache 6u IPv6 89336 0t0 TCP *:8778 (LISTEN)
httpd 27197 apache 6u IPv6 89336 0t0 TCP *:8778 (LISTEN)
httpd 27426 apache 6u IPv6 89336 0t0 TCP *:8778 (LISTEN)
httpd 27427 apache 6u IPv6 89336 0t0 TCP *:8778 (LISTEN)
httpd 27448 apache 6u IPv6 89336 0t0 TCP *:8778 (LISTEN)
#### 进一步检查,使用命令:curl http://controller:8778,直接访问placement的API地址,看是否能返回json
[root@controller ~]# curl http://controller:8778
{"versions": [{"status": "CURRENT", "min_version": "1.0", "max_version": "1.36", "id": "v1.0", "links": [{"href": "", "rel": "self"}]}]}[root@controller ~]#
###查看健康状态
[root@controller ~(keystone)]# placement-status upgrade check
+----------------------------------+
| Upgrade Check Results |
+----------------------------------+
| Check: Missing Root Provider IDs |
| Result: Success |
| Details: None |
+----------------------------------+
| Check: Incomplete Consumers |
| Result: Success |
| Details: None |
+----------------------------------+