首页 > 其他分享 >openstack虚拟机跨机迁移

openstack虚拟机跨机迁移

时间:2023-10-07 16:22:51浏览次数:34  
标签:跨机 compute 虚拟机 nova compute2 openstack root neutron

 

1.node节点扩容

#因此环境仅部署了一个compute节点,因此扩容一个compute计算节点
#计算节点安装服务:#提前将 yum 仓库、防火墙、selinux、主机名、时间同步等配置完毕。
[root@openstack-compute2 ~]#yum install centos-release-openstack-train -y
[root@openstack-compute2 ~]#yum install -y https://rdoproject.org/repos/rdo-release.rpm
[root@openstack-compute2 ~]#yum install python-openstackclient openstack-selinux -y
#安装nova-compute和neutron-compute的提供者网络的包
[root@openstack-compute2 ~]#yum install openstack-nova-compute -y
[root@openstack-compute2 ~]#yum install openstack-neutron-linuxbridge ebtables ipset -y

#拷贝nova-compute和neutron-compute的配置文件
[root@openstack-compute1 ~]# scp /etc/sysctl.conf 10.0.0.108:/etc

[root@openstack-compute1 ~]# scp /etc/neutron/neutron.conf 10.0.0.108:/etc/neutron/neutron.conf
[root@openstack-compute1 ~]#scp /etc/neutron/plugins/ml2/linuxbridge_agent.ini 10.0.0.108:/etc/neutron/plugins/ml2/linuxbridge_agent.ini
[root@openstack-compute2 ~]# mkdir /etc/nova
[root@openstack-compute1 ~]#scp /etc/nova/nova.conf 10.0.0.108:/etc/nova/nova.conf
#修改配置文件,vnc为自己的地址。
[root@openstack-compute2 ~]# vim /etc/nova/nova.conf
server_proxyclient_address = 10.0.0.108
[root@openstack-compute2 ~]# vim /etc/hosts
10.0.0.188 openstack-vip.tan.local

#计算节点启动服务:
[root@openstack-compute2 ~]# systemctl enable openstack-nova-compute.service
[root@openstack-compute2 ~]# systemctl restart openstack-nova-compute.service
[root@openstack-compute2 ~]# systemctl enable neutron-linuxbridge-agent libvirtd.service
[root@openstack-compute2 ~]# systemctl restart neutron-linuxbridge-agent libvirtd.service

#验证节点已经加入到集群。
[root@openstack-controller1 ~]# nova service-list
+--------------------------------------+----------------+---------------------------------+----------+---------+-------+----------------------------+-----------------+-------------+
| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason | Forced down |
+--------------------------------------+----------------+---------------------------------+----------+---------+-------+----------------------------+-----------------+-------------+
| d2c9f15a-d8e6-472d-8950-f5d7b56be512 | nova-conductor | openstack-controller1.tan.local | internal | enabled | up | 2022-09-21T13:11:32.000000 | - | False |
| 54829f2e-4aa7-44cf-85fc-9dbee8ffa60b | nova-scheduler | openstack-controller1.tan.local | internal | enabled | up | 2022-09-21T13:11:24.000000 | - | False |
| 523bf526-6aac-4fac-a904-aa9c36df7e74 | nova-compute | openstack-compute1.tan.local | nova | enabled | up | 2022-09-21T13:11:27.000000 | - | False |
| 0913af81-7ad8-4136-854c-c5315834176e | nova-compute | openstack-compute2.tan.local | nova | enabled | up | 2022-09-21T13:11:32.000000 | - | False |
+--------------------------------------+----------------+---------------------------------+----------+---------+-------+----------------------------+-----------------+-------------+
[root@openstack-controller1 ~]# neutron agent-list
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+--------------------+---------------------------------+-------------------+-------+----------------+---------------------------+
| id | agent_type | host | availability_zone | alive | admin_state_up | binary |
+--------------------------------------+--------------------+---------------------------------+-------------------+-------+----------------+---------------------------+
| 4d78d03b-2691-4072-ae6a-f09cd8af3603 | Linux bridge agent | openstack-compute1.tan.local | | :-) | True | neutron-linuxbridge-agent |
| 59390685-4dae-487d-9e15-f0cdf1709ffe | DHCP agent | openstack-controller1.tan.local | nova | :-) | True | neutron-dhcp-agent |
| 5ab3fb3b-4f38-41aa-a750-b558d98e3a38 | Linux bridge agent | openstack-controller1.tan.local | | :-) | True | neutron-linuxbridge-agent |
| 8dfaf895-002c-470c-9736-89ac0696454e | Metadata agent | openstack-controller1.tan.local | | :-) | True | neutron-metadata-agent |
| f2e9c598-e6ea-494d-a550-07aa33d29bef | Linux bridge agent | openstack-compute2.tan.local | | :-) | True | neutron-linuxbridge-agent |
+--------------------------------------+--------------------+---------------------------------+-------------------+-------+----------------+---------------------------+

2.虚拟机动态调整实例大小及跨主机迁移

#配置优化nova
[root@openstack-controller1 ~]# vim /etc/nova/nova.conf
#虚拟机自动启动
resume_guests_state_on_host_boot=true
#cpu超限8倍
cpu_allocation_ratio=8
#内存1.5倍
ram_allocation_ratio=1.5
#磁盘1倍,不超限使用
disk_allocation_ratio=1.0
#配置虚拟机类型动态调整
allow_resize_to_same_host=true
#保留磁盘给系统使用
reserved_host_disk_mb=20480
#保留内存给系统使用
reserved_host_memory_mb=4096
[root@openstack-controller1 ~]# bash nova_restart.sh
[root@openstack-compute2 ~]# vim /etc/nova/nova.conf
#一样配置这几项

[root@openstack-compute1 ~]# systemctl restart openstack-nova-compute.service

[root@openstack-compute2 ~]# systemctl restart openstack-nova-compute.service


#:各计算节点配置 nova 用户: 将 shell 改为/bin/bash
[root@openstack-compute1 ~]# usermod nova -s /bin/bash
[root@openstack-compute2 ~]# usermod nova -s /bin/bash


#配置 nova 登录密码:
[root@openstack-compute1 ~]# echo 123456 | passwd --stdin nova
[root@openstack-compute2 ~]# echo 123456 | passwd --stdin nova

#切换至 nova 用户获取秘钥,然后将秘钥相互 copy 至各个计算节点:
[root@openstack-compute1 ~]# su - nova
[nova@openstack-compute1 ~]$ ssh-keygen -t rsa -P '' -f ~/.ssh/id_dsa >/dev/null 2>&1
[nova@openstack-compute1 ~]$ ssh-copy-id -i .ssh/id_dsa.pub [email protected]
[nova@openstack-compute1 ~]$ ssh 10.0.0.108
Last login: Wed Sep 21 21:49:50 2022 from 10.0.0.107
[nova@openstack-compute2 ~]$ ssh-keygen -t rsa -P '' -f ~/.ssh/id_dsa >/dev/null 2>&1
[nova@openstack-compute2 ~]$ ssh-copy-id -i .ssh/id_dsa.pub [email protected]

#创建实例类型more,cpu,内存,磁盘更大。
#登录http://openstack-vip.tan.local/dashboard/project/instances/,在项目--实例--编辑实例--调整实例大小,从centos-template变更为more类型。稍等一会,确认调整大小/迁移

#查看日志验证虚拟机迁移到compute2节点了
[root@openstack-compute2 ~]# cat /var/log/nova/nova-compute.log |grep compute2
2022-09-21 21:08:15.966 3723 INFO nova.compute.resource_tracker [req-3fd1fdea-3861-4cdc-981e-0d8dd37af990 - - - - -] Compute node record created for openstack-compute2.tan.local:openstack-compute2.tan.local with uuid: ab29de6a-62f3-4402-96fc-f90d342d38d6
2022-09-21 21:08:16.209 3723 INFO nova.scheduler.client.report [req-3fd1fdea-3861-4cdc-981e-0d8dd37af990 - - - - -] [req-7966059a-d8d8-4a3b-a4fc-fdd974427396] Created resource provider record via placement API for resource provider with UUID ab29de6a-62f3-4402-96fc-f90d342d38d6 and name openstack-compute2.tan.local.
2022-09-21 21:55:01.368 26610 INFO nova.compute.claims [req-53addd9d-add9-4d5e-8f26-100d53b87c29 317a4ea405d745bbb9e5d76fc87a0751 f7c80417780a4bd59beaa38a9d36271e - default default] [instance: af9ef6f1-6eb9-4a8b-9c65-995f383a9b76] Claim successful on node openstack-compute2.tan.local

![](/i/l/?n=22&i=blog/1914165/202209/1914165-20220926143038875-1129738668.png)

![](/i/l/?n=22&i=blog/1914165/202209/1914165-20220926143053009-715662914.png)

![](/i/l/?n=22&i=blog/1914165/202209/1914165-20220926143112279-945934070.png)

![](/i/l/?n=22&i=blog/1914165/202209/1914165-20220926143117769-1600639819.png)

 

标签:跨机,compute,虚拟机,nova,compute2,openstack,root,neutron
From: https://www.cnblogs.com/tanll/p/17746602.html

相关文章

  • 三台Centos7虚拟机部署kubernetes集群服务
     简介kubernetes,简称K8s,是用8代替8个字符“ubernete”而成的缩写。是一个开源的,用于管理云平台中多个主机上的容器化的应用,Kubernetes的目标是让部署容器化的应用简单并且高效(powerful),Kubernetes提供了应用部署,规划,更新,维护的一种机制。部署centos7虚拟机安装Vmwareworkstation......
  • windows下vscode连接linux(虚拟机)进行(伪)远程开发
    免责声明本文乃至本系列是对网络上传播的内容进行整理以梳理流程,且因为篇幅限制会精简内容,适合面向具有计算机类基础知识的人群,本文内容较为笼统,只有大体上的逻辑,具体的细节肯定是官网上写的准而全,望读者能从官网上获取最新的信息,而不是这一篇参考性流程开源声明本文章遵......
  • Java 平台和 Java 虚拟机(JVM)
    Java平台是一个面向多个操作系统的开发和运行环境,提供了一套完整的软件开发工具和运行时环境。它包括Java编程语言、Java开发工具(如编译器、调试器等)和Java运行时环境(包括Java虚拟机和类库)。Java虚拟机(JavaVirtualMachine,JVM)是Java平台的核心组件之一,它是一个可执行的程序,负责......
  • linux虚拟机网络配置
    我的装机环境是centos7版本【1】安装虚拟机vmware之后,点击菜单栏编辑——虚拟网络编辑器,点击Vmnet8,查看子网IP地址段【2】进入主机目录/etc/sysconfig/network-scripts,编辑ifcfg-ens33[root@xxpcV7-01network-scripts]#catifcfg-ens33TYPE=EthernetPROXY_METHOD=noneBR......
  • 【VMware篇】3-ESXi安装Windows Server2019虚拟机和更改配置
    第1章前言   本文主要介绍Dell服务器安装ESXI后虚拟机的安装,安装例子:WindowsServer2019。1.Windowsserver2019            Windowsserver2019是微软公司研发的服务器操作系统,WindowsServer2019包括三个许可版本:DatacenterEdition(数据中心版):适用于高虚拟化......
  • 【VMware篇】5-ESXi导入、导出虚拟机和模板
    第1章、前言本文主要介绍封装系统导出为模板,以WindowsServer2019为例。第2章、导出系统为模板1、打开运行窗口输入“sysprep”点击确定。2、选中“sysprep”鼠标右键“以管理员身份运行”。3、勾选“通用”,关机选项选择“关机”,点击确定。4、选中server2019 鼠标右键选择“导出......
  • 服务器nf_conntrack(CT)表满导致虚拟机丢包
    现象虚拟机各种奇怪丢包(TCP的连接)然后看到虚拟机所在CVK的dmesg里,有如下:dmesgkern-lerr,warn-T(/var/log/messages里也有)提示:nf_conntrack:nf_conntrack:tablefull,droppingpacket从日志看意思是:内核netfilter模块conntrack相关参数配置不合理,导致新......
  • ARM 架构的 JVM(Java 虚拟机)最高的免费版本是 OpenJDK 17
    目前(截至2023年9月),ARM架构的JVM(Java虚拟机)最高的免费版本是OpenJDK17。OpenJDK17是JavaSE17的开源实现,由Oracle和其他开源贡献者共同维护。你可以在ARM架构的设备上安装和使用OpenJDK17,它包含了JavaSE17的所有功能和改进。要在ARM架构的设备上安装Op......
  • VMWare 虚拟机 CPU 设置里针对 CPU 的 Intel VT-x 选项功能介绍
    虚拟化技术是现代计算的关键组成部分,它使多个虚拟机(VM)可以在单个物理主机上运行,每个虚拟机都似乎是独立的计算机。VMware作为虚拟化技术领域的领导者之一,提供了强大的虚拟化解决方案,其中一个重要的组成部分就是对CPU虚拟化的支持。在VMware虚拟机设置选项中,选择启用虚拟化引擎的......
  • 关于 VMware 虚拟机中的 SVGA II 虚拟设备
    VMwareSVGAII是VMware虚拟机中用于图形显示的虚拟显卡设备的一种。它是一种虚拟设备,专门为在虚拟机环境中提供图形支持而设计的。VMwareSVGAII虚拟设备的作用是模拟物理计算机上的图形适配器,允许虚拟机实例在虚拟化的环境中进行图形处理和显示。在本文中,我将详细解释VMwar......