雲計算OpenStack學習筆記六:計算組件(Nova)部署

1.組件詳解

功能:託管和管理虛擬主機html

選主機: 用戶請求 -> nova-api -> queue -> nova-scheduler -> nova-db(過濾+權重) -> nova-scheduler -> queue

建立VM: nova-compute -> queue -> nova-conductor -> nava-db -> nova-conductor -> queue -> nova-compute -> 獲取相應的資源 -> hypervisor -> 建立VMnode

訪問VM:mysql

命令行sql

瀏覽器:nova-console -> nova-cert -> nova-console數據庫

  • 組件介紹

API組件:vim

nova-api:負責接收和響應外部的操做請求,RESTful格式的API,是外部訪問Nova的惟一途徑。api

nova-api-metadata:是nova-api的一個子服務,爲VM實例的建立提供metadata信息。瀏覽器

Compute Core組件:bash

nova-scheduler:負責VM實例的資源調度,經過過濾和權重計算,來決策VM實例建立在哪一個計算節點上。網絡

nova-compute:管理VM實例,經過消息隊列接收請求,並承擔操做工做。

nova-conductor:nova-compute藉助nava-conductor實現對數據庫的訪問

Console Interface組件:

nova-cert:負責身份認證

nova-consoleauth:用戶控制檯的受權驗證

nova-novncproxy:VNC代理,支持基於瀏覽器的vnc客戶端

2.控制節點部署

  • 數據庫配置
$ mysql -u root -p
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';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'nova';

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

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

複製代碼
  • 軟件安裝
# yum install -y openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api
複製代碼
  • 配置文件修改

修改nova.conf文件

vim /etc/nova/nova.conf
[DEFAULT]
# 開發nova服務的api接口,直接取消註釋
enabled_apis = osapi_compute,metadata
[api_database]
# 配置nova-api的數據庫鏈接地址
connection = mysql+pymysql://nova:nova@controller/nova_api

[database]
# 配置nova的數據庫連接地址
connection = mysql+pymysql://nova:nova@controller/nova
[DEFAULT]
# 配置rabbitmq的連接地址
transport_url = rabbit://openstack:openstack@controller
[api]
# 配置api驗證方式,取消註釋
auth_strategy = keystone

[keystone_authtoken]
# 配置keystone的認證信息
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 = nova
[DEFAULT]
# 配置ip
my_ip = 192.168.188.100
[DEFAULT]
# 配置使用的網絡信息,直接取消註釋便可,關閉防火牆驅動
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[vnc]
enabled = true
# 開啓vnc功能,配置vnc的聯繫方式
server_listen = $my_ip
server_proxyclient_address = $my_ip
[glance]
# 配置glance的聯繫地址
api_servers = http://controller:9292
[oslo_concurrency]
# 配置鎖文件路徑
lock_path = /var/lib/nova/tmp
[placement]
# 配置資源跟蹤用戶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 = placement
複製代碼

修改placement-api的配置文件

vim /etc/httpd/conf.d/00-nova-placement-api.conf <Directory /usr/bin> = 2.4> Require all granted <IfVersion < 2.4> Order allow,deny Allow from all

重啓http服務

systemctl restart httpd

  • 信息同步

同步nova-api數據庫信息和cell0數據庫信息

# su -s /bin/sh -c "nova-manage api_db sync" nova
# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
複製代碼

建立cell1記錄,同步nova數據庫信息

# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
# su -s /bin/sh -c "nova-manage db sync" nova
複製代碼
  • 權限配置

加載admin用戶環境變量

source admin-openstack.sh

增長一個nova用戶

openstack user create --domain default --password nova nova

將nova用戶加入到service項目的admin角色組

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

建立nova服務,配置api地址記錄

openstack service create --name nova --description "OpenStack Compute" compute
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
複製代碼

建立placement用戶,該用戶用於資源的追蹤記錄。加入到service項目的admin角色組

$ openstack user create --domain default --password placement placement
$ openstack role add --project service --user placement admin
複製代碼

建立placement服務,配置api地址記錄

$ openstack service create --name placement --description "Placement API" placement
$ 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
複製代碼
  • 驗證效果
# 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
複製代碼

驗證各服務的endpoint

openstack catalog list

日誌記錄

/var/log/nova

3.計算節點部署

  • 準備工做

安裝軟件

yum install -y openstack-nova-compute sysfsutils libguestfs-tools

  • 修改配置文件
修改nova.conf配置文件
vim /etc/nova/nova.conf
[DEFAULT]
# ...
enabled_apis = osapi_compute,metadata
[DEFAULT]
# ...
transport_url = rabbit://openstack:openstack@controller
[api]
# ...
auth_strategy = 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 = nova
[DEFAULT]
# ...
my_ip = 192.168.188.101 #計算節點的IP地址
[DEFAULT]
# ...
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[vnc]
# ...
enabled = True
server_listen = 0.0.0.0
server_proxyclient_address = $my_ip
novncproxy_base_url = http://controller:6080/vnc_auto.html
[glance]
# ...
api_servers = http://controller:9292
[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 = placement

#Determine whether your compute node supports hardware acceleration for virtual machines:
#If this command returns a value of one or greater, your compute node supports hardware acceleration which typically requires no additional configuration.
#If this command returns a value of zero, your compute node does not support hardware acceleration and you must configure libvirt to use QEMU instead of KVM.
[libvirt]
# ...
virt_type = qemu
複製代碼
[DEFAULT]
# 調整計算節點提供的資源參數(由於學習環境底層是VMware虛擬機)
vif_plugging_is_fatal=false
vif_plugging_timeout=10
複製代碼

開啓服務並設置開機自啓

# systemctl enable libvirtd.service openstack-nova-compute.service
# systemctl start libvirtd.service openstack-nova-compute.service
複製代碼
  • 效果測試

控制節點添加計算節點

source admin-openstack.sh
oepnstack compute service list
複製代碼

新增計算節點記錄,添加到nova數據庫中

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

驗證全部API是否正常

nova-status upgrade check

相關文章
相關標籤/搜索