@[TOC](openstack nova节点(小节5))
部署 nova 控制节点与计算节点
nova 是 openstack 最早的组件之一,nova 分为控制节点和计算节点,计算节点通过 nova computer 进行虚拟机创建,通过 libvirt 调用 kvm 创建虚拟机,nova 之间通信通过 rabbitMQ队列进行通信,其组件和功能如下:
API:负责接收和响应外部请求。
Scheduler:负责调度虚拟机所在的物理机。
Conductor:计算节点访问数据库的中间件。
Consoleauth:用于控制台的授权认证。
Novncproxy:VNC 代理,用于显示虚拟机操作终端。
官方部署文档:
docs.openstack.org/mitaka/zh_C…
Nova-API 的功能:
Nova-api 组件实现了 restful API 的功能,接收和响应来自最终用户的计算 API 请求,接收外部的请求并通过 message queue 将请求发动给其他服务组件,同时也兼容 EC2 API,所以也可以使用 EC2 的管理工具对 nova 进行日常管理。
nova scheduler:
nova scheduler 模块在 openstack 中的作用是决策虚拟机创建在哪个主机(计算节点)上。决策一个虚拟机应该调度到某物理节点,需要分为两个步骤:过滤(filter),过滤出可以创建虚拟机的主机
node1
#还是7.2版本的内核
[root@node1 ~]# uname -a
Linux node1 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@node1 ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
安装包
[root@node1 ~]# yum install openstack-nova-compute -y
有这个值就不用配qemu
[root@node1 ~]# egrep -c '(vmx|svm)' /proc/cpuinfo
2
修改域名
[root@node1 ~]# vim /etc/hosts
192.168.37.101 openstack.123.net <--添加此行
修改配置文件
[root@node1 ~]# vim /etc/nova/nova.conf
...
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:openstack123@openstack.123.net
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api]
auth_strategy = keystone
[keystone_authtoken]
auth_url = http://openstack.123.net:5000/v3
memcached_servers = openstack.123.net:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = nova
[vnc]
enabled = true
server_listen = 0.0.0.0
server_proxyclient_address = 192.168.37.103 <--当前node节点地址
novncproxy_base_url = http://openstack.123.net:6080/vnc_auto.html
[glance]
api_servers = http://openstack.123.net:9292
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
[placement]
region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://openstack.123.net:5000/v3
username = placement
password = placement
...
启动计算节点服务
[root@node1 ~]# systemctl start libvirtd.service openstack-nova-compute.service
并设置为开机启动
[root@node1 ~]# systemctl enable libvirtd.service openstack-nova-compute.service
controller1
[root@controller1 ~]# openstack compute service list --service nova-compute
+----+--------------+-------+------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+--------------+-------+------+---------+-------+----------------------------+
| 9 | nova-compute | node1 | nova | enabled | up | 2022-09-22T05:26:15.000000 |
+----+--------------+-------+------+---------+-------+----------------------------+
以后添加新的计算节点时,必须在控制器节点上运行
[root@controller1 ~]# 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': 99cf79bc-8ad1-4396-b41e-0da50640a59c
Checking host mapping for compute host 'node1': d00666a2-20a9-4577-a73a-f59973e1e37a
Creating host mapping for compute host 'node1': d00666a2-20a9-4577-a73a-f59973e1e37a
Found 1 unmapped computes in cell: 99cf79bc-8ad1-4396-b41e-0da50640a59
修改扫描的值
[root@controller1 ~]# vim /etc/nova/nova.conf
[scheduler]
discover_hosts_in_cells_interval = 60
重启服务
[root@controller1 ~]# systemctl restart openstack-nova-api.service openstack-nova-consoleauth openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
node1
重启服务
[root@node1 ~]# systemctl restart libvirtd.service openstack-nova-compute.service
controller1
查看nova列表中是否有'node1'
[root@controller1 ~]# nova service-list
+--------------------------------------+------------------+-------------+----------+---------+-------+----------------------------+-----------------+-------------+
| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason | Forced down |
+--------------------------------------+------------------+-------------+----------+---------+-------+----------------------------+-----------------+-------------+
| f468a4e0-3f1b-4f1b-abb5-726fb146c75c | nova-consoleauth | controller1 | internal | enabled | up | 2022-09-22T05:44:39.000000 | - | False |
| 7e997d79-dc48-47c7-bc9b-9f47b50c798d | nova-scheduler | controller1 | internal | enabled | up | 2022-09-22T05:44:37.000000 | - | False |
| f0cf6785-041d-4469-8636-5354493636b2 | nova-conductor | controller1 | internal | enabled | up | 2022-09-22T05:44:34.000000 | - | False |
| db3927d9-9748-4781-9778-dab1d87efb89 | nova-compute | node1 | nova | enabled | up | 2022-09-22T05:44:39.000000 | - | False |
| 977b6bca-0cf0-4f4b-b228-6914af686cf8 | nova-console | controller1 | internal | enabled | up | 2022-09-22T05:44:39.000000 | - | False |
+--------------------------------------+------------------+-------------+----------+---------+-------+----------------------------+-----------------+-------------+
[root@controller1 ~]# openstack compute service list
+----+------------------+-------------+----------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+------------------+-------------+----------+---------+-------+----------------------------+
| 1 | nova-consoleauth | controller1 | internal | enabled | up | 2022-09-22T05:46:39.000000 |
| 2 | nova-scheduler | controller1 | internal | enabled | up | 2022-09-22T05:46:37.000000 |
| 4 | nova-conductor | controller1 | internal | enabled | up | 2022-09-22T05:46:34.000000 |
| 9 | nova-compute | node1 | nova | enabled | up | 2022-09-22T05:46:39.000000 |
| 10 | nova-console | controller1 | internal | enabled | up | 2022-09-22T05:46:39.000000 |
+----+------------------+-------------+----------+---------+-------+----------------------------+
[root@controller1 ~]# openstack catalog list
+-----------+-----------+------------------------------------------------+
| Name | Type | Endpoints |
+-----------+-----------+------------------------------------------------+
| keystone | identity | RegionOne |
| | | public: http://openstack.123.net:5000/v3 |
| | | RegionOne |
| | | internal: http://openstack.123.net:5000/v3 |
| | | RegionOne |
| | | admin: http://openstack.123.net:5000/v3 |
| | | |
| glance | image | RegionOne |
| | | public: http://openstack.123.net:9292 |
| | | RegionOne |
| | | admin: http://openstack.123.net:9292 |
| | | RegionOne |
| | | internal: http://openstack.123.net:9292 |
| | | |
| nova | compute | RegionOne |
| | | admin: http://openstack.123.net:8774/v2.1 |
| | | RegionOne |
| | | public: http://openstack.123.net:8774/v2.1 |
| | | RegionOne |
| | | internal: http://openstack.123.net:8774/v2.1 |
| | | |
| placement | placement | RegionOne |
| | | admin: http://openstack.123.net:8778 |
| | | RegionOne |
| | | public: http://openstack.123.net:8778 |
| | | RegionOne |
| | | internal: http://openstack.123.net:8778 |
| | | |
+-----------+-----------+------------------------------------------------+
查看镜像列表
[root@controller1 ~]# openstack image list
+--------------------------------------+--------------+--------+
| ID | Name | Status |
+--------------------------------------+--------------+--------+
| a36cbc0c-1813-46e7-9698-deef028a2a71 | cirros-0.4.0 | active |
+--------------------------------------+--------------+--------+
注意:此处这个bug要解决一下、否则会报错(stein要单独安装ocata版本,添加apache配置文件解决'placement API'的访问403问题)
[root@controller1 ~]# vim /etc/httpd/conf.d/00-placement-api.conf
#在最后添加下面信息
<Directory /usr/bin>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
<IfVersion < 2.4>
Order allwo,deny
Allow from all
</IfVersion>
</Directory>
重启apache服务
[root@controller1 ~]# systemctl restart httpd
验证
[root@controller1 ~]# nova-status upgrade check
+--------------------------------+
| Upgrade Check Results |
+--------------------------------+
| Check: Cells v2 |
| Result: Success |
| Details: None |
+--------------------------------+
| Check: Placement API |
| Result: Success |
| Details: None |
+--------------------------------+
| Check: Ironic Flavor Migration |
| Result: Success |
| Details: None |
+--------------------------------+
| Check: Request Spec Migration |
| Result: Success |
| Details: None |
+--------------------------------+
| Check: Console Auths |
| Result: Success |
| Details: None |
+--------------------------------+