其他分享
首页 > 其他分享> > Nova 计算服务 (老王笔记)

Nova 计算服务 (老王笔记)

作者:互联网

Nova 计算服务

控制节点和计算节点1

安装配置控制节点

1、为了创建数据库,必须完成这些步骤:

2、要创建服务证书,完成这些步骤:

3、创建 Compute 服务 API 端点 :

$ openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1

$ openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1

$ openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1

4、创建Placement 服务用户

  1. 创建一个Placement服务用户 密码为PLACEMENT_PASS:

    $ openstack user create --domain default --password PLACEMENT_PASS  placement
    
  2. 将Placement用户添加到具有管理角色的服务项目中:

    $ openstack role add --project service --user placement admin
    
  3. 在服务目录中创建Placement API条目:

    $ openstack service create --name placement --description "Placement API" placement
    
  4. 创建Placement API服务端点:

    $ openstack endpoint create --region RegionOne placement public http://controller:8778
    
    $ openstack endpoint create --region RegionOne placement internal http://controller:8778
    
    $ openstack endpoint create --region RegionOne placement admin http://controller:8778
    

5、安装软件包:

$ yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api -y

6、编辑/etc/nova/nova.conf归档并完成以下操作:

取代PLACEMENT_PASS使用您为placement身份服务中的用户。中的任何其他选项注释掉。[placement]部分。

7、填充nova-api数据库:

$ su -s /bin/sh -c "nova-manage api_db sync" nova

8、注册cell0数据库:

$ su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova

9、创建cell1牢房:

$ su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova

10、填充nova数据库:

$ su -s /bin/sh -c "nova-manage db sync" nova

11、验证nova cell 0和cell 1是否正确注册:

$ nova-manage cell_v2 list_cells
+--------------------------------------+------------------+------------+----------+---------+-------+----------------------------+-----------------+-------------+
| Id                                   | Binary           | Host       | Zone     | Status  | State | Updated_at                 | Disabled Reason | Forced down |
+--------------------------------------+------------------+------------+----------+---------+-------+----------------------------+-----------------+-------------+
| 0a271a84-951c-4d72-a103-c6490342e8f0 | nova-scheduler   | controller | internal | enabled | up    | 2020-10-16T11:44:31.000000 | -               | False       |
| 7be59081-6995-4d73-a81f-c222fd29c503 | nova-consoleauth | controller | internal | enabled | up    | 2020-10-16T11:44:31.000000 | -               | False       |
| a7e81fab-62ba-41c8-bebb-49423caec863 | nova-conductor   | controller | internal | enabled | up    | 2020-10-16T11:44:35.000000 | -               | False       |
+--------------------------------------+------------------+------------+----------+---------+-------+----------------------------+-----------------+-------------+

12、服务启动

启动 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

验证

netstat -lntp

安装和配置计算节点

1、安装软件包

$ yum install openstack-nova-compute -y

2、编辑/etc/nova/nova.conf归档并完成以下操作:

(如果要访问远程控制台的web浏览器驻留在无法解析controller主机名,您必须替换controller具有控制器节点的管理接口IP地址。)

取代PLACEMENT_PASS使用您为placement身份服务中的用户。中的任何其他选项注释掉。[placement]部分。

3、确定计算节点是否支持虚拟机的硬件加速:(可跳过)

$ egrep -c '(vmx|svm)' /proc/cpuinfo

如果此命令返回值为1 或者更大,您的计算节点支持硬件加速,这通常不需要额外的配置。

如果此命令返回值为0,您的计算节点不支持硬件加速,您必须配置libvirt使用QEMU而不是KVM。

4、启动Compute服务,包括其依赖项,并将其配置为在系统启动时自动启动:

$ systemctl enable libvirtd.service openstack-nova-compute.service
$ systemctl start libvirtd.service openstack-nova-compute.service

(如果nova-compute服务启动失败,请检查/var/log/nova/nova-compute.log。错误信息AMQP server on controller:5672 isunreachable可能表示控制器节点上的防火墙正在阻止对端口5672的访问。将防火墙配置为在控制器节点上打开端口5672并重新启动nova-compute计算节点上的服务。)

5、将计算节点添加到单元数据库中

以下命令在运行在控制器节点。

  1. 获取管理凭据以启用只管理的CLI命令,然后确认数据库中有计算主机:

    $ . admin-openrc
    
    $ openstack hypervisor list
    +----+---------------------+-----------------+-----------+-------+
    | ID | Hypervisor Hostname | Hypervisor Type | Host IP   | State |
    +----+---------------------+-----------------+-----------+-------+
    |  1 | compute1            | QEMU            | 10.0.0.31 | up    |
    +----+---------------------+-----------------+-----------+-------+
    
  2. 发现计算主机:

    $ su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
    

    添加新的计算节点时,必须在控制器节点上运行nova-manage cell_v2 discover_hosts注册这些新的计算节点。或者,您可以在/etc/nova/nova.conf:

    [scheduler]
    discover_hosts_in_cells_interval = 300
    
    # 下面不知道要不要改
    [filter_scheduler]
    discover_hosts_in_cells_interval = 300
    

来配置周期性任务,以使Nova自动发现新主机。

6、验证

$ openstack service list
+----------------------------------+-----------+-----------+
| ID                               | Name      | Type      |
+----------------------------------+-----------+-----------+
| 6eeb352a9cc74557a5dd679d4f90df0a | glance    | image     |
| 743401be43c948f2981163f41e0ad7e9 | keystone  | identity  |
| aabf05adda5b417f96fc15a0d6897756 | placement | placement |
| b0c73a07749745cab6aded4a7cef4efd | nova      | compute   |
+----------------------------------+-----------+-----------+
$ openstack compute service list
+----+------------------+------------+----------+---------+-------+----------------------------+
| ID | Binary           | Host       | Zone     | Status  | State | Updated At                 |
+----+------------------+------------+----------+---------+-------+----------------------------+
|  1 | nova-scheduler   | controller | internal | enabled | up    | 2020-11-06T04:03:55.000000 |
|  2 | nova-consoleauth | controller | internal | enabled | up    | 2020-11-06T04:03:56.000000 |
|  3 | nova-conductor   | controller | internal | enabled | up    | 2020-11-06T04:03:55.000000 |
|  7 | nova-compute     | compute1   | nova     | enabled | up    | 2020-11-06T04:03:50.000000 |
+----+------------------+------------+----------+---------+-------+----------------------------+
$ openstack compute service list --service nova-compute
+----+--------------+----------+------+---------+-------+----------------------------+
| ID | Binary       | Host     | Zone | Status  | State | Updated At                 |
+----+--------------+----------+------+---------+-------+----------------------------+
|  7 | nova-compute | compute1 | nova | enabled | up    | 2020-11-06T04:04:10.000000 |
+----+--------------+----------+------+---------+-------+----------------------------+

标签:Nova,placement,service,--,老王,nova,controller,笔记,openstack
来源: https://www.cnblogs.com/lyjx/p/14249311.html