Openstack(九)部署nova服務(控制節點)

 

 

 

9.1nova服務介紹

nova是openstack最先的組件之一,nova分爲控制節點和計算節點,計算節點經過nova computer進行虛擬機建立,經過libvirt調用kvm建立虛擬機,nova之間通訊經過rabbitMQ隊列進行通訊,其組件和功能以下:html

API:負責接收和響應外部請求。mysql

Scheduler:負責調度虛擬機所在的物理機。sql

Conductor:計算節點訪問數據庫的中間件。數據庫

Consoleauth:用於控制檯的受權認證。apache

Novncproxy:VNC 代理,用於顯示虛擬機操做終端。vim

官方部署文檔:https://docs.openstack.org/mitaka/zh_CN/install-guide-rdo/common/get_started_compute.htmlapi

 

Nova-API的功能:bash

Nova-api組件實現了restful API的功能,接收和響應來自最終用戶的計算API請求,接收外部的請求並經過message queue將請求發動給其餘服務組件,同時也兼容EC2 API,因此也能夠使用EC2的管理工具對nova進行平常管理。服務器

nova scheduler:restful

nova scheduler模塊在openstack中的做用是決策虛擬機建立在哪一個主機(計算節點)上。決策一個虛擬機應該調度到某物理節點,須要分爲兩個步驟:

過濾(filter),過濾出能夠建立虛擬機的主機

 

9.2安裝nove控制節點

官方安裝文檔:https://docs.openstack.org/ocata/zh_CN/install-guide-rdo/nova-controller-install.html

9.2.1安裝nova控制端

# 在控制服務器安裝

# yum install openstack-nova-api openstack-nova-conductor   openstack-nova-console openstack-nova-novncproxy   openstack-nova-scheduler openstack-nova-placement-api

 

9.2.2數據庫準備

# 注mariaDB使用時需三個庫都添加本主機權限GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'<主機名>' IDENTIFIED BY 'nova123';

# mysql

> CREATE DATABASE nova_api;

> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'nova123';

> CREATE DATABASE nova;

> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%'  IDENTIFIED BY 'nova123';

> CREATE DATABASE nova_cell0;

> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'nova123';

> flush privileges;

9.2.3驗證數據庫

9.3配置nova控制端服務

控制端服務器操做

9.3.1建立nova服務

# openstack service create --name nova --description "OpenStack Compute" compute

+-------------+----------------------------------+

| Field       | Value                            |

+-------------+----------------------------------+

| description | OpenStack Compute                |

| enabled     | True                             |

| id          | f5d5af647ae040eca5bf7d878c23086d |

| name        | nova                             |

| type        | compute                          |

+-------------+----------------------------------+

9.3.2建立公共端點

# openstack endpoint create --region RegionOne  compute public http://192.168.10.100:8774/v2.1

+--------------+----------------------------------+

| Field        | Value                            |

+--------------+----------------------------------+

| enabled      | True                             |

| id           | 9ea17b1200fc40ed84de2c66651d8298 |

| interface    | public                           |

| region       | RegionOne                        |

| region_id    | RegionOne                        |

| service_id   | f5d5af647ae040eca5bf7d878c23086d |

| service_name | nova                             |

| service_type | compute                          |

| url          | http://192.168.10.100:8774/v2.1  |

+--------------+----------------------------------+

9.3.3建立私有端點

# openstack endpoint create --region RegionOne  compute internal http://192.168.10.100:8774/v2.1

+--------------+----------------------------------+

| Field        | Value                            |

+--------------+----------------------------------+

| enabled      | True                             |

| id           | cc3e3b629fbf44a69948922773836804 |

| interface    | internal                         |

| region       | RegionOne                        |

| region_id    | RegionOne                        |

| service_id   | f5d5af647ae040eca5bf7d878c23086d |

| service_name | nova                             |

| service_type | compute                          |

| url          | http://192.168.10.100:8774/v2.1  |

+--------------+----------------------------------+

9.3.4建立管理端點

# openstack endpoint create --region RegionOne compute admin http://192.168.10.100:8774/v2.1

+--------------+----------------------------------+

| Field        | Value                            |

+--------------+----------------------------------+

| enabled      | True                             |

| id           | 51dca1e673ee419f8c75fb9646520003 |

| interface    | admin                            |

| region       | RegionOne                        |

| region_id    | RegionOne                        |

| service_id   | f5d5af647ae040eca5bf7d878c23086d |

| service_name | nova                             |

| service_type | compute                          |

| url          | http://192.168.10.100:8774/v2.1  |

+--------------+----------------------------------+

9.3.5建立placement用戶

# Placement用戶密碼設置爲placement

# openstack user create --domain default --password-prompt placement

User Password:

Repeat User Password:

+---------------------+----------------------------------+

| Field               | Value                            |

+---------------------+----------------------------------+

| domain_id           | 961b40ed4c6b40a9b266ce5e451a4292 |

| enabled             | True                             |

| id                  | f052cbbd13d341e3bee6a0da23588802 |

| name                | placement                        |

| options             | {}                               |

| password_expires_at | None                             |

+---------------------+----------------------------------+

9.3.6受權placement用戶admin權限

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

9.3.7建立placement API並註冊

# openstack service create --name placement --description "Placement API" placement

+-------------+----------------------------------+

| Field       | Value                            |

+-------------+----------------------------------+

| description | Placement API                    |

| enabled     | True                             |

| id          | af5b2be1a8e24a2d9a619f318a04022a |

| name        | placement                        |

| type        | placement                        |

+-------------+----------------------------------+

# openstack endpoint create --region RegionOne placement public http://192.168.10.100:8778

+--------------+----------------------------------+

| Field        | Value                            |

+--------------+----------------------------------+

| enabled      | True                             |

| id           | c1eb9cc9c3bf42bd9b49ac86b309fe2b |

| interface    | public                           |

| region       | RegionOne                        |

| region_id    | RegionOne                        |

| service_id   | af5b2be1a8e24a2d9a619f318a04022a |

| service_name | placement                        |

| service_type | placement                        |

| url          | http://192.168.10.100:8778       |

+--------------+----------------------------------+

# openstack endpoint create --region RegionOne placement internal http://192.168.10.100:8778

+--------------+----------------------------------+

| Field        | Value                            |

+--------------+----------------------------------+

| enabled      | True                             |

| id           | 65cf7e1dbeac440ea6a4e369e816d83e |

| interface    | internal                         |

| region       | RegionOne                        |

| region_id    | RegionOne                        |

| service_id   | af5b2be1a8e24a2d9a619f318a04022a |

| service_name | placement                        |

| service_type | placement                        |

| url          | http://192.168.10.100:8778       |

+--------------+----------------------------------+

# openstack endpoint create --region RegionOne placement admin http://192.168.10.100:8778

+--------------+----------------------------------+

| Field        | Value                            |

+--------------+----------------------------------+

| enabled      | True                             |

| id           | 8c073907d3d84c5995df683b0a2c4f5b |

| interface    | admin                            |

| region       | RegionOne                        |

| region_id    | RegionOne                        |

| service_id   | af5b2be1a8e24a2d9a619f318a04022a |

| service_name | placement                        |

| service_type | placement                        |

| url          | http://192.168.10.100:8778       |

+--------------+----------------------------------+

9.3.8配置nova.conf配置文件

# 詳細配置文件/etc/nova/nova.conf

 

1:[DEFAULT]

2306:use_neutron=true

2465:firewall_driver=nova.virt.firewall.NoopFirewallDriver

2629:enabled_apis=osapi_compute,metadata

3021:transport_url = rabbit://openstack:123456@192.168.10.205

3028:rpc_backend=rabbit

3069:[api]

3085:auth_strategy=keystone

3367:[api_database]

3380:connection = mysql+pymysql://nova:nova123@192.168.10.100/nova_api

4370:[database]

4398:connection = mysql+pymysql://nova:nova123@192.168.10.100/nova

4939:[glance]

4957:api_servers=http://192.168.10.100:9292

5598:[keystone_authtoken]

5599:auth_uri = http://192.168.10.100:5000

5600:auth_url = http://192.168.10.100:35357

5601:memcached_servers = 192.168.10.100:11211

5602:auth_type = password

5603:project_domain_name = default

5604:user_domain_name = default

5605:project_name = service

5606:username = nova

5607:password = nova

7235:[oslo_concurrency]

7250:lock_path=/var/lib/nova/tmp

8081:[placement]

8082:os_region_name = RegionOne

8083:project_domain_name = Default

8084:project_name = service

8085:auth_type = password

8086:user_domain_name = Default

8087:auth_url = http://192.168.10.100:35357/v3

8088:username = placement

8089:password = placement

9669:[vnc]

9685:enabled=true

9708:vncserver_listen=192.168.10.201

9720:vncserver_proxyclient_address=192.168.10.201

9.3.9配置apache服務placement API

# vim /etc/httpd/conf.d/00-nova-placement-api.conf

#最下方添加如下配置:

<Directory /usr/bin>

   <IfVersion >= 2.4>

      Require all granted

   </IfVersion>

   <IfVersion < 2.4>

      Order allow,deny

      Allow from all

   </IfVersion>

</Directory>

 

# systemctl restart httpd  #重啓http服務

9.3.10初始化數據庫

#nova_api數據庫

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

#nova數據庫

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

#nova cell0數據庫

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

#nova cell1 數據庫

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

7972a48a-bddb-4957-b773-852565a25725

9.4驗證nova cell0和nova cell1是否正常註冊

# nova-manage cell_v2 list_cells

+-------+--------------------------------------+

|  Name |                 UUID                 |

+-------+--------------------------------------+

| cell0 | 00000000-0000-0000-0000-000000000000 |

| cell1 | 7972a48a-bddb-4957-b773-852565a25725 |

+-------+--------------------------------------+

9.5啓動並將nova服務設置爲開機啓動

# 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

 

9.6重啓nova控制端腳本

# cat nova-restart.sh

#!/bin/bash

systemctl restart openstack-nova-api.service   openstack-nova-consoleauth.service openstack-nova-scheduler.service   openstack-nova-conductor.service openstack-nova-novncproxy.service

# chmod  a+x nova-restart.sh

9.7查看nova服務日誌

9.8查看rabbitMQ鏈接

9.9驗證nova控制端:

# nova service-list

相關文章
相關標籤/搜索