next up previous contents
Next: 計算節點安裝與設定 Up: Nova Previous: 安裝前環境準備   Contents

控制節點安裝與設定

  1. 安裝控制節點 openstack-nova-* 套件。
    [root@ip112 ~]# yum install openstack-nova-api openstack-nova-conductor \
    openstack-nova-console openstack-nova-novncproxy \
    openstack-nova-scheduler openstack-nova-placement-api
    
  2. 編輯 /etc/nova/nova.conf,設定如下章節:
    [root@ip112 ~]# vim /etc/nova/nova.conf 
    [root@ip112 ~]# egrep '^(\[DEF|\[api_d|\[data|\[api|\[keyst|\[vnc|\
    \[glance|\[oslo_c|\[place|[a-z])' /etc/nova/nova.conf 
    [DEFAULT]
    enabled_apis = osapi_compute,metadata
    transport_url = rabbit://openstack:123qwe@controller
    my_ip = 163.17.10.112
    use_neutron = True
    firewall_driver = nova.virt.firewall.NoopFirewallDriver
    [api]
    auth_strategy = keystone
    [api_database]
    connection = mysql+pymysql://nova:123qwe@controller/nova_api
    [database]
    connection = mysql+pymysql://nova:123qwe@controller/nova
    [glance]
    api_servers = http://controller:9292
    [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 = 123qwe
    [oslo_concurrency]
    lock_path = /var/lib/nova/tmp
    [placement]
    os_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 = 123qwe
    [vnc]
    enabled = true
    server_listen = $my_ip
    server_proxyclient_address = $my_ip
    
  3. 編輯 /etc/httpd/conf.d/00-nova-placement-api.conf,開放所有 IP 可以存取 /usr/bin 目錄。
    [root@ip112 ~]# vim /etc/httpd/conf.d/00-nova-placement-api.conf 
    [root@ip112 ~]# cat /etc/httpd/conf.d/00-nova-placement-api.conf
    Listen 8778
    
    <VirtualHost *:8778>
      WSGIProcessGroup nova-placement-api
      WSGIApplicationGroup %{GLOBAL}
      WSGIPassAuthorization On
      WSGIDaemonProcess nova-placement-api processes=3 threads=1 user=nova group=nova
      WSGIScriptAlias / /usr/bin/nova-placement-api
      <IfVersion >= 2.4>
        ErrorLogFormat "%M"
      </IfVersion>
      ErrorLog /var/log/nova/nova-placement-api.log
      #SSLEngine On
      #SSLCertificateFile ...
      #SSLCertificateKeyFile ...
    </VirtualHost>
    
    Alias /nova-placement-api /usr/bin/nova-placement-api
    <Location /nova-placement-api>
      SetHandler wsgi-script
      Options +ExecCGI
      WSGIProcessGroup nova-placement-api
      WSGIApplicationGroup %{GLOBAL}
      WSGIPassAuthorization On
    </Location>
    <Directory /usr/bin>
       <IfVersion >= 2.4>
          Require all granted
       </IfVersion>
       <IfVersion < 2.4>
          Order allow,deny
          Allow from all
       </IfVersion>
    </Directory>
    
  4. 重新啟動 httpd 服務。
    [root@ip112 ~]# systemctl restart httpd
    
  5. 以用戶 nova 執行 nova-manage 進行 nova-api 資料庫同步,此步驟輸出的錯誤訊息皆可忽略。
    [root@ip112 ~]# su -s /bin/sh -c "nova-manage api_db sync" nova
    /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: 
    NotSupportedWarning: Configuration option(s) ['use_tpool'] not supported
    exception.NotSupportedWarning
    
  6. 以用戶 nova 執行 nova-manage 產生 cell0 資料庫,此步驟輸出的錯誤訊息皆可忽略。
    [root@ip112 ~]# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
    /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: 
    NotSupportedWarning: Configuration option(s) ['use_tpool'] not supported
      exception.NotSupportedWarning
    
  7. 以用戶 nova 執行 nova-manage 產生 cell1 資料庫,此步驟輸出的錯誤訊息皆可忽略。
    [root@ip112 ~]# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
    /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: 
    NotSupportedWarning: Configuration option(s) ['use_tpool'] not supported
      exception.NotSupportedWarning
    4b4e2923-ee89-4057-b7d1-473951f313c2
    
  8. 以用戶 nova 執行 nova-manage 進行 nova 資料庫同步,此步驟輸出的錯誤訊息皆可忽略。
    [root@ip112 ~]# su -s /bin/sh -c "nova-manage db sync" nova
    /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: 
    NotSupportedWarning: Configuration option(s) ['use_tpool'] not supported
      exception.NotSupportedWarning
    /usr/lib/python2.7/site-packages/pymysql/cursors.py:166: Warning: (1831, 
    u'Duplicate index `block_device_mapping_instance_uuid_virtual_name_device_name_idx`. 
    This is deprecated and will be disallowed in a future release.')
      result = self._query(query)
    /usr/lib/python2.7/site-packages/pymysql/cursors.py:166: Warning: (1831, u'Duplicate 
    index `uniq_instances0uuid`. This is deprecated and will be disallowed in a future release.')
      result = self._query(query)
    
  9. 確認 nova cell0 cell1 註冊正確,此步驟輸出的錯誤訊息皆可忽略。
    [root@ip112 ~]# 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
    +-------+--------------------------------------+
    |  Name |                 UUID                 |
    +-------+--------------------------------------+
    | cell0 | 00000000-0000-0000-0000-000000000000 |
    | cell1 | 4b4e2923-ee89-4057-b7d1-473951f313c2 |
    +-------+--------------------------------------+
    
    ------------------------------------+-------------------------------------------------+
               Transport URL            |               Database Connection               |
    ------------------------------------+-------------------------------------------------+
                   none:/               | mysql+pymysql://nova:****@controller/nova_cell0 |
     rabbit://openstack:****@controller |    mysql+pymysql://nova:****@controller/nova    |
    ------------------------------------+-------------------------------------------------+
    
  10. 啟動 openstack-nova 控制節點相關的服務,並設定開機啟動。
    [root@ip112 ~]# systemctl enable openstack-nova-api.service \
    openstack-nova-consoleauth.service openstack-nova-scheduler.service \
    openstack-nova-conductor.service openstack-nova-novncproxy.service
    [root@ip112 ~]# systemctl start openstack-nova-api.service \
    openstack-nova-consoleauth.service openstack-nova-scheduler.service \
    openstack-nova-conductor.service openstack-nova-novncproxy.service
    



De-Yu Wang 2018-12-12