1.安装nova服务所需的包
[root@controller ~]# yum install openstack-nova-api openstack-nova-conductor \ openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler -y |
2.创建数据库
2.1登录数据库 [root@controller ~]# mysql -u root -p000000 MariaDB [(none)]> CREATE DATABASE nova_api; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> CREATE DATABASE nova; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \ -> IDENTIFIED BY '000000'; Query OK, 0 rows affected (0.02 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY '000000'; Query OK, 0 rows affected (0.00 sec) MariaDB [nova_api]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \ -> IDENTIFIED BY '000000'; Query OK, 0 rows affected (0.06 sec) MariaDB [nova_api]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '000000'; Query OK, 0 rows affected (0.00 sec) 2.4退出数据库 MariaDB [(none)]> exit Bye |
3.创建服务实体和API端点
3.1创建nova用户 [root@controller ~]# openstack user create --domain default \ > --password-prompt nova User Password: Repeat User Password: +-----------+----------------------------------+ | Field | Value | +-----------+----------------------------------+ | domain_id | 11c1d63da1784b51bc6d13335f635778 | | enabled | True | | id | a17b650618054f4aa73f78713c7bf906 | | name | nova | +-----------+----------------------------------+ 3.2赋予nova用户service项目admin角色 [root@controller ~]# openstack role add --project service --user nova admin 3.3创建服务实体 [root@controller ~]# openstack service create --name nova \ --description "OpenStack Compute" compute +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Compute | | enabled | True | | id | 0906174a995042369b5c81842a48ede2 | | name | nova | | type | compute | +-------------+----------------------------------+ 3.创建三个api端点 [root@controller ~]# openstack endpoint create --region RegionOne \ compute public http://controller:8774/v2.1/%\(tenant_id\)s +--------------+-------------------------------------------+ | Field | Value | +--------------+-------------------------------------------+ | enabled | True | | id | 005f370a896344a0acd9481a353b6c98 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 0906174a995042369b5c81842a48ede2 | | service_name | nova | | service_type | compute | | url | http://controller:8774/v2.1/%(tenant_id)s | +--------------+-------------------------------------------+ [root@controller ~]# openstack endpoint create --region RegionOne \ compute internal http://controller:8774/v2.1/%\(tenant_id\)s +--------------+-------------------------------------------+ | Field | Value | +--------------+-------------------------------------------+ | enabled | True | | id | c69d79c328c647ecb195d12637888ca0 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 0906174a995042369b5c81842a48ede2 | | service_name | nova | | service_type | compute | | url | http://controller:8774/v2.1/%(tenant_id)s | +--------------+-------------------------------------------+ [root@controller ~]# openstack endpoint create --region RegionOne \ compute admin http://controller:8774/v2.1/%\(tenant_id\)s +--------------+-------------------------------------------+ | Field | Value | +--------------+-------------------------------------------+ | enabled | True | | id | 07422bcee6494f709b72ba9faec9ac5f | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 0906174a995042369b5c81842a48ede2 | | service_name | nova | | service_type | compute | | url | http://controller:8774/v2.1/%(tenant_id)s | +--------------+-------------------------------------------+ |
4.修改配置文件/etc/nova/nova.conf
vim /etc/nova/nova.conf 1 [DEFAULT] 2 enabled_apis = osapi_compute,metadata#启用计算api,元数据api 3 rpc_backend = rabbit#消息队列的类型 4 auth_strategy = keystone 5 my_ip = 10.0.10.130 #控制节点管理IP 6 use_neutron = True#启动对网络服务的支持 7 firewall_driver = nova.virt.firewall.NoopFirewallDriver 2161 [api_database] #配置数据库访问 2162 connection = mysql+pymysql://nova:000000@controller/nova_api 3107 [database] 3108 connection = mysql+pymysql://nova:000000@controller/nova 3329 [glance]#配置glance 服务的位置 3330 api_servers = http://controller:9292 3526 [keystone_authtoken]#配置身份访问服务 3527 auth_uri = http://controller:5000 3528 auth_url = http://controller:35357 3529 memcached_servers = controller:11211 3530 auth_type = password 3531 project_domain_name = default 3532 user_domain_name = default 3533 project_name = service 3534 username = nova 3535 password = 000000 4300 [oslo_concurrency]#锁定路径 4301 lock_path = /var/lib/nova/tmp 4398 [oslo_messaging_rabbit]#配置消息队列访问 4399 rabbit_host = controller 4400 rabbit_userid = openstack 4401 rabbit_password = 000000 5367 [vnc]#使用控制器节点的管理接口IP地址 5368 vncserver_listen = $my_ip 5369 vncserver_proxyclient_address = $my_ip |
5.同步数据库
[root@controller ~]# su -s /bin/sh -c "nova-manage api_db sync" nova [root@controller ~]# su -s /bin/sh -c "nova-manage db sync" nova /usr/lib/python2.7/site-packages/pymysql/cursors.py:170: Warning: (1831, u"Duplicate index 'block_device_mapping_instance_uuid_virtual_name_device_name_idx' defined on the table 'nova.block_device_mapping'. This is deprecated and will be disallowed in a future release.") result = self._query(query) /usr/lib/python2.7/site-packages/pymysql/cursors.py:170: Warning: (1831, u"Duplicate index 'uniq_instances0uuid' defined on the table 'nova.instances'. This is deprecated and will be disallowed in a future release.") result = self._query(query) |
6.启动nova服务,并设置开机自启动
[root@controller ~]# systemctl enable openstack-nova-api.service \ openstack-nova-consoleauth.service openstack-nova-scheduler.service \ openstack-nova-conductor.service openstack-nova-novncproxy.service Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-api.service to /usr/lib/systemd/system/openstack-nova-api.service. Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-consoleauth.service to /usr/lib/systemd/system/openstack-nova-consoleauth.service. Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-scheduler.service to /usr/lib/systemd/system/openstack-nova-scheduler.service. Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-conductor.service to /usr/lib/systemd/system/openstack-nova-conductor.service. Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-novncproxy.service to /usr/lib/systemd/system/openstack-nova-novncproxy.service. [root@controller ~]# systemctl start openstack-nova-api.service \ openstack-nova-consoleauth.service openstack-nova-scheduler.service \ openstack-nova-conductor.service openstack-nova-novncproxy.service |
7.验证操作
[root@controller ~]# nova service-list +----+------------------+------------+----------+---------+-------+----------------------------+-----------------+ | Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason | +----+------------------+------------+----------+---------+-------+----------------------------+-----------------+ | 1 | nova-consoleauth | controller | internal | enabled | up | 2018-06-29T04:41:44.000000 | - | | 2 | nova-conductor | controller | internal | enabled | up | 2018-06-29T04:41:44.000000 | - | | 3 | nova-scheduler | controller | internal | enabled | up | 2018-06-29T04:41:44.000000 | - | +----+------------------+------------+----------+---------+-------+----------------------------+-----------------+ |