关于OpenStack实例冷热迁移相关问题处理

2024-01-26 08:32

本文主要是介绍关于OpenStack实例冷热迁移相关问题处理,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

文章目录

      • 一 、热迁移问题处理
        • 1.1 libvirt 远程连接拒绝
      • 二、冷迁移问题处理
        • 2.1 ssh命令执行失败

一 、热迁移问题处理

将实例从compute01节点热迁移compute02 节点

1.1 libvirt 远程连接拒绝

错误详情

# 查看 compute01 节点nova日志  vim /var/log/nova/nova-compute.lognova.virt.libvirt.driver [-] [instance: 41569ceb-335d-42ca-b6f8-9a562105081e] Live Migration failure: operation failed: Failed to connect to remote libvirt URI qemu+tcp://compute02/system: unable to connect to server at 'compute02:16509': Connection refused: libvirtError: operation failed: Failed to connect to remote libvirt URI qemu+tcp://compute02/system: unable to connect to server at 'compute02:16509': Connection refused

需配置主机compute02libvirt,使得compute01可以远程连接其libvirt


# 1、备份原配置文件
sed -i.default -e '/^#/d' -e '/^$/d' /etc/libvirt/libvirtd.conf# 2、编辑配置文件/etc/libvirt/libvirtd.conf
# vim  /etc/libvirt/libvirtd.conf
listen_addr = "0.0.0.0"
listen_tls = 0
listen_tcp = 1
unix_sock_group = "root"
unix_sock_rw_perms = "0777"
auth_unix_ro = "none"
auth_unix_rw = "none"
log_filters="2:qemu_monitor_json 2:qemu_driver"
log_outputs="2:file:/var/log/libvirt/libvirtd.log"
tcp_port = "16509"
auth_tcp = "none"# 3、 编辑文件 vim /etc/sysconfig/libvirtd
# vim /etc/sysconfig/libvirtd
LIBVIRTD_ARGS="--listen"# 4、 重启libvirtd活动
[root@compute02 libvirt]# systemctl restart libvirtd# 5、
[root@controller ~]# openstack server migrate 41569ceb-335d-42ca-b6f8-9a562105081e --live compute02

compute01主机上测试能否连接compute02libvirt,测试成功

controller上通过命令行手动测试热迁移,成功

[root@compute01 ~]# virsh connect qemu+tcp://compute02:16509/system

二、冷迁移问题处理

将实例从compute01节点冷迁移至compute02 节点

2.1 ssh命令执行失败

错误详情

# 查看 compute01 节点nova日志  vim /var/log/nova/nova-compute.log
021-10-13 08:44:13.178 32957 ERROR oslo_messaging.rpc.server [req-560e23d7-c795-47a8-90a8-22484fedf434 03b0360129f84f9790081df4cebf7844 b5a1eb4ee8374fa1aa88cd4b59afda98 - default default] Exception during message handling: ResizeError: Resize error: not able to execute ssh command: Unexpected error while running command.
Command: ssh -o BatchMode=yes 192.168.204.175 mkdir -p /var/lib/nova/instances/41569ceb-335d-42ca-b6f8-9a562105081e
Exit code: 255
Stdout: u''
Stderr: u'Host key verification failed.\r\n'

需要配置compute01主机可以免密登录compute02 主机

# 在compute01执行 
[root@compute01 nova]# ssh-copy-id root@192.168.204.175
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed/usr/bin/ssh-copy-id: ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
ERROR: Someone could be eavesdropping on you right now (man-in-the-middle attack)!
ERROR: It is also possible that a host key has just been changed.
ERROR: The fingerprint for the ECDSA key sent by the remote host is
ERROR: SHA256:GvRgHIb8ZFbDaHsQKcpZHg16WXhN1ZkD5WasJ4rnhak.
ERROR: Please contact your system administrator.
ERROR: Add correct host key in /root/.ssh/known_hosts to get rid of this message.
ERROR: Offending ECDSA key in /root/.ssh/known_hosts:4
ERROR: ECDSA host key for 192.168.204.175 has changed and you have requested strict checking.
ERROR: Host key verification failed.# 该报错需删除 compute01主机下的 /root/.ssh/known_hosts 文件中,关于 192.168.204.175 的数据行
[root@compute01 ~]# vim /root/.ssh/known_hosts 
# 在compute01执行 
[root@compute01 nova]# ssh-copy-id root@192.168.204.175
[root@compute01 ~]# ssh-copy-id root@192.168.204.175
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.204.175's password: 
sh: .ssh/authorized_keys: Permission denied# 该报错需修改compute02机器的 .ssh/authorized_keys 文件权限
[root@compute02 .ssh]# chmod 700 ~/.ssh
[root@compute02 .ssh]# chmod 600 authorized_keys
# 但是发现compute02机器的 .ssh/authorized_keys 文件为只读,且root用户也无法删除或者修改该文件,导致在compoute01上执行ssh-copy-id命令时,无法修改compute02机器上的authorized_keys文件
# 查询被附加权限
[root@compute02 .ssh]# lsattr authorized_keys
----i----------- authorized_keys
# 取消该权限
[root@compute02 .ssh]# chattr -i authorized_keys# 在compute01执行 
[root@compute01 nova]# ssh-copy-id root@192.168.204.175
# 成功设置免密登录 compute02

免密登录设置成功,测试冷迁移,仍失败,且报错内容和最开始没有配置免密登录时的错误一致

# 查看 compute01 节点nova日志  vim /var/log/nova/nova-compute.log
021-10-13 08:44:13.178 32957 ERROR oslo_messaging.rpc.server [req-560e23d7-c795-47a8-90a8-22484fedf434 03b0360129f84f9790081df4cebf7844 b5a1eb4ee8374fa1aa88cd4b59afda98 - default default] Exception during message handling: ResizeError: Resize error: not able to execute ssh command: Unexpected error while running command.
Command: ssh -o BatchMode=yes 192.168.204.175 mkdir -p /var/lib/nova/instances/41569ceb-335d-42ca-b6f8-9a562105081e
Exit code: 255
Stdout: u''
Stderr: u'Host key verification failed.\r\n'# 尝试在compute01执行 ssh -o BatchMode=yes 192.168.204.175 mkdir -p /var/lib/nova/instances/41569ceb-335d-42ca-b6f8-9a562105081e
[root@compute01 nova]# ssh -o BatchMode=yes 192.168.204.175 mkdir -p /var/lib/nova/instances/41569ceb-335d-42ca-b6f8-9a562105081e# 命令执行成功,且在compute02上能看到 /var/lib/nova/instances/41569ceb-335d-42ca-b6f8-9a562105081e目录
[root@compute02 ~]# ls /var/lib/nova/instances/41569ceb-335d-42ca-b6f8-9a562105081e# 分析
# 我们设置的是compute01的root用户,免密登录compute02的root用户,nova-compute服务启动时使用的是nova用户。因此仍提示ssh失败
# 修改nova-compute服务的启动配置,设置User为root (默认是nova,刚我们是设置的root用户的免密)
[root@compute01 nova]# vim /usr/lib/systemd/system/openstack-nova-compute.service
[Service]
...
User=root[root@compute01 nova]# systemctl daemon-reload
[root@compute01 nova]# systemctl restart openstack-nova-compute.service

再次执行 冷迁移,提示成功!!!

冷迁移在完成迁移后,需要手动确认是否确认或者撤销此次迁移

在这里插入图片描述

可通过配置compute节点的/etc/nova/nova.conf文件来自动确认此次迁移

root@compute02 ~]# vim  /etc/nova/nova.conf
[DEFAULT]
...
resize_confirm_window=30# 表示迁移完成后,实例的待确认状态持续时间大于resize_confirm_window时,自动确认提交迁移

这篇关于关于OpenStack实例冷热迁移相关问题处理的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/646204

相关文章

SpringBoot分段处理List集合多线程批量插入数据方式

《SpringBoot分段处理List集合多线程批量插入数据方式》文章介绍如何处理大数据量List批量插入数据库的优化方案:通过拆分List并分配独立线程处理,结合Spring线程池与异步方法提升效率... 目录项目场景解决方案1.实体类2.Mapper3.spring容器注入线程池bejsan对象4.创建

线上Java OOM问题定位与解决方案超详细解析

《线上JavaOOM问题定位与解决方案超详细解析》OOM是JVM抛出的错误,表示内存分配失败,:本文主要介绍线上JavaOOM问题定位与解决方案的相关资料,文中通过代码介绍的非常详细,需要的朋... 目录一、OOM问题核心认知1.1 OOM定义与技术定位1.2 OOM常见类型及技术特征二、OOM问题定位工具

PHP轻松处理千万行数据的方法详解

《PHP轻松处理千万行数据的方法详解》说到处理大数据集,PHP通常不是第一个想到的语言,但如果你曾经需要处理数百万行数据而不让服务器崩溃或内存耗尽,你就会知道PHP用对了工具有多强大,下面小编就... 目录问题的本质php 中的数据流处理:为什么必不可少生成器:内存高效的迭代方式流量控制:避免系统过载一次性

SpringBoot+RustFS 实现文件切片极速上传的实例代码

《SpringBoot+RustFS实现文件切片极速上传的实例代码》本文介绍利用SpringBoot和RustFS构建高性能文件切片上传系统,实现大文件秒传、断点续传和分片上传等功能,具有一定的参考... 目录一、为什么选择 RustFS + SpringBoot?二、环境准备与部署2.1 安装 RustF

Python实现批量CSV转Excel的高性能处理方案

《Python实现批量CSV转Excel的高性能处理方案》在日常办公中,我们经常需要将CSV格式的数据转换为Excel文件,本文将介绍一个基于Python的高性能解决方案,感兴趣的小伙伴可以跟随小编一... 目录一、场景需求二、技术方案三、核心代码四、批量处理方案五、性能优化六、使用示例完整代码七、小结一、

Python中 try / except / else / finally 异常处理方法详解

《Python中try/except/else/finally异常处理方法详解》:本文主要介绍Python中try/except/else/finally异常处理方法的相关资料,涵... 目录1. 基本结构2. 各部分的作用tryexceptelsefinally3. 执行流程总结4. 常见用法(1)多个e

PHP应用中处理限流和API节流的最佳实践

《PHP应用中处理限流和API节流的最佳实践》限流和API节流对于确保Web应用程序的可靠性、安全性和可扩展性至关重要,本文将详细介绍PHP应用中处理限流和API节流的最佳实践,下面就来和小编一起学习... 目录限流的重要性在 php 中实施限流的最佳实践使用集中式存储进行状态管理(如 Redis)采用滑动

Vue3绑定props默认值问题

《Vue3绑定props默认值问题》使用Vue3的defineProps配合TypeScript的interface定义props类型,并通过withDefaults设置默认值,使组件能安全访问传入的... 目录前言步骤步骤1:使用 defineProps 定义 Props步骤2:设置默认值总结前言使用T

MyBatis-plus处理存储json数据过程

《MyBatis-plus处理存储json数据过程》文章介绍MyBatis-Plus3.4.21处理对象与集合的差异:对象可用内置Handler配合autoResultMap,集合需自定义处理器继承F... 目录1、如果是对象2、如果需要转换的是List集合总结对象和集合分两种情况处理,目前我用的MP的版本

Web服务器-Nginx-高并发问题

《Web服务器-Nginx-高并发问题》Nginx通过事件驱动、I/O多路复用和异步非阻塞技术高效处理高并发,结合动静分离和限流策略,提升性能与稳定性... 目录前言一、架构1. 原生多进程架构2. 事件驱动模型3. IO多路复用4. 异步非阻塞 I/O5. Nginx高并发配置实战二、动静分离1. 职责2