七OpenStack服务-Nova(计算节点)

Posted yangleitao

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了七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 |
+----+------------------+---------------+----------+---------+-------+----------------------------+

以上是关于七OpenStack服务-Nova(计算节点)的主要内容,如果未能解决你的问题,请参考以下文章

OpenStack 计算服务Nova [四]

openstack安装-计算节点-nova计算服务安装

OpenStack 计算服务 Nova部署

OpenStack服务-Nova(控制节点)

openstack篇 NOVA组件概念和部署

openstack篇 NOVA组件概念和部署