部署在controller和compute节点
配置数据库
MariaDB [(none)]> CREATE DATABASE nova; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'nova'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'127.0.0.1' IDENTIFIED BY 'nova'; Query OK, 0 rows affected (0.00 sec MariaDB [(none)]> flush privileges ; Query OK, 0 rows affected (0.00 sec)
配置Nova服务认证
创建nova用户:
root@controller:~# openstack user create --password-prompt nova User Password:nova Repeat User Password:nova +----------+----------------------------------+ | Field | Value | +----------+----------------------------------+ | email | None | | enabled | True | | id | 7b2efefe960f434f8119491deee1ef17 | | name | nova | | username | nova | +----------+----------------------------------+
将admin角色添加给nova用户:
root@controller:~# openstack role add --project service --user nova admin +-------+----------------------------------+ | Field | Value | +-------+----------------------------------+ | id | 6d814860fbae4b9eb46c5e33835ba2a1 | | name | admin | +-------+----------------------------------+
创建nova的服务实体:
root@controller:~# openstack service create --name nova --description "OpenStack Compute" compute +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Compute | | enabled | True | | id | 58a99c547ee348339166a07ca9bb7b2c | | name | nova | | type | compute | +-------------+----------------------------------+
创建计算服务的API endpoint:
root@controller:~# openstack endpoint create --publicurl http://controller:8774/v2/%\(tenant_id\)s --internalurl http://controller:8774/v2/%\(tenant_id\)s --adminurl http://controller:8774/v2/%\(tenant_id\)s --region RegionOne compute +--------------+-----------------------------------------+ | Field | Value | +--------------+-----------------------------------------+ | adminurl | http://controller:8774/v2/%(tenant_id)s | | id | 8adca9694c1648bd8ef703ae2330f1c8 | | internalurl | http://controller:8774/v2/%(tenant_id)s | | publicurl | http://controller:8774/v2/%(tenant_id)s | | region | RegionOne | | service_id | 58a99c547ee348339166a07ca9bb7b2c | | service_name | nova | | service_type | compute | +--------------+-----------------------------------------+ root@controller:~# openstack service create --name nova --description "OpenStack Compute" computev3 +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Compute | | enabled | True | | id | 815f72af9d224da285fcf1ff3928bf66 | | name | nova | | type | computev3 | +-------------+----------------------------------+ root@controller:~# openstack endpoint create --publicurl http://controller:8774/v3 --internalurl http://controller:8774/v3 --adminurl http://controller:8774/v3 --region RegionOne computev3 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | adminurl | http://controller:8774/v3 | | id | 7560a3156fef4a4c9d2e94495638dd61 | | internalurl | http://controller:8774/v3 | | publicurl | http://controller:8774/v3 | | region | RegionOne | | service_id | 815f72af9d224da285fcf1ff3928bf66 | | service_name | nova | | service_type | computev3 | +--------------+----------------------------------+
安装nova server
controller节点部署
root@controller:~# apt-get install nova-api nova-cert nova-conductor nova-consoleauth nova-novncproxy nova-scheduler python-novaclient
配置nova
配置/etc/nova/nova.conf :
#[DEFAULT]部分,添加以下配置 [DEFAULT] logdir=/var/log/nova verbose=True rpc_backend = rabbit auth_strategy= keystone #controller节点管理网络的ip地址 my_ip= 192.168.1.200 #配置VNC代理以使用控制节点的管理IP地址 vncserver_listen =192.168.1.200 vncserver_proxyclient_address =192.168.1.200 #数据库连接 [database] connection= mysql://nova:nova@controller/nova #RabbitMQ消息队列 [oslo_messaging_rabbit] rabbit_host = controller rabbit_userid = openstack rabbit_password = openstack #身份认证服务 [keystone_authtoken] auth_uri= http://controller:5000 auth_url= http://controller:35357 auth_plugin= password project_domain_id= default user_domain_id= default project_name= service username= nova password= nova #配置镜像服务的位置 [glance] host = controller #配置锁路径 [oslo_concurrency] lock_path = /var/lib/nova/tmp #v3api [osapi_v3] enabled = true
配置初始化数据库:
root@controller:~# su -s /bin/sh -c "nova-manage db sync" nova
重启服务:
root@controller:~# service nova-api restart nova-api stop/waiting nova-api start/running, process 30242 root@controller:~# service nova-cert restart nova-cert stop/waiting nova-cert start/running, process 30279 root@controller:~# service nova-consoleauth restart nova-consoleauth stop/waiting nova-consoleauth start/running, process 30305 root@controller:~# service nova-scheduler restart nova-scheduler stop/waiting nova-scheduler start/running, process 30330 root@controller:~# service nova-conductor restart nova-conductor stop/waiting nova-conductor start/running, process 30358 root@controller:~# service nova-novncproxy restart nova-novncproxy stop/waiting nova-novncproxy start/running, process 30389 root@controller:~# rm -f /var/lib/nova/nova.sqlite
安装nova-compute
compute节点:
root@compute1:~# apt-get install nova-compute sysfsutils
配置nova-compute
配置/etc/nova/nova.conf :
#[DEFAULT]部分,添加以下配置 [DEFAULT] resume_guests_state_on_host_boot = true running_deleted_instance_action = log until_refresh = 5 max_age = 86400 rpc_backend = rabbit auth_strategy = keystone #compute节点管理网络的ip地址 my_ip = 192.168.31.21 #配置VNC代理以启用远程终端的访问 vnc_enabled = True vncserver_listen = 0.0.0.0 vncserver_proxyclient_address = 192.168.31.21 novncproxy_base_url = http://controller:6080/vnc_auto.html #RabbitMQ消息队列 [oslo_messaging_rabbit] rabbit_host = controller rabbit_userid = openstack rabbit_password = openstack #身份认证服务 [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 auth_plugin = password project_domain_id = default user_domain_id = default project_name = service username = nova password = nova #配置镜像服务 [glance] host = controller #配置锁路径 [oslo_concurrency] lock_path = /var/lib/nova/tmp
重启计算服务:
root@compute1:~# service nova-compute restart nova-compute stop/waiting nova-compute start/running, process 1952
删除ubuntu默认创建的SQLite数据库:
root@compute1:~# rm -f /var/lib/nova/nova.sqlite
校验安装
root@controller:~# nova service-list +----+------------------+------------+----------+---------+-------+----------------------------+-----------------+ | Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason | +----+------------------+------------+----------+---------+-------+----------------------------+-----------------+ | 1 | nova-cert | controller | internal | enabled | up | 2019-08-16T10:28:51.000000 | - | | 2 | nova-consoleauth | controller | internal | enabled | up | 2019-08-16T10:28:51.000000 | - | | 3 | nova-scheduler | controller | internal | enabled | up | 2019-08-16T10:28:51.000000 | - | | 4 | nova-conductor | controller | internal | enabled | up | 2019-08-16T10:28:46.000000 | - | | 6 | nova-compute | compute1 | nova | enabled | up | 2019-08-16T10:28:47.000000 | - | +----+------------------+------------+----------+---------+-------+----------------------------+-----------------+