安装并配置控制节点

安装并配置控制节点

这个部分将描述如何在控制节点上安装和配置 Compute 服务,即 nova。

先决条件

在安装和配置 Compute 服务前,你必须创建数据库服务的凭据以及 API endpoints。

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

    • Create the nova_api, nova, and nova_cell0 databases:

      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

    • 退出数据库客户端。

  2. 获得 admin 凭证来获取只有管理员能执行的命令的访问权限:

    $ . admin-openrc
    
  3. Create the Compute service credentials:

    • 创建 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                             |
      +---------------------+----------------------------------+
      
    • nova 用户添加 admin 角色:

      $ 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. Create the Compute API service endpoints:

    $ 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. Create a Placement service user using your chosen PLACEMENT_PASS:

    $ openstack user create --domain default --password-prompt placement
    
    User Password:
    Repeat User Password:
    +---------------------+----------------------------------+
    | Field               | Value                            |
    +---------------------+----------------------------------+
    | domain_id           | default                          |
    | enabled             | True                             |
    | id                  | fa742015a6494a949f67629884fc7ec8 |
    | name                | placement                        |
    | options             | {}                               |
    | password_expires_at | None                             |
    +---------------------+----------------------------------+
    
  6. Add the Placement user to the service project with the admin role:

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

    注解

    这个命令执行后没有输出。

  7. Create the Placement API entry in the service catalog:

    $ openstack service create --name placement --description "Placement API" placement
    +-------------+----------------------------------+
    | Field       | Value                            |
    +-------------+----------------------------------+
    | description | Placement API                    |
    | enabled     | True                             |
    | id          | 2d1a27022e6e4185b86adac4444c495f |
    | name        | placement                        |
    | type        | placement                        |
    +-------------+----------------------------------+
    
  8. Create the Placement API service endpoints:

    $ openstack endpoint create --region RegionOne placement public http://controller:8778
    +--------------+----------------------------------+
    | Field        | Value                            |
    +--------------+----------------------------------+
    | enabled      | True                             |
    | id           | 2b1b2637908b4137a9c2e0470487cbc0 |
    | interface    | public                           |
    | region       | RegionOne                        |
    | region_id    | RegionOne                        |
    | service_id   | 2d1a27022e6e4185b86adac4444c495f |
    | service_name | placement                        |
    | service_type | placement                        |
    | url          | http://controller:8778           |
    +--------------+----------------------------------+
    
    $ openstack endpoint create --region RegionOne placement internal http://controller:8778
    +--------------+----------------------------------+
    | Field        | Value                            |
    +--------------+----------------------------------+
    | enabled      | True                             |
    | id           | 02bcda9a150a4bd7993ff4879df971ab |
    | interface    | internal                         |
    | region       | RegionOne                        |
    | region_id    | RegionOne                        |
    | service_id   | 2d1a27022e6e4185b86adac4444c495f |
    | service_name | placement                        |
    | service_type | placement                        |
    | url          | http://controller:8778           |
    +--------------+----------------------------------+
    
    $ openstack endpoint create --region RegionOne placement admin http://controller:8778
    +--------------+----------------------------------+
    | Field        | Value                            |
    +--------------+----------------------------------+
    | enabled      | True                             |
    | id           | 3d71177b9e0f406f98cbff198d74b182 |
    | interface    | admin                            |
    | region       | RegionOne                        |
    | region_id    | RegionOne                        |
    | service_id   | 2d1a27022e6e4185b86adac4444c495f |
    | service_name | placement                        |
    | service_type | placement                        |
    | url          | http://controller:8778           |
    +--------------+----------------------------------+
    

安全并配置组件

注解

默认配置文件在各发行版本中可能不同。你可能需要添加这些部分,选项而不是修改已经存在的部分和选项。另外,在配置片段中的省略号(...)表示默认的配置选项你应该保留。

  1. 编辑``/etc/nova/nova.conf``文件并完成下面的操作:

    • 在``[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”。

    • In the [api] and [keystone_authtoken] sections, configure Identity service access:

      [api]
      # ...
      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
      
  • 在``[vnc]``部分,配置VNC代理使用控制节点的管理接口IP地址 :

    [vnc]
    enabled = true
    # ...
    vncserver_listen = $my_ip
    vncserver_proxyclient_address = $my_ip
    
  • [glance] 区域,配置镜像服务 API 的位置:

    [glance]
    # ...
    api_servers = http://controller:9292
    
  • 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://controller:35357/v3
    username = placement
    password = PLACEMENT_PASS
    

    Replace PLACEMENT_PASS with the password you choose for the placement user in the Identity service. Comment out any other options in the [placement] section.

完成安装

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.