OpenStack-Train版安装Placement放置服务

OpenStack-Train版安装Placement放置服务

1.创建数据库

[root@controller ~]# mysql
MariaDB [(none)]> CREATE DATABASE placement;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' IDENTIFIED BY 'PLACEMENT_ZHL';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY 'PLACEMENT_ZHL';

2. 创建placement用户

[root@controller ~]# openstack user create --domain default --password PLACEMENT_ZHL placement
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 949b783bed4a4a59ab1a1e859e9ebb05 |
| name                | placement                        |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

3. 创建placement服务实体

[root@controller ~]# openstack service create --name placement --description "Placement API" placement
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Placement API                    |
| enabled     | True                             |
| id          | 9ce7600f5b2b4b1e84c72530a7759845 |
| name        | placement                        |
| type        | placement                        |
+-------------+----------------------------------+

创建placement服务访问端点

[root@controller ~]# openstack endpoint create --region RegionOne placement public http://controller:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | c8aaff1cb2a643ffbef8db7e9eea74c1 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 9ce7600f5b2b4b1e84c72530a7759845 |
| 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           | ea7d331296a346d09042ba8dff22e135 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 9ce7600f5b2b4b1e84c72530a7759845 |
| 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           | e72da71692084241a09d7ec1e882fbd3 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 9ce7600f5b2b4b1e84c72530a7759845 |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://controller:8778           |
+--------------+----------------------------------+

5. 安装placement软件包

yum install openstack-placement-api -y

6. 修改配置文件

[root@controller ~]# cp /etc/placement/placement.conf /etc/placement/placement.conf.bak
[root@controller ~]# grep -Ev '^$|#' /etc/placement/placement.conf.bak > /etc/placement/placement.conf
[root@controller ~]# openstack-config --set  /etc/placement/placement.conf placement_database connection mysql+pymysql://placement:PLACEMENT_ZHL@controller/placement
 
[root@controller ~]# vim /etc/placement/placement.conf
[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_ZHL
 
填充placement数据库
[root@controller ~]# su -s /bin/sh -c "placement-manage db sync" placement
 
修改placement的apache配置文件(官方文档坑点之一,这个步骤官方文档没有提到,如果不做,后面计算服务检查时将会报错)
[root@controller ~]# vim /etc/httpd/conf.d/00-placement-api.conf
.....
  
   = 2.4>
     Require all granted
  
  
     Order allow,deny
     Allow from all
  
 
.....

7. 重启apache服务

[root@controller ~]# systemctl restart httpd

检查服务是否启动成功,使用netstat -tnlup查看端口情况,如果存在8778的端口,表示placement服务启动成功

[root@controller ~]# lsof -i:8778
COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
httpd   11116   root    6u  IPv6  53596      0t0  TCP *:8778 (LISTEN)
httpd   11125 apache    6u  IPv6  53596      0t0  TCP *:8778 (LISTEN)
httpd   11126 apache    6u  IPv6  53596      0t0  TCP *:8778 (LISTEN)
httpd   11127 apache    6u  IPv6  53596      0t0  TCP *:8778 (LISTEN)
httpd   11128 apache    6u  IPv6  53596      0t0  TCP *:8778 (LISTEN)
httpd   11129 apache    6u  IPv6  53596      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"}]}]}

8. 检查健康状态

[root@controller ~]# placement-status upgrade check

你可能感兴趣的:(OpenStack)