第四章-计算节点Nova
API:负责接收响应外部请求。支持OpenstackAPI,Ec2 API。
Cert:负责身份认证EC2.
Scheduler:用于云主机调度
Conductor:计算节点访问数据中的中间件
Consoleauth:用于控制台的授权验证
Novncproxy:VNC代理
安装并配置控制节点
第一步创建数据库
MariaDB [(none)]> drop database nova; Query OK, 110 rows affected (0.85 sec) MariaDB [(none)]> drop database nova_api; Query OK, 32 rows affected (0.20 sec) MariaDB [(none)]> drop database nova_cell0; Query OK, 110 rows affected (0.82 sec) 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)]> CREATE DATABASE nova_cell0; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> grant all on nova_cell0.* to 'nova'@'192.168.10.%' identified by 'nova'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> grant all on nova_api.* to 'nova'@'192.168.10.%' identified by 'nova'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> grant all on nova.* to 'nova'@'192.168.10.%' identified by 'nova'; Query OK, 0 rows affected (0.00 sec)
第二步创建nova用户并授权
openstack user create --domain default --password-prompt nova
openstack role add --project service --user nova admin
创建 nova 服务实体:
[root@openstack-1 ~]# openstack service create --name nova \ > --description "OpenStack Compute" compute +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Compute | | enabled | True | | id | 817ffd34ea6f43f499ba8501a7a66c50 | | name | nova | | type | compute | +-------------+----------------------------------+
创建 Compute 服务 API 端点 :
[root@openstack-1 ~]# openstack endpoint create --region RegionOne \ > compute public http://192.168.10.131:8774/v2.1/%\(tenant_id\)s +--------------+-----------------------------------------------+ | Field | Value | +--------------+-----------------------------------------------+ | enabled | True | | id | 382ea0ba6a5e46608f2919f9117c952a | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 817ffd34ea6f43f499ba8501a7a66c50 | | service_name | nova | | service_type | compute | | url | http://192.168.10.131:8774/v2.1/%(tenant_id)s | +--------------+-----------------------------------------------+ [root@openstack-1 ~]# openstack endpoint create --region RegionOne \ > compute internal http://192.168.10.131:8774/v2.1/%\(tenant_id\)s +--------------+-----------------------------------------------+ | Field | Value | +--------------+-----------------------------------------------+ | enabled | True | | id | 8584261f5912452bbc037a66e63dc418 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 817ffd34ea6f43f499ba8501a7a66c50 | | service_name | nova | | service_type | compute | | url | http://192.168.10.131:8774/v2.1/%(tenant_id)s | +--------------+-----------------------------------------------+ [root@openstack-1 ~]# openstack endpoint create --region RegionOne \ > compute admin http://192.168.10.131:8774/v2.1/%\(tenant_id\)s +--------------+-----------------------------------------------+ | Field | Value | +--------------+-----------------------------------------------+ | enabled | True | | id | 37a982819304468687190124db3e0efc | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 817ffd34ea6f43f499ba8501a7a66c50 | | service_name | nova | | service_type | compute | | url | http://192.168.10.131:8774/v2.1/%(tenant_id)s | +--------------+-----------------------------------------------+
第三部创建定位服务用户placement
openstack user create --domain default --password-prompt placement
openstack role add --project service --user placement admin
创建placement端点:
[root@openstack-1 ~]# openstack endpoint create --region RegionOne placement public http://192.168.10.131:8778 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 1bb1d98d343b47a9b9d9408ae2fe53c4 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 062c05e029d6483798ad9cbc24d21414 | | service_name | placement | | service_type | placement | | url | http://192.168.10.131:8778 | +--------------+----------------------------------+ [root@openstack-1 ~]# openstack endpoint create --region RegionOne placement internal http://192.168.10.131:8778 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | c07d4d73b09b4aaea05f51b64779836d | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 062c05e029d6483798ad9cbc24d21414 | | service_name | placement | | service_type | placement | | url | http://192.168.10.131:8778 | +--------------+----------------------------------+ [root@openstack-1 ~]# openstack endpoint create --region RegionOne placement admin http://192.168.10.131:8778 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 2c94168078e349acbb260814bdce39a9 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 062c05e029d6483798ad9cbc24d21414 | | service_name | placement | | service_type | placement | | url | http://192.168.10.131:8778 | +--------------+----------------------------------+
安装软件包:
[root@openstack-1 ~]# yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler
编辑``/etc/nova/nova.conf``文件并完成下面的操作:
-
在``[DEFAULT]``部分,只启用计算和元数据API:
[DEFAULT]
enabled_apis = osapi_compute,metadata
在``[api_database]``和``[database]``部分,配置数据库的连接:
[api_database] connection=mysql+pymysql://nova:nova@192.168.10.172/nova_api [database] connection=mysql+pymysql://nova:nova@192.168.10.172/nova
在 “[DEFAULT]” ,配置 “RabbitMQ” 消息队列访问:
transport_url = rabbit://openstack:openstack@192.168.10.131
在 “[DEFAULT]” 和 “[keystone_authtoken]” 部分,配置认证服务访问:
[DEFAULT] auth_strategy = keystone [keystone_authtoken] auth_uri = http://192.168.10.131:5000 auth_url = http://192.168.10.131:35357 memcached_servers = 192.168.10.131:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = nova password = nova
###################################
[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 = nova
password = NOVA_PASS
在 [DEFAULT] 部分,使能 Networking 服务:
[DEFAULT] use_neutron = True firewall_driver = nova.virt.firewall.NoopFirewallDriver
在``[vnc]``部分,配置VNC代理使用控制节点的管理接口IP地址 :
enabled = true
server_listen=0.0.0.0 server_proxyclient_address=192.168.10.131
在 [glance] 区域,配置镜像服务 API 的位置:
api_servers=http://192.168.10.131:9292
在 [oslo_concurrency] 部分,配置锁路径:
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
In the [placement] section, configure the Placement API:
[placement] os_region_name = RegionOne project_domain_name = Default project_name = service auth_type = password user_domain_name = Default auth_url = http://192.168.10.131:5000/v3 username = placement password = placement
vim /etc/httpd/conf.d/00-nova-placement-api.conf <Directory /usr/bin> <IfVersion >= 2.4> Require all granted </IfVersion> <IfVersion < 2.4> Order allow,deny Allow from all </IfVersion> </Directory> systemctl restart httpd
同步Compute 数据库:
su -s /bin/sh -c "nova-manage api_db sync" nova
su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
109e1d4b-536a-40d0-83c6-5f121b82b650
su -s /bin/sh -c "nova-manage db sync" nova
完成安装
启动 Compute 服务并将其设置为随系统启动:
[root@openstack-1 ~]# systemctl enable openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service [root@openstack-1 ~]# systemctl start openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service [root@openstack-1 ~]# systemctl status openstack-nova-api.service openstack-nova-consoleauth.serv ice openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
验证
[root@openstack-1 ~]# nova-manage cell_v2 list_cells /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: NotSupportedWarning: Configuration option(s) ['use_tpool'] not supported exception.NotSupportedWarning +-------+--------------------------------------+----------------------------------------+-----------------------------------------------------+ | 名称 | UUID | Transport URL | 数据库连接 | +-------+--------------------------------------+----------------------------------------+-----------------------------------------------------+ | cell0 | 00000000-0000-0000-0000-000000000000 | none:/ | mysql+pymysql://nova:****@2/nova_cell0 | | cell1 | d9d9cd50-7602-40d1-bd50-293daf488524 | rabbit://openstack:****@ | +-------+--------------------------------------+----------------------------------------+-----------------------------------------------------+ [root@openstack-1 ~]# openstack host list +-------------+-------------+----------+ | Host Name | Service | Zone | +-------------+-------------+----------+ | openstack-1 | consoleauth | internal | | openstack-1 | conductor | internal | | openstack-1 | scheduler | internal | +-------------+-------------+----------+
作者:闫世成
出处:http://cnblogs.com/yanshicheng
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。如有问题或建议,请联系上述邮箱,非常感谢。

浙公网安备 33010602011771号