Hi 你好,欢迎访问!登录
当前位置:首页 - 虚拟化 - 正文 忍人所不忍,能人所不能。

OpenStack install Nova(计算服务)

2020-09-02虚拟化90root126°c
A+ A-

一、nova(计算服务)介绍

Nova是OpenStack云中的计算组织控制器。支持OpenStack云中实例(instances)生命周期的所有活动都由Nova处理。这样使得Nova成为一个负责管理计算资源、网络、认证、所需可扩展性的平台。但是,Nova自身并没有提供任何虚拟化能力,相反它使用libvirt API来与被支持的Hypervisors交互。Nova 通过一个与Amazon Web Services(AWS)EC2 API兼容的web services API来对外提供服务。

  • nova api: 负责介绍和响应外部请求. 支持OpenStack API,EC2API

  • nova cert:负责身份认证

  • nova Scheduler:用于云主机调度

  • nova Conductor:计算节点访问数据库的中间件

  • nova Consoleatuh:用于控制台的授权验证

  • nova Novncproxy:vnc代理

Nova scheduler模块在openstack中的作用是决策虚拟机创建在那个主机(计算节点)上。

决策一个虚拟机应该调度到某物理节点,需要分为两个步骤:

  • 过滤(Fliter)

  • 计算权值(Weight)

OpenStack install Nova(计算服务) OpenStack Linux 虚拟化 第1张 

OpenStack install Nova(计算服务) OpenStack Linux 虚拟化 第2张

二、yum install nova(控制节点)

[[email protected] ~]# yum install -y openstack-nova-api openstack-nova-cert  openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler python-novaclient       #在控制节点安装

三、配置nova

  • 3.1 设置数据库链接地址

[[email protected] ~]# vim /etc/nova/nova.confconnection=mysql://nova:[email protected]/nova
[[email protected] ~]# nova-manage db sync        #同步nova数据库[[email protected] ~]# mysql -h192.168.15.11 -unova -pnova -e"use nova;show tables"+--------------------------------------------+
| Tables_in_nova                             |
+--------------------------------------------+
| agent_builds                               |
| aggregate_hosts                            |
| aggregate_metadata                         |
| aggregates                                 |
| block_device_mapping                       |
| bw_usage_cache                             |
| cells                                      |
| certificates                               |
| compute_nodes                              |
| console_pools                              |
| consoles                                   |
| dns_domains                                |
| ..................                         |
+--------------------------------------------+### 共108张表
  • 3.2 设置nova链接RabbitMQ地址

[[email protected] ~]# vim /etc/nova/nova.confrpc_backend=rabbit
rabbit_host=192.168.15.11
rabbit_port=5672
rabbit_use_ssl=falserabbit_userid=guest
rabbit_password=guest
  • 3.3 创建注册用户nova

[[email protected] ~]# keystone user-create --name=nova --pass=nova+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |                                  |
| enabled  |               True               |
|    id    | 5dc27ec3e47d4dc98f8ba6c61aa7bdec |
|   name   |               nova               |
| username |               nova               |
+----------+----------------------------------+
[[email protected] ~]# keystone user-role-add --user=nova --tenant=admin --role=admin
  • 3.3 设置keystone相关配置

[[email protected] ~]# vim /etc/nova/nova.conf[keystone_authtoken]            #keystone认证auth_host=192.168.15.11
auth_port=35357
auth_protocol=http
auth_uri=http://192.168.15.11:5000
auth_version=v2.0
admin_user=nova
admin_password=nova
admin_tenant_name=admin             #租户auth_strategy=keystone
  • 3.5 设置vnc

[[email protected] ~]# vim /etc/nova/nova.confnovncproxy_base_url=http://192.168.15.11:6080/vnc_auto.html
vncserver_listen=0.0.0.0
vncserver_proxyclient_address=192.168.15.11
vnc_enabled=truevnc_keymap=en-us
my_ip=192.168.15.11
compute_driver=libvirt.LibvirtDriver

四、创建nova service 和 endpoint

[[email protected] ~]# source /root/keystone-admin[[email protected] ~]# keystone service-create --name=nova --type=compute+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |                                  |
|   enabled   |               True               |
|      id     | fa7da98bb9584e48801f0b8716eb762a |
|     name    |               nova               |
|     type    |             compute              |
+-------------+----------------------------------+
[[email protected] ~]# keystone endpoint-create \> --service-id=fa7da98bb9584e48801f0b8716eb762a \
> --publicurl=http://192.168.15.11:8774/v2/%\(tenant_id\)s \
> --internalurl=http://192.168.15.11:8774/v2/%\(tenant_id\)s \
> --adminurl=http://192.168.15.11:8774/v2/%\(tenant_id\)s
+-------------+--------------------------------------------+
|   Property  |                   Value                    |
+-------------+--------------------------------------------+
|   adminurl  | http://192.168.15.11:8774/v2/%(tenant_id)s |
|      id     |      4947486d54ed4bd2a0760bec321b9a34      |
| internalurl | http://192.168.15.11:8774/v2/%(tenant_id)s |
|  publicurl  | http://192.168.15.11:8774/v2/%(tenant_id)s |
|    region   |                 regionOne                  |
|  service_id |      fa7da98bb9584e48801f0b8716eb762a      |
+-------------+--------------------------------------------+
[[email protected] ~]# keystone service-list+----------------------------------+----------+----------+--------------------+
|                id                |   name   |   type   |    description     |
+----------------------------------+----------+----------+--------------------+
| c0fe6a5ef1fb4bbeaf795ea7fef00748 |  glance  |  image   |                    |
| e39a683d743340dea051005c3ae35046 | keystone | identity | Openstack Identity |
| fa7da98bb9584e48801f0b8716eb762a |   nova   | compute  |                    |
+----------------------------------+----------+----------+--------------------+
[[email protected] ~]# keystone endpoint-list+----------------------------------+-----------+--------------------------------------------+--------------------------------------------+--------------------------------------------+----------------------------------+
|                id                |   region  |                 publicurl                  |                internalurl                 |                  adminurl                  |            service_id            |
+----------------------------------+-----------+--------------------------------------------+--------------------------------------------+--------------------------------------------+----------------------------------+
| 135732ad0fd34da79cbca5b8fe93b15f | regionOne |         http://192.168.15.11:9292          |         http://192.168.15.11:9292          |         http://192.168.15.11:9292          | c0fe6a5ef1fb4bbeaf795ea7fef00748 |
| 4947486d54ed4bd2a0760bec321b9a34 | regionOne | http://192.168.15.11:8774/v2/%(tenant_id)s | http://192.168.15.11:8774/v2/%(tenant_id)s | http://192.168.15.11:8774/v2/%(tenant_id)s | fa7da98bb9584e48801f0b8716eb762a |
| 7b923b2e790b43ee8b5be99d5c8262d6 | regionOne |       http://192.168.15.11:5000/v2.0       |       http://192.168.15.11:5000/v2.0       |      http://192.168.15.11:35357/v2.0       | e39a683d743340dea051005c3ae35046 |
+----------------------------------+-----------+--------------------------------------------+--------------------------------------------+--------------------------------------------+----------------------------------+

五、启动nova

[[email protected] ~]# pip install websockify==0.5.1     #安装websockitf,否则novncproxy无法启动[[email protected] ~]# for i in {api,cert,conductor,console,consoleauth,novncproxy,scheduler};do chkconfig --add openstack-nova-$i;done      #将服务加入到开启启动[[email protected] ~]# for i in {api,cert,conductor,console,consoleauth,novncproxy,scheduler};do chkconfig openstack-nova-$i on;done     #开启自启动[[email protected] ~]# for i in {api,cert,conductor,console,consoleauth,novncproxy,scheduler};do service openstack-nova-$i start;done    #启动nova服务

六、测试nova

[[email protected] src]# nova host-list+------------------+-------------+----------+
| host_name        | service     | zone     |
+------------------+-------------+----------+
| node1.90root.com | conductor   | internal |
| node1.90root.com | console     | internal |
| node1.90root.com | scheduler   | internal |
| node1.90root.com | cert        | internal |
| node1.90root.com | consoleauth | internal |
+------------------+-------------+----------+
[[email protected] src]# nova flavor-list+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name      | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1  | m1.tiny   | 512       | 1    | 0         |      | 1     | 1.0         | True      |
| 2  | m1.small  | 2048      | 20   | 0         |      | 1     | 1.0         | True      |
| 3  | m1.medium | 4096      | 40   | 0         |      | 2     | 1.0         | True      |
| 4  | m1.large  | 8192      | 80   | 0         |      | 4     | 1.0         | True      |
| 5  | m1.xlarge | 16384     | 160  | 0         |      | 8     | 1.0         | True      |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
  移步手机端
OpenStack install Nova(计算服务)

1、打开你手机的二维码扫描APP
2、扫描左则的二维码
3、点击扫描获得的网址
4、可以在手机端阅读此文章
标签:

发表评论

选填

必填

必填

选填

请拖动滑块解锁
>>


  用户登录