七、OpenStack服務-Nova(計算節點)


本章目錄

1、概述
2、安裝配置計算節點

一、概述

計算節點上:https://docs.openstack.org/nova/rocky/install/compute-install.html
nova-compute調用libvirtd來創建虛擬機
nova-compute的功能可以分為兩類:

  • 定時向OpenStack報告計算節點的狀態
  • 實現instance聲明周期的管理

1、安裝nova-compute

[root@compute1 ~]# yum install openstack-nova-compute
[root@compute1 ~]# yum -y install openstack-utils.noarch (目的是支持自動化配置)

實例:
openstack-config --set /etc/nova/nova.conf DEFAULT enabled_apis osapi_compute,metadata

2、將控制節點的配置文件復制到計算節點上,並做相應修改

[root@controller ~]# scp /etc/nova/nova.conf 192.168.223.171:/root/

刪除數據庫相關配置:
[api_database]
connection=mysql://nova:nova@controller/nova_api #刪除該行

[database]
connection=mysql+pymysql://nova:nova@controller/nova #刪除


my_ip=192.168.223.171  #改為171,管理接口的ip地址,可以使第一個計算節點

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

[root@compute1 ~]# cat nove.conf #可以通過md5sum 來確定文件修改是否一致
[DEFAULT]
enabled_apis=osapi_compute,metadata
transport_url = rabbit://openstack:openstack@controller
my_ip = 192.168.223.171
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api]
auth_strategy = keystone
[api_database]
[barbican]
[cache]
[cells]
[cinder]
[compute]
[conductor]
[console]
[consoleauth]
[cors]
[database]
[devices]
[ephemeral_storage_encryption]
[filter_scheduler]
[glance]
api_servers = http://controller:9292
[guestfs]
[healthcheck]
[hyperv]
[ironic]
[key_manager]
[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
[libvirt]
[matchmaker_redis]
[metrics]
[mks]
[neutron]
[notifications]
[osapi_v21]
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_messaging_zmq]
[oslo_middleware]
[oslo_policy]
[pci]
[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
[placement_database]
[powervm]
[profiler]
[quota]
[rdp]
[remote_debug]
[scheduler]
[serial_console]
[service_user]
[spice]
[upgrade_levels]
[vault]
[vendordata_dynamic_auth]
[vmware]
[vnc]
enabled = true
server_listen = 0.0.0.0
server_proxyclient_address = $my_ip
novncproxy_base_url = http://controller:6080/vnc_auto.html  #改為控制節點的IP地址,或者不修改,去修改windows的hosts文件
[workarounds]
[wsgi]
[xenserver]
[xvp]
[zvm]

要修改屬性,要不然無法啟動:
[root@compute1 ~]# chown root.nova /etc/nova/nova.conf

3、開啟服務:

1、查看是否支持虛擬化
[root@compute1 ~]# egrep -c '(vmx|svm)' /proc/cpuinfo
1
如果返回大於0的數不用做操作,如果返回0,添加如下配置在/etc/nova/nova.conf :
[libvirt]
# ...
virt_type = qemu
2、開啟
# systemctl enable libvirtd.service openstack-nova-compute.service
# systemctl start libvirtd.service openstack-nova-compute.service

如果無法啟動:
保證rabbit密碼前后一致:
Nova日志報錯AMQP服務器5672不可訪問
一、報錯信息如下
二、解決方法如下
1.防火牆未關閉或5672端口未打開
2.配置文件有誤

4、在控制節點上查看主機

1、查看計算節點

[root@controller ~]# . admin-openrc
[root@controller ~]#  openstack compute service list --service nova-compute
+----+--------------+----------+------+---------+-------+----------------------------+
| ID | Binary       | Host     | Zone | Status  | State | Updated At                 |
+----+--------------+----------+------+---------+-------+----------------------------+
|  6 | nova-compute | compute1 | nova | enabled | up    | 2020-02-21T20:13:45.000000 |
+----+--------------+----------+------+---------+-------+----------------------------+
2、同步數據庫
[root@controller ~]# 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 computes from cell 'cell1': d7d3098d-56b4-4be0-918e-81613a293407
Checking host mapping for compute host 'compute1': 07281b53-0154-4cd7-9925-f887140af17b
Creating host mapping for compute host 'compute1': 07281b53-0154-4cd7-9925-f887140af17b
Found 1 unmapped computes in cell: d7d3098d-56b4-4be0-918e-81613a293407
[root@controller ~]# 

注意:

When you add new compute nodes, you must run nova-manage cell_v2 discover_hosts on the controller node to register those new compute nodes. Alternatively, you can set an appropriate interval in /etc/nova/nova.conf:

[scheduler]
discover_hosts_in_cells_interval = 300

5、驗證

[root@host157_node1 ~]# . admin-openstack.sh 
[root@host157_node1 ~]# openstack compute service list
+----+------------------+---------------+----------+---------+-------+----------------------------+
| ID | Binary           | Host          | Zone     | Status  | State | Updated At                 |
+----+------------------+---------------+----------+---------+-------+----------------------------+
|  1 | nova-consoleauth | host157_node1 | internal | enabled | up    | 2019-12-15T15:24:21.000000 |
|  2 | nova-conductor   | host157_node1 | internal | enabled | up    | 2019-12-15T15:24:21.000000 |
|  3 | nova-scheduler   | host157_node1 | internal | enabled | up    | 2019-12-15T15:24:31.000000 |
|  6 | nova-compute     | host158_node2 | nova     | enabled | up    | 2019-12-15T15:24:27.000000 |
+----+------------------+---------------+----------+---------+-------+----------------------------+


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM