當前位置:網站首頁>nova安裝(wallaby-allinone)

nova安裝(wallaby-allinone)

2022-01-27 07:56:46 JJFLY66

nova安裝(wallaby-allinone)

本節介紹如何在控制器節點上安裝和配置代號為nova的Compute服務。

1 必須

在安裝和配置 Compute 服務之前,您必須創建數據庫、服務憑證和 API 端點。

  1. 要創建數據庫,請完成以下步驟:

    • 使用數據庫訪問客戶端以root用戶身份連接數據庫服務器:

      $ mysql -u root -p
      
    • 創建nova_apinovanova_cell0數據庫:

      MariaDB [(none)]> CREATE DATABASE nova_api;
      MariaDB [(none)]> CREATE DATABASE nova;
      MariaDB [(none)]> CREATE DATABASE nova_cell0;
      
    • 授予對數據庫的適當訪問權限:

      MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';
      MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';
      
      MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';
      MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';
      
      MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';
      MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';
      

      替換NOVA_DBPASS為合適的密碼。這裏為123456

    • 退出數據庫訪問客戶端。

      [外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-6OqMJ2wB-1642475975758)(C:\Users\10973\AppData\Roaming\Typora\typora-user-images\image-20211130195010888.png)]

  2. 來源admin憑據來訪問僅管理員CLI命令:

    $ . admin-openrc.sh
    
  3. 創建計算服務憑證:

    • 創建nova用戶:

      $ openstack user create --domain default --password-prompt nova
      
      User Password:
      Repeat User Password:
      +---------------------+----------------------------------+
      | Field               | Value                            |
      +---------------------+----------------------------------+
      | domain_id           | default                          |
      | enabled             | True                             |
      | id                  | 8a7dbf5279404537b1c7b86c033620fe |
      | name                | nova                             |
      | options             | {}                               |
      | password_expires_at | None                             |
      +---------------------+----------------------------------+
      

      密碼為123456

      [外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-jdeHGOYh-1642475975760)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20211110181904559.png)]

    • adminnova用戶添加角色:

      $ openstack role add --project service --user nova admin
      

      此命令不提供任何輸出。

    • 創建nova服務實體:

      $ openstack service create --name nova --description "OpenStack Compute" compute
      
      +-------------+----------------------------------+
      | Field       | Value                            |
      +-------------+----------------------------------+
      | description | OpenStack Compute                |
      | enabled     | True                             |
      | id          | 060d59eac51b4594815603d75a00aba2 |
      | name        | nova                             |
      | type        | compute                          |
      +-------------+----------------------------------+
      
  4. 創建 Compute API 服務端點:

    $ openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1
    
    +--------------+-------------------------------------------+
    | 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               |
    +--------------+-------------------------------------------+
    
    $ openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1
    
    +--------------+-------------------------------------------+
    | 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               |
    +--------------+-------------------------------------------+
    
    $ openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1
    
    +--------------+-------------------------------------------+
    | 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               |
    +--------------+-------------------------------------------+
    
  5. 安裝 Placement 服務並配置用戶和端點:

安裝和配置組件

默認配置文件因發行版而异。您可能需要添加這些部分和選項,而不是修改現有的部分和選項。此外,...配置片段中的省略號 ( ) 錶示您應該保留的潜在默認配置選項。

  1. 安裝軟件包:

    openstack-nova-conductor 提供數據庫連接等功能

    openstack-nova-novncproxy 遠程訪問雲主機

    openstack-nova-scheduler 資源統一調度

    # yum install openstack-nova-api openstack-nova-conductor openstack-nova-novncproxy openstack-nova-scheduler -y
    
  2. 編輯/etc/nova/nova.conf文件並完成以下操作:

    • 在該[DEFAULT]部分中,僅啟用計算和元數據 API:

      [DEFAULT]
      # ...
      enabled_apis = osapi_compute,metadata
      
    • [api_database][database]部分,配置數據庫訪問:

      [api_database]
      # ...
      connection = mysql+pymysql://nova:[email protected]/nova_api
      
      [database]
      # ...
      connection = mysql+pymysql://nova:[email protected]/nova
      

      替換NOVA_DBPASS為您為 Compute 數據庫選擇的密碼。 這裏為123456

    • 在該[DEFAULT]部分,配置RabbitMQ消息隊列訪問:

      [DEFAULT]
      # ...
      transport_url = rabbit://openstack:[email protected]:5672/
      
    • [api][keystone_authtoken]部分,配置身份服務訪問:

      [api]
      # ...
      auth_strategy = keystone
      
      [keystone_authtoken]
      # ...
      www_authenticate_uri = http://controller:5000/
      auth_url = http://controller:5000/
      memcached_servers = controller:11211
      auth_type = password
      project_domain_name = Default
      user_domain_name = Default
      project_name = service
      username = nova
      password = NOVA_PASS
      

    替換NOVA_PASS為您nova在身份服務中為用戶選擇的密碼。這裏為123456

注釋掉或删除該[keystone_authtoken] 部分中的任何其他選項。

  • 在該[DEFAULT]部分中,配置my_ip選項以使用控制器節點的管理接口 IP 地址:

    [DEFAULT]
    # 
    my_ip = 172.31.7.120 #這裏是controller主機的ip地址
    
  • 配置**/etc/nova/nova.conf**的[neutron]部分。有關更多詳細信息,請參閱網絡服務安裝指南

  • 在該[glance]部分中,配置 Image 服務 API 的比特置:

    [glance]
    # ...
    api_servers = http://controller:9292
    
  • 在該[oslo_concurrency]部分中,配置鎖定路徑:

    [oslo_concurrency]
    # ...
    lock_path = /var/lib/nova/tmp
    
  • [placement]部分中,配置對 Placement 服務的訪問:

    [placement]
    # ...
    region_name = RegionOne
    project_domain_name = Default
    project_name = service
    auth_type = password
    user_domain_name = Default
    auth_url = http://controller:5000/v3
    username = placement
    password = PLACEMENT_PASS
    

    替換PLACEMENT_PASS為您為placement安裝Placement時創建的服務用戶 選擇的密碼 。注釋掉或删除該[placement]部分中的任何其他選項。

  1. 填充nova-api數據庫:

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

    忽略此輸出中的任何弃用消息。

  2. 注册cell0數據庫:

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

    這裏也要講policy.json轉化為policy.yaml

    cd /etc/nova/
    ls
    
    oslopolicy-convert-json-to-yaml --namespace placement --policy-file policy.json --output-file policy.yaml
    cp policy.json policy.json.bak
    rm -r policy.json
    su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
    
  3. 創建cell1單元格:

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

    填充 nova 數據庫:

    # su -s /bin/sh -c "nova-manage db sync" nova
    
  4. 驗證 nova cell0 和 cell1 是否正確注册:

    # su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova
    +-------+--------------------------------------+----------------------------------------------------+--------------------------------------------------------------+----------+
    |  Name |                 UUID                 |                   Transport URL                    |                     Database Connection                      | Disabled |
    +-------+--------------------------------------+----------------------------------------------------+--------------------------------------------------------------+----------+
    | cell0 | 00000000-0000-0000-0000-000000000000 |                       none:/                       | mysql+pymysql://nova:****@controller/nova_cell0?charset=utf8 |  False   |
    | cell1 | f690f4fd-2bc5-4f15-8145-db561a7b9d3d | rabbit://openstack:****@controller:5672/nova_cell1 | mysql+pymysql://nova:****@controller/nova_cell1?charset=utf8 |  False   |
    +-------+--------------------------------------+----------------------------------------------------+--------------------------------------------------------------+----------+
    

數據庫中也是有數據的

完成安裝

  • 啟動 Compute 服務並將它們配置為在系統啟動時啟動:

    systemctl enable openstack-nova-api.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
    systemctl start openstack-nova-api.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
    systemctl status openstack-nova-api.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
    

compute節點(由於是allinone,所以在同一臺機器簡單部署)

安裝和配置組件

  1. 安裝軟件包:

    # yum install openstack-nova-compute -y
    
  2. 編輯/etc/nova/nova.conf文件並完成以下操作:

    • 在該[DEFAULT]部分中,配置my_ip選項:

      [DEFAULT]
      # firewall
      use_neutron = true
      firewall_driver = nova.virt.firewall.NoopFirewallDriver
      
    • [vnc]部分中,啟用和配置遠程控制臺訪問:

      [vnc]
      # ...vnc
      enabled = true
      server_listen = 0.0.0.0
      server_proxyclient_address = $my_ip
      novncproxy_base_url = http://controller:6080/vnc_auto.html
      

      服務器組件偵聽所有 IP 地址,代理組件僅偵聽計算節點的管理接口 IP 地址。基本 URL 指示您可以使用 Web 瀏覽器訪問此計算節點上實例的遠程控制臺的比特置。

      如果用於訪問遠程控制臺的 Web 瀏覽器駐留在無法解析controller主機名的主機上,則必須替換 controller為控制器節點的管理接口 IP 地址。

完成安裝

  1. 確定您的計算節點是否支持虛擬機的硬件加速:

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

    如果此命令返回值one or greater,則您的計算節點支持硬件加速,這通常不需要額外配置。

    如果此命令返回值zero,則您的計算節點不支持硬件加速,您必須配置libvirt為使用 QEMU 而不是 KVM。

    • 編輯文件中的[libvirt]部分,/etc/nova/nova.conf如下所示:

      [libvirt]
      # ...
      virt_type = qemu
      
  2. 啟動 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。該錯誤消息可能錶明控制器節點上的防火牆阻止訪問端口 5672。將防火牆配置為打開控制器節點上的端口 5672 並重新啟動 計算節點上的服務。AMQP server on controller:5672 is unreachable``nova-compute

將計算節點添加到cell數據庫中

控制器節點上運行以下命令。

  1. 獲取管理員憑據以啟用僅限管理員的 CLI 命令,然後確認數據庫中有計算主機:

    $ . admin-openrc.sh
    
    $ openstack compute service list --service nova-compute
    +----+-------+--------------+------+-------+---------+----------------------------+
    | ID | Host  | Binary       | Zone | State | Status  | Updated At                 |
    +----+-------+--------------+------+-------+---------+----------------------------+
    | 1  | node1 | nova-compute | nova | up    | enabled | 2017-04-14T15:30:44.000000 |
    +----+-------+--------------+------+-------+---------+----------------------------+
    
  2. 發現計算主機:

    # su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
    
    Found 2 cell mappings.
    Skipping cell0 since it does not contain hosts.
    Getting compute nodes from cell 'cell1': ad5a5985-a719-4567-98d8-8d148aaae4bc
    Found 1 computes in cell: ad5a5985-a719-4567-98d8-8d148aaae4bc
    Checking host mapping for compute host 'compute': fe58ddc1-1d65-4f87-9456-bc040dc106b3
    Creating host mapping for compute host 'compute': fe58ddc1-1d65-4f87-9456-bc040dc106b3
    

    添加新計算節點時,您必須在控制器節點上運行nova-manage cell_v2 discover_hosts以注册這些新計算節點。或者,您可以在/etc/nova/nova.conf中設置適當的間隔 :

    [scheduler]
    discover_hosts_in_cells_interval = 300
    
    
    

驗證操作

驗證計算服務的運行。

在控制器節點上執行這些命令。

  1. 來源admin憑據來訪問僅管理員CLI命令:
   $ . admin-openrc.sh
  1. 列出服務組件以驗證每個進程的成功啟動和注册:
   $ openstack compute service list

   +----+--------------------+------------+----------+---------+-------+----------------------------+
   | Id | Binary             | Host       | Zone     | Status  | State | Updated At                 |
   +----+--------------------+------------+----------+---------+-------+----------------------------+
   |  1 | nova-scheduler     | controller | internal | enabled | up    | 2016-02-09T23:11:15.000000 |
   |  2 | nova-conductor     | controller | internal | enabled | up    | 2016-02-09T23:11:16.000000 |
   |  3 | nova-compute       | compute1   | nova     | enabled | up    | 2016-02-09T23:11:20.000000 |
   +----+--------------------+------------+----------+---------+-------+----------------------------+

此輸出應指示在控制器節點上啟用的兩個服務組件和在計算節點上啟用的一個服務組件。

[外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-REuoiHpj-1642475975761)(C:\Users\10973\AppData\Roaming\Typora\typora-user-images\image-20211201135730943.png)]

  1. 列出身份服務中的 API 端點以驗證與身份服務的連接:

    以下端點列錶可能因 OpenStack 組件的安裝而异。

   $ openstack catalog list

   +-----------+-----------+-----------------------------------------+
   | Name      | Type      | Endpoints                               |
   +-----------+-----------+-----------------------------------------+
   | keystone  | identity  | RegionOne                               |
   |           |           |   public: http://controller:5000/v3/    |
   |           |           | RegionOne                               |
   |           |           |   internal: http://controller:5000/v3/  |
   |           |           | RegionOne                               |
   |           |           |   admin: http://controller:5000/v3/     |
   |           |           |                                         |
   | glance    | image     | RegionOne                               |
   |           |           |   admin: http://controller:9292         |
   |           |           | RegionOne                               |
   |           |           |   public: http://controller:9292        |
   |           |           | RegionOne                               |
   |           |           |   internal: http://controller:9292      |
   |           |           |                                         |
   | nova      | compute   | RegionOne                               |
   |           |           |   admin: http://controller:8774/v2.1    |
   |           |           | RegionOne                               |
   |           |           |   internal: http://controller:8774/v2.1 |
   |           |           | RegionOne                               |
   |           |           |   public: http://controller:8774/v2.1   |
   |           |           |                                         |
   | placement | placement | RegionOne                               |
   |           |           |   public: http://controller:8778        |
   |           |           | RegionOne                               |
   |           |           |   admin: http://controller:8778         |
   |           |           | RegionOne                               |
   |           |           |   internal: http://controller:8778      |
   |           |           |                                         |
   +-----------+-----------+-----------------------------------------+

忽略此輸出中的任何警告。

[外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-Oiv9ziQY-1642475975762)(C:\Users\10973\AppData\Roaming\Typora\typora-user-images\image-20211201135748151.png)]

  1. 列出 Image 服務中的圖像以驗證與 Image 服務的連接:
   $ openstack image list

   +--------------------------------------+-------------+-------------+
   | ID                                   | Name        | Status      |
   +--------------------------------------+-------------+-------------+
   | 9a76d9f9-9620-4f2e-8c69-6c5691fae163 | cirros      | active      |
   +--------------------------------------+-------------+-------------+

[外鏈圖片轉存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-BADgnaYx-1642475975763)(C:\Users\10973\AppData\Roaming\Typora\typora-user-images\image-20211201135814042.png)]

  1. 檢查單元和放置 API 是否成功運行,以及其他必要的先决條件是否到比特:
   # nova-status upgrade check

   +--------------------------------------------------------------------+
   | Upgrade Check Results                                              |
   +--------------------------------------------------------------------+
   | Check: Cells v2                                                    |
   | Result: Success                                                    |
   | Details: None                                                      |
   +--------------------------------------------------------------------+
   | Check: Placement API                                               |
   | Result: Success                                                    |
   | Details: None                                                      |
   +--------------------------------------------------------------------+
   | Check: Cinder API                                                  |
   | Result: Success                                                    |
   | Details: None                                                      |
   +--------------------------------------------------------------------+
   | Check: Policy Scope-based Defaults                                 |
   | Result: Success                                                    |
   | Details: None                                                      |
   +--------------------------------------------------------------------+
   | Check: Policy File JSON to YAML Migration                          |
   | Result: Success                                                    |
   | Details: None                                                      |
   +--------------------------------------------------------------------+
   | Check: Older than N-1 computes                                     |
   | Result: Success                                                    |
   | Details: None                                                      |
   +--------------------------------------------------------------------+

Nova安裝完畢

版權聲明
本文為[JJFLY66]所創,轉載請帶上原文鏈接,感謝
https://cht.chowdera.com/2022/01/202201270756457817.html