Openstack移除计算节点

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Openstack移除计算节点相关的知识,希望对你有一定的参考价值。

1、查看所有计算节点

source admin-openrc
nova service-list

2、选择要删除的计算节点,删除计算节点ID,并检查节点情况

nova service-delete ID
nova service-list

3、查看网络

neutron agent-list

4、删除网络ID,并检查

neutron agent-delete ID
neutron agent-list

5、停止计算节点nova、neutron相关服务

systemctl stop libvirtd.service openstack-nova-compute.service
systemctl stop neutron-linuxbridge-agent

6、清除数据库记录

# nova库
use nova;

# 查询nova主机
select host from services;
select hypervisor_hostname from compute_nodes;

# 删除主机
delete from nova.services where host="要删除的主机名称";
delete from nova.compute_nodes where hypervisor_hostname="要删除的主机名称";

7、查看结果

nova service-list
neutron agent-list

openstack云计算:Openstack rocky 部署三 nova计算节点部署

Openstack 云计算(二): Openstack Rocky部署三 nova 部署与验证 (计算节点)

标签(空格分隔): openstack系列


  • 一:nova计算节点初始化
  • 二:nova 计算节点配置

一: nova计算节点初始化

1.1 配置主机名

login: 10.0.0.31 

cat /etc/hosts 
---
10.0.0.11   controller
10.0.0.31   computer1
10.0.0.41   block1
10.0.0.51       object1
10.0.0.52       object2
---

技术图片

1.2 关闭防火墙和selinux

systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service

关闭 selinux

setenforce 0
getenforce
sed -i ‘s#SELINUX=enforcing#SELINUX=disabled#g‘ /etc/sysconfig/selinux
grep SELINUX=disabled /etc/sysconfig/selinux

技术图片

1.3 配置时间同步

1)在在计算节点配置时间同步服务
# 安装时间同步的软件包

yum install chrony -y
2)编辑配置文件确认有以下配置
vim /etc/chrony.conf
-------------------------------------
# 修改引用控制节点controller的IP
server 10.0.0.11 iburst
-------------------------------------
3)重启chronyd服务,并配置开机自启动
systemctl restart chronyd.service
systemctl status chronyd.service
systemctl enable chronyd.service
systemctl list-unit-files |grep chronyd.service
4)设置时区,首次同步时间
timedatectl set-timezone Asia/Shanghai
chronyc sources -v 
timedatectl status
# 至此,时间同步配置完成

技术图片

技术图片

1.4 配置相关yum源

配置阿里云的base和epel源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

安装openstack-rocky的仓库
yum install centos-release-openstack-rocky -y
yum clean all
yum makecache
yum update -y
安装openstack客户端相关软件
yum install python-openstackclient openstack-selinux -y
yum install openstack-nova-compute python-openstackclient openstack-utils -y

技术图片


1.5 配置文件(/etc/nova/nova.conf)

openstack-config --set  /etc/nova/nova.conf DEFAULT my_ip 10.0.0.31
openstack-config --set  /etc/nova/nova.conf DEFAULT use_neutron True
openstack-config --set  /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver
openstack-config --set  /etc/nova/nova.conf DEFAULT enabled_apis  osapi_compute,metadata
openstack-config --set  /etc/nova/nova.conf DEFAULT transport_url  rabbit://openstack:[email protected]
openstack-config --set  /etc/nova/nova.conf api auth_strategy  keystone 
openstack-config --set  /etc/nova/nova.conf keystone_authtoken auth_url http://controller:5000/v3
openstack-config --set  /etc/nova/nova.conf keystone_authtoken memcached_servers controller:11211
openstack-config --set  /etc/nova/nova.conf keystone_authtoken auth_type password
openstack-config --set  /etc/nova/nova.conf keystone_authtoken project_domain_name default
openstack-config --set  /etc/nova/nova.conf keystone_authtoken user_domain_name default
openstack-config --set  /etc/nova/nova.conf keystone_authtoken project_name  service
openstack-config --set  /etc/nova/nova.conf keystone_authtoken username nova
openstack-config --set  /etc/nova/nova.conf keystone_authtoken password nova
openstack-config --set  /etc/nova/nova.conf vnc enabled True
openstack-config --set  /etc/nova/nova.conf vnc server_listen 0.0.0.0
openstack-config --set  /etc/nova/nova.conf vnc server_proxyclient_address  ‘$my_ip‘
openstack-config --set  /etc/nova/nova.conf vnc novncproxy_base_url  http://controller:6080/vnc_auto.html
openstack-config --set  /etc/nova/nova.conf glance api_servers http://controller:9292
openstack-config --set  /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp
openstack-config --set  /etc/nova/nova.conf placement region_name RegionOne
openstack-config --set  /etc/nova/nova.conf placement project_domain_name Default
openstack-config --set  /etc/nova/nova.conf placement project_name service
openstack-config --set  /etc/nova/nova.conf placement auth_type password
openstack-config --set  /etc/nova/nova.conf placement user_domain_name Default
openstack-config --set  /etc/nova/nova.conf placement auth_url http://controller:5000/v3
openstack-config --set  /etc/nova/nova.conf placement username placement
openstack-config --set  /etc/nova/nova.conf placement password placement

技术图片

技术图片

egrep -v "^#|^$" /etc/nova/nova.conf
---
[DEFAULT]
my_ip = 10.0.0.31
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:[email protected]
log_date_format=%Y-%m-%d %H:%M:%S   ### 打开 分割日志
log_file=nova-compute.log           ### 打开日志
log_dir=/var/log/nova               ###打开日志目录
[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]
virt_type=kvm
[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 = 10.0.0.31
novncproxy_base_url = http://controller:6080/vnc_auto.html
[workarounds]
[wsgi]
[xenserver]
[xvp]
[zvm]
---

1.6 配置虚拟机的硬件加速

# 首先确定您的计算节点是否支持虚拟机的硬件加速。

egrep -c ‘(vmx|svm)‘ /proc/cpuinfo
# 如果返回位0,表示计算节点不支持硬件加速,需要配置libvirt使用QEMU方式管理虚拟机,使用以下命令:

openstack-config --set  /etc/nova/nova.conf libvirt virt_type  qemu
egrep -v "^#|^$" /etc/nova/nova.conf|grep ‘virt_type‘
# 如果返回为其他值,表示计算节点支持硬件加速且不需要额外的配置,使用以下命令:

openstack-config --set  /etc/nova/nova.conf libvirt virt_type  kvm 
egrep -v "^#|^$" /etc/nova/nova.conf|grep ‘virt_type‘

技术图片

启动nova相关服务,并配置为开机自启动
需要启动2个服务

systemctl start libvirtd.service openstack-nova-compute.service 
systemctl status libvirtd.service openstack-nova-compute.service
systemctl enable libvirtd.service openstack-nova-compute.service
systemctl list-unit-files |grep libvirtd.service
systemctl list-unit-files |grep openstack-nova-compute.service

技术图片

1.7 将计算节点增加到cell数据库

# 以下命令在控制节点操作:

cd /openstack
source keystone-admin-pass.sh 
# 检查确认数据库有新的计算节点

openstack compute service list --service nova-compute

技术图片

手动将新的计算节点添加到openstack集群

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

技术图片


设置新创建节点自动注册的任务(已经添加到配置文件中)

vim /etc/nova/nova.conf
---
[scheduler]
discover_hosts_in_cells_interval = 300
---
至此,计算节点安装完毕,接下来需要进行测试,检查nova节点的状态

1.8 在控制节点进行验证

参考文章:https://docs.openstack.org/nova/rocky/install/compute-install-rdo.html

1)应用管理员环境变量脚本
cd /openstack
source keystone-admin-pass.sh 
2)列表查看安装的nova服务组件
# 验证是否成功注册并启动了每个进程

openstack compute service list

技术图片

在身份认证服务中列出API端点以验证其连接性

openstack catalog list

技术图片

在镜像服务中列出已有镜像已检查镜像服务的连接性
openstack image list

技术图片

检查nova各组件的状态

检查placement API和cell服务是否正常工作

nova-status upgrade check

技术图片


至此,nova计算节点,安装完毕并添加到openstack集群中

以上是关于Openstack移除计算节点的主要内容,如果未能解决你的问题,请参考以下文章

OpenStack运维:存储节点和配置管理

7)openstack 扩充计算节点

openstack云计算:Openstack rocky 部署三 nova计算节点部署

openstack中彻底删除计算节点的操作记录

openstack怎么查计算节点的vm接口ip地址

五,openstack之nova服务的安装(计算节点)