nova计算节点组件介绍:
nova-api:接收并响应所有计算服务请求,管理云主机的声明周期
nova-compute:接收来自api的计算请求,真正创建云主机实例(调用libvirt)
nova-scheduler:nova调度器,接收创建实例的请求,平衡资源,决定在哪台服务器上创建
nova-conductor:作用于nova-compute和数据库之间,限制了nova-compute直接访问数据库(和nova-api起在一台机器上)
nova-network:管理云主机网络(已弃用,neutron)
nova-consoleauth:用户从web页面访问云主机时的认证
nova-novnxproxy:使用户可以从web页面访问云主机
nova-api-metadata:接收来自云主机的元数据请求,配合neutron-metadata-agent实现云主机的定制化

实操:
参考文档: https://docs.openstack.org/nova/train/install/controller-install-rdo.html

一、安装并配置控制节点(在控制节点上)

1、建库授权

mysql -u root -p
MariaDB [(none)]> CREATE DATABASE nova_api;
MariaDB [(none)]> CREATE DATABASE nova;
MariaDB [(none)]> CREATE DATABASE nova_cell0;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost'   IDENTIFIED BY 'NOVA_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%'  IDENTIFIED BY 'NOVA_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost'  IDENTIFIED BY 'NOVA_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%'  IDENTIFIED BY 'NOVA_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost'  IDENTIFIED BY 'NOVA_DBPASS';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%'  IDENTIFIED BY 'NOVA_DBPASS';
quit

2、创建用户、服务、绑定admin角色

openstack user create --domain default --password-prompt nova
openstack role add --project service --user nova admin
openstack service create --name nova --description "OpenStack Compute" compute

3、创建endpoint

openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1
openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1
openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1

4、安装并配置组件

yum install openstack-nova-api openstack-nova-conductor openstack-nova-novncproxy openstack-nova-scheduler -y

修改配置文件/etc/nova/nova.conf:

[DEFAULT]
# ...
enabled_apis = osapi_compute,metadata

[api_database]
# ...
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova_api

[database]
# ...
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova

[DEFAULT]
# ...
transport_url = rabbit://openstack:RABBIT_PASS@controller:5672/

[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 = NOVA_PASS

OpenStack Train版操作笔记(5) --- nova计算服务安装及验证(控制节点上)_第1张图片

[DEFAULT]
# ...
my_ip = ***

[DEFAULT]
# ...
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver

[vnc]
enabled = true
# ...
server_listen = $my_ip
server_proxyclient_address = $my_ip

[glance]
# ...
api_servers = http://controller:9292

[oslo_concurrency]
# ...
lock_path = /var/lib/nova/tmp

[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 = PLACEMENT_PASS

OpenStack Train版操作笔记(5) --- nova计算服务安装及验证(控制节点上)_第2张图片
5、同步数据库

su -s /bin/sh -c "nova-manage api_db sync" nova  #同步nova-api数据库
su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova #注册cell0数据库
su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova #创建cell1
su -s /bin/sh -c "nova-manage db sync" nova #同步nova数据库
su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova #验证cell0和cell1注册成功

nova cell_v2的引入原因及原理参考这篇文章: https://www.jianshu.com/p/653e43a02ddc
OpenStack Train版操作笔记(5) --- nova计算服务安装及验证(控制节点上)_第3张图片
OpenStack Train版操作笔记(5) --- nova计算服务安装及验证(控制节点上)_第4张图片
6、启动服务并设置开机自启动:

[root@controller ~]# systemctl enable openstack-nova-api.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
[root@controller ~]# systemctl start openstack-nova-api.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service