四、安装placement服务(在controller执行)
1、创建placement数据库
[root@controller ~]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 25 Server version: 10.3.20-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.000 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' IDENTIFIED BY '000000'; Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY '000000'; Query OK, 0 rows affected (0.001 sec) |
2、获取admin凭证
[root@controller ~]# source admin-openrc |
3、创建placement服务用户
# 创建一个名为placement的用户 [root@controller ~]# openstack user create --domain default --password-prompt placement User Password: Repeat User Password: +---------------------+----------------------------------+ | +---------------------+----------------------------------+ | domain_id | default | | enabled | True | | id | 177aa1815f7746e0a1e1f534b249c30b | | name | placement | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+ # 将placement用户添加到具有admin角色的服务项目 [root@controller ~]# openstack role add --project service --user placement admin
4、创建placementAPI条目
[root@controller ~]# openstack service create --name placement --description "Placement API" placement +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ |
|
| description | Placement API | enabled | True | id | 243815997a0a4500a904ec2d39b5a346 | name | placement | type | placement |
| | | | | |
+-------------+----------------------------------+ |
5、创建placement服务端点
[root@controller ~]# openstack endpoint create --region RegionOne placement public http://controller:8778 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 9bfb9b75aaf746bdacb72d94c5378939 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 243815997a0a4500a904ec2d39b5a346 | | service_name | placement | | service_type | placement | | url | http://controller:8778 | +--------------+----------------------------------+ [root@controller ~]# openstack endpoint create --region RegionOne placement internal http://controller:8778 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | | | | | | | service_name | placement | service_type | placement | url | http://controller:8778 +--------------+----------------------------------+ [root@controller ~]# openstack endpoint create --region RegionOne placement admin http://controller:8778 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | | | | | | | | | +--------------+----------------------------------+
6、安装placement服务
[root@controller ~]# yum install openstack-placement-api -y
7、修改placement配置文件
编辑/etc/placement/placement.conf文件,并完成以下操作:
在 [placement_database]本节中,配置数据库访问:
[placement_database] connection = mysql+pymysql://placement:000000@controller/placement
# 使用下面的命令可直接修改 openstack-config --set /etc/placement/placement.conf placement_database connection mysql+pymysql://placement:000000@controller/placement |
在 [api]和 [keystone_authtoken]部分,配置身份服务访问:
[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 = 000000 # 使用下面的命令可直接修改 openstack-config --set /etc/placement/placement.conf api auth_strategy keystone openstack-config --set /etc/placement/placement.conf keystone_authtoken auth_url http://controller:5000/v3 openstack-config --set /etc/placement/placement.conf keystone_authtoken memcached_servers controller:11211 openstack-config --set /etc/placement/placement.conf keystone_authtoken auth_type password openstack-config --set /etc/placement/placement.conf keystone_authtoken project_domain_name Default openstack-config --set /etc/placement/placement.conf keystone_authtoken user_domain_name Default openstack-config --set /etc/placement/placement.conf keystone_authtoken project_name service openstack-config --set /etc/placement/placement.conf keystone_authtoken username placement openstack-config --set /etc/placement/placement.conf keystone_authtoken password 000000
8、同步placement数据库
[root@controller ~]# su -s /bin/sh -c "placement-manage db sync" placement # 忽略此命令输出的任何启用消息 |
9、启动http服务
[root@controller ~]# systemctl restart httpd |
( 1-12)在controller执行
1、创建nova数据库
[root@controller ~]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 14 Server version: 10.3.20-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 nova_api; Query OK, 1 row affected (0.001 sec) MariaDB [(none)]> CREATE DATABASE nova; Query OK, 1 row affected (0.000 sec) MariaDB [(none)]> CREATE DATABASE nova_cell0; Query OK, 1 row affected (0.000 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON IDENTIFIED BY '000000'; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON '000000'; Query OK, 0 rows affected (0.000 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON IDENTIFIED BY '000000'; Query OK, 0 rows affected (0.000 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON '000000'; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON IDENTIFIED BY '000000'; Query OK, 0 rows affected (0.000 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON BY '000000'; Query OK, 0 rows affected (0.001 sec)
2、获取admin凭证
[root@controller ~]# source admin-openrc |
3、创建nova用户
[root@controller ~]# openstack user create --domain default --password-prompt nova User Password: Repeat User Password: +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | domain_id | default | | enabled | True | | id | 52839842e36545a990a2592b086eaf7a | | name | nova | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+ # 为nova用户添加admin角色权限 [root@controller ~]# openstack role add --project service --user nova admin # 创建nova服务实体 [root@controller ~]# openstack service create --name nova --description "OpenStack Compute" compute +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Compute | | enabled | True | | id | 44d6d5f37d5b48e3ac1c276d0c0ffe78 | | name | nova | | type | compute | +-------------+----------------------------------+
4、配置computeAPI服务端点
[root@controller ~]# openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 543f7db42c514401a4b072a495dab6ef | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 44d6d5f37d5b48e3ac1c276d0c0ffe78 | | service_name | nova | | service_type | compute | | url | http://controller:8774/v2.1 | +--------------+----------------------------------+ [root@controller ~]# openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | ff42a2c6f9934983846173bddd485e27 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 44d6d5f37d5b48e3ac1c276d0c0ffe78 | | service_name | nova | | service_type | compute | | url | http://controller:8774/v2.1 | +--------------+----------------------------------+ [root@controller ~]# openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 6f8ac70bcb40407e9d184091399772f5 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 44d6d5f37d5b48e3ac1c276d0c0ffe78 | | service_name | nova | | service_type | compute | | url | http://controller:8774/v2.1 | +--------------+----------------------------------+ |
5、安装nova和相关服务
[root@controller ~]# yum install openstack-nova-api openstack-nova-conductor openstack-nova-novncproxy openstack-nova-scheduler -y |
6、修改nova配置文件
编辑/etc/nova/nova.conf文件,并完成以下操作
在 [DEFAULT]部分,只启用计算和元数据api:
[DEFAULT] enabled_apis = osapi_compute,metadata
# 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf DEFAULT enabled_apis osapi_compute,metadata |
在 [api_database]和 [database]部分,配置数据库访问:
[api_database] connection = mysql+pymysql://nova:000000@controller/nova_api
[database] connection = mysql+pymysql://nova:000000@controller/nova
# 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf api_database connection mysql+pymysql://nova:000000@controller/nova_api openstack-config --set /etc/nova/nova.conf database connection mysql+pymysql://nova:000000@controller/nova |
在 [DEFAULT]部分,配置RabbitMQ消息队列访问:
[DEFAULT] transport_url = rabbit://openstack:000000@controller:5672/
# 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf DEFAULT transport_url rabbit://openstack:000000@controller:5672/ |
在 [api]和 [keystone_authtoken]部分中,配置身份服务访问:
[api] auth_strategy = keystone [keystone_authtoken] www_authenticate_uri = http://controller:5000/ auth_url = http://controller:5000/ memcached_servers = controller:11211 auth_type = password project_domain_name = Default user_domain_name = Default project_name = service username = nova password = 000000 # 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf api auth_strategy keystone openstack-config --set /etc/nova/nova.conf keystone_authtoken www_authenticate_uri http://controller:5000/ openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://controller:5000/ openstack-config --set /etc/nova/nova.conf keystone_authtoken memcached_servers controller:11211 openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_type password openstack-config --set /etc/nova/nova.conf keystone_authtoken project_domain_name Default user_domain_name project_name openstack-config --set /etc/nova/nova.conf keystone_authtoken username nova openstack-config --set /etc/nova/nova.conf keystone_authtoken password 000000
在[DEFAULT]部分,配置my_ip选项,使用控制节点的管理接口IP地址:
[DEFAULT] my_ip = 192.168.75,20
# 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 192.168.75.20 |
在 [DEFAULT]部分,启用对网络服务的支持:
[DEFAULT] use_neutron = true firewall_driver = nova.virt.firewall.NoopFirewallDriver
# 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf DEFAULT use_neutron true openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver |
在 [vnc] 中配置vnc代理使用控制节点的管理接口IP地址。
[vnc] enabled = true server_listen = 0.0.0.0 server_proxyclient_address = 192.168.75.20
# 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf vnc enabled true openstack-config --set /etc/nova/nova.conf vnc server_listen 0.0.0.0 openstack-config --set /etc/nova/nova.conf vnc server_proxyclient_address 192.168.75.20 openstack-config --set /etc/nova/nova.conf vnc novncproxy_base_url http://192.168.75.20:6080/vnc_auto.html |
在[glance]部分,配置Image service api的位置:
[glance] api_servers = http://controller:9292
# 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf glance api_servers http://controller:9292 |
在[oslo_concurrency]部分中,配置锁路径:
[oslo_concurrency] lock_path = /var/lib/nova/tmp
# 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp |
在[placement]部分,配置对placement服务的访问
[placement] region_name = RegionOne project_domain_name = Default project_name = service auth_type = password user_domain_name = Default auth_url = http://controller:5000/v3 username = placement password = 000000 |
|
# 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf placement region_name RegionOne openstack-config --set /etc/nova/nova.conf placement project_domain_name Default openstack-config --set /etc/nova/nova.conf placement project_name service openstack-config --set /etc/nova/nova.conf placement auth_type password openstack-config --set /etc/nova/nova.conf placement user_domain_name Default openstack-config --set /etc/nova/nova.conf placement auth_url |
|
http://controller:5000/v3 openstack-config --set /etc/nova/nova.conf placement openstack-config --set /etc/nova/nova.conf placement |
username placement password 000000 |