接下来继续安装计算服务:
1.计算服务介绍
opensatck compute service(nova)提供一个工具来部署云平台,包括运行实例,管理实例。他底层的开源项目名称是nova,他没有包含任何虚拟化软件,而是定义与虚拟化机制交互的驱动程序,通过调用各个虚拟化管理软件的api接口来实现对不同种类虚拟机的操作。
2.组件介绍
nova-api:接收和响应来自最终用户的计算API请求。
nova-compute:一个持续工作的守护进程,通过Hypervior的API来创建和销毁虚拟机实例。
例如:
-
XenServer/XCP 的 XenAPI
-
KVM 或 QEMU 的 libvirt
-
VMware 的 VMwareAPI
nova-conductor:Mediates interactions between the nova-compute
service and the database. It eliminates direct accesses to the cloud database made by the nova-compute
service.
nova-cert:服务器守护进程向Nova Cert服务提供X509证书。
nova-novncproxy:提供一个代理,用于访问正在运行的实例,通过VNC协议,支持基于浏览器的novnc客户端。
数据库:
mysql或者PostgreSQL
3.计算服务的安装
控制节点安装:
1.安装数据库服务并授权:
mysql> CREATE DATABASE nova_api; mysql> CREATE DATABASE nova;
mysql> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \ IDENTIFIED BY 'NOVA_DBPASS'; mysql> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' \ IDENTIFIED BY 'NOVA_DBPASS'; mysql> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \ IDENTIFIED BY 'NOVA_DBPASS'; mysql> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \ IDENTIFIED BY 'NOVA_DBPASS';注意:用合适的密码代替以上密码“NOVA_DBPASS”
2.获取admin账号权限
source openrc
3.创建nova用户并添加到admin账号
$ openstack user create --domain default \ --password-prompt nova User Password: Repeat User Password: +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | domain_id | default | | enabled | True | | id | 8a7dbf5279404537b1c7b86c033620fe | | name | nova | | password_expires_at | None | +---------------------+----------------------------------+
$ openstack role add --project service --user nova admin
4.创建nova服务与endpoint
$ openstack service create --name nova \ --description "OpenStack Compute" compute +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Compute | | enabled | True | | id | 060d59eac51b4594815603d75a00aba2 | | name | nova | | type | compute | +-------------+----------------------------------+
$ openstack endpoint create --region RegionOne \ compute public http://controller:8774/v2.1/%\(tenant_id\)s +--------------+-------------------------------------------+ | Field | Value | +--------------+-------------------------------------------+ | enabled | True | | id | 3c1caa473bfe4390a11e7177894bcc7b | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 060d59eac51b4594815603d75a00aba2 | | service_name | nova | | service_type | compute | | url | http://controller:8774/v2.1/%(tenant_id)s | +--------------+-------------------------------------------+ $ openstack endpoint create --region RegionOne \ compute internal http://controller:8774/v2.1/%\(tenant_id\)s +--------------+-------------------------------------------+ | Field | Value | +--------------+-------------------------------------------+ | enabled | True | | id | e3c918de680746a586eac1f2d9bc10ab | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 060d59eac51b4594815603d75a00aba2 | | service_name | nova | | service_type | compute | | url | http://controller:8774/v2.1/%(tenant_id)s | +--------------+-------------------------------------------+ $ openstack endpoint create --region RegionOne \ compute admin http://controller:8774/v2.1/%\(tenant_id\)s +--------------+-------------------------------------------+ | Field | Value | +--------------+-------------------------------------------+ | enabled | True | | id | 38f7af91666a47cfb97b4dc790b94424 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 060d59eac51b4594815603d75a00aba2 | | service_name | nova | | service_type | compute | | url | http://controller:8774/v2.1/%(tenant_id)s | +--------------+-------------------------------------------+5.安装软件包并配置文件
1.安装软件包
# yum install openstack-nova-api openstack-nova-conductor \ openstack-nova-console openstack-nova-novncproxy \ openstack-nova-scheduler2.配置文件 /etc/nova/nova.conf
-
在``[DEFAULT]``部分,只启用计算和元数据API:
[DEFAULT] ... enabled_apis = osapi_compute,metadata
-
在``[api_database]``和``[database]``部分,配置数据库的连接:
[api_database] ... connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova_api [database] ... connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova
用你为 Compute 数据库选择的密码来代替
NOVA_DBPASS
。 -
在``[DEFAULT]``部分,配置``RabbitMQ``消息队列访问权限:
[DEFAULT] ... transport_url = rabbit://openstack:RABBIT_PASS@controller
用你在 “RabbitMQ” 中为 “openstack” 选择的密码替换 “RABBIT_PASS”。
-
在 “[DEFAULT]” 和 “[keystone_authtoken]” 部分,配置认证服务访问:
[DEFAULT] ... auth_strategy = keystone [keystone_authtoken] ... auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = nova password = NOVA_PASS
使用你在身份认证服务中设置的``nova`` 用户的密码替换``NOVA_PASS``。
在
[keystone_authtoken]
中注释或者删除其他选项。 -
在
[DEFAULT
部分,配置``my_ip`` 来使用控制节点的管理接口的IP 地址。[DEFAULT] ... my_ip = 10.0.0.11
-
在 ``[DEFAULT]``部分,启用网络服务支持:
[DEFAULT] ... use_neutron = True firewall_driver = nova.virt.firewall.NoopFirewallDriver
默认情况下,计算服务使用内置的防火墙服务。由于网络服务包含了防火墙服务,你必须使用``nova.virt.firewall.NoopFirewallDriver``防火墙服务来禁用掉计算服务内置的防火墙服务
-
在``[vnc]``部分,配置VNC代理使用控制节点的管理接口IP地址 :
[vnc] ... vncserver_listen = $my_ip vncserver_proxyclient_address = $my_ip
-
在
[glance]
区域,配置镜像服务 API 的位置:[glance] ... api_servers = http://controller:9292
-
在
[oslo_concurrency]
部分,配置锁路径:[oslo_concurrency] ... lock_path = /var/lib/nova/tmp
[root@controller ~]# grep "^[a-z]" /etc/nova/nova.conf
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:123456@controller
auth_strategy = keystone
my_ip = 192.168.141.170
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
connection = mysql+pymysql://nova:123456@192.168.141.170/nova_api
connection = mysql+pymysql://nova:123456@192.168.141.170/nova
api_servers = http://192.168.141.170:9292
auth_uri = http://192.168.141.170:5000
auth_url = http://192.168.141.170:35357
memcached_servers = 192.168.141.170:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = 123456
lock_path = /var/lib/nova/tmp
rpc_backend = rabbit
rabbit_hosts=192.168.141.170
rabbit_userid=openstack
rabbit_password=123456
vncserver_listen = 192.168.141.170
vncserver_proxyclient_address = 192.168.141.170
5.同步数据库
# su -s /bin/sh -c "nova-manage api_db sync" nova # su -s /bin/sh -c "nova-manage db sync" nova注意:忽略输出中任何不推荐使用的信息。
6.启动compute服务并添加自启动
# systemctl enable openstack-nova-api.service \ openstack-nova-consoleauth.service openstack-nova-scheduler.service \ openstack-nova-conductor.service openstack-nova-novncproxy.service # systemctl start openstack-nova-api.service \ openstack-nova-consoleauth.service openstack-nova-scheduler.service \ openstack-nova-conductor.service openstack-nova-novncproxy.service至此控制节点的计算服务安装完毕。