openstack Migration[通俗易懂]

openstack Migration[通俗易懂]ConfiguringMigrationsMigrationallowsanadministratortomoveavirtualmachineinstancefromonecomputehosttoanother. Thisfeatureisusefulwhenacomputehostrequiresmaintenance. Mi

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全家桶1年46,售后保障稳定
Configuring Migrations(配置迁移)

Migration allows an administrator to move a virtual machine instance from one compute host to another. 


迁移允许管理员能够将虚拟机实例从一台计算主机移动到另一台。


This feature is useful when a compute host requires maintenance. 


当一台计算主机需要维护时此功能非常有用。


Migration can also be useful to redistribute the load when many VM instances are running on a specific physical machine.


当为运行着多个虚拟机实例的物理机重新分配负载时迁移也是有用的。


There are two types of migration:


有两种类型的迁移


Migration (or non-live migration): In this case the instance will be shut down (and the instance will know that it has been rebooted) for a period of time in order to be moved to another hypervisor.


迁移(或非实时迁移):在这种情况下,该虚拟机实例将会在一段时间内被关闭,移到另一台机器上后再重启


Live migration (or true live migration): Almost no instance downtime, it is useful when the instances must be kept running during the migration.


实时迁移:几乎没有实例宕机,当实例必须保持在迁移过程中处于运行状态时它是有用的。


There are two types of live migration:


有两种类型的实时迁移


Shared storage based live migration: In this case both hypervisors have access to a shared storage.


基于共享存储的实时迁移:在这种情况下,两个虚拟机管理程序可以访问共享存储。


Block live migration: for this type of migration, no shared storage is required.


块实时迁移:对于这种类型的迁移,无共享存储是必需的。


The following sections describe how to configure your hosts and compute nodes for migrations using the KVM and XenServer hypervisors.


以下描述如何在主机节点和计算节点上配置KVM和XenServer虚拟机管理程序的迁移。


KVM-Libvirt


Prerequisites


先决条件


Hypervisor: KVM with libvirt

Shared storage: NOVA-INST-DIR/instances/ (eg /var/lib/nova/instances) has to be mounted by shared storage. This guide uses NFS but other options, including the OpenStack Gluster Connector are available.


共享存储:必须通过挂载共享存储。本指南使用NFS,但是其他的选择,包括OpenStack的Gluster的连接器可供选择。


Instances: Instance can be migrated with iSCSI based volumes


实例:实例可以与基于iSCSI的卷迁移


Example Nova Installation Environment





Prepare 3 servers at least; for example, HostA, HostB and HostC


准备至少3台主机,例如:HostA, HostB 和 HostC


HostA is the “Cloud Controller”, and should be running: nova-api, nova-scheduler, nova-network, cinder-volume, nova-objectstore.


HostA是控制节点,运行nova-api, nova-scheduler, nova-network, cinder-volume, nova-objectstore服务


HostB and HostC are the “compute nodes”, running nova-compute.


HostB 和 HostC是计算节点,运行nova-compute服务


Ensure that, NOVA-INST-DIR (set with state_path in nova.conf) is same on all hosts.


确保 NOVA-INST-DIR 在各个节点相同


In this example, HostA will be the NFSv4 server which exports NOVA-INST-DIR/instances, and HostB and HostC mount it.


HostA提供共享存储,HostB 和 HostC挂载到HostA的NOVA-INST-DIR/instances目录下


System configuration


系统配置


1.Configure your DNS or /etc/hosts and ensure it is consistent across all hosts. Make sure that the three hosts can perform name resolution with each other. As a test, use the ping command to ping each host from one another.


在/etc/hosts下配置各个节点的IP和主机名称映射关系,保证各个节点都能够互相ping通


$ ping HostA


$ ping HostB


$ ping HostC


2.Ensure that the UID and GID of your nova and libvirt users are identical between each of your servers. This ensures that the permissions on the NFS mount will work correctly.


确保nova和libvirt在各个节点的用户名是相同的,以便确保对NFS挂载权限可以正常工作


3.Follow the instructions at the Ubuntu NFS HowTo to setup an NFS server on HostA, and NFS Clients on HostB and HostC.


按照在ubuntu上安装NFS说明,在HostA上安装NFS server ,在HostB 和 HostC上安装NFS client


Our aim is to export NOVA-INST-DIR/instances from HostA, and have it readable and writable by the nova user on HostB and HostC.


目的是确保nova用户可以在HostB 和 HostC上读写HostA上的NOVA-INST-DIR/instances目录,实现共享存储


4.Using your knowledge from the Ubuntu documentation, configure the NFS server at HostA by adding a line to /etc/exports


在HostA上的 /etc/exports文件添加以下内容


NOVA-INST-DIR/instances HostA/255.255.0.0(rw,sync,fsid=0,no_root_squash)


Change the subnet mask (255.255.0.0) to the appropriate value to include the IP addresses of HostB and HostC. Then restart the NFS server.


重启 NFS server 服务


$ /etc/init.d/nfs-kernel-server restart


$ /etc/init.d/idmapd restart


5.Set the ‘execute/search’ bit on your shared directory


On both compute nodes, make sure to enable the ‘execute/search’ bit to allow qemu to be able to use the images within the directories. On all hosts, execute the following command:


在每个节点上执行以下命令,NOVA-INST-DIR/instances 增加可执行权限


$ chmod o+x NOVA-INST-DIR/instances 


6.Configure NFS at HostB and HostC by adding below to /etc/fstab.


修改HostB和HostC上的/etc/fstab文件,添加以下内容


HostA:/ /NOVA-INST-DIR/instances nfs4 defaults 0 0


Then ensure that the exported directory can be mounted.


确保/NOVA-INST-DIR/instances目录可以挂载


$ mount -a -v


Check that “NOVA-INST-DIR/instances/” directory can be seen at HostA


$ ls -ld NOVA-INST-DIR/instances/


drwxr-xr-x 2 nova nova 4096 2012-05-19 14:34 nova-install-dir/instances/


Perform the same check at HostB and HostC – paying special attention to the permissions (nova should be able to write)


$ ls -ld NOVA-INST-DIR/instances/


drwxr-xr-x 2 nova nova 4096 2012-05-07 14:34 nova-install-dir/instances/


$ df -k


Filesystem           1K-blocks      Used Available Use% Mounted on


/dev/sda1            921514972   4180880 870523828   1% /


none                  16498340      1228  16497112   1% /dev


none                  16502856         0  16502856   0% /dev/shm


none                  16502856       368  16502488   1% /var/run


none                  16502856         0  16502856   0% /var/lock


none                  16502856         0  16502856   0% /lib/init/rw


HostA:        921515008 101921792 772783104  12% /var/lib/nova/instances  ( <— this line is important.)


7.Update the libvirt configurations. Modify /etc/libvirt/libvirtd.conf:


修改libvirt配置文件/etc/libvirt/libvirtd.conf


before : #listen_tls = 0


after : listen_tls = 0


before : #listen_tcp = 1


after : listen_tcp = 1


add: auth_tcp = “none”





Modify /etc/init/libvirt-bin.conf


before : exec /usr/sbin/libvirtd -d


after : exec /usr/sbin/libvirtd -d -l





Modify /etc/default/libvirt-bin


before :libvirtd_opts=” -d”


after :libvirtd_opts=” -d -l”



Restart libvirt. After executing the command, ensure that libvirt is successfully restarted.


$ stop libvirt-bin && start libvirt-bin


$ ps -ef | grep libvirt


root 1145 1 0 Nov27 ? 00:00:03 /usr/sbin/libvirtd -d -l


8.Configure your firewall to allow libvirt to communicate between nodes.


配置防火墙,确保libvirt在各个节点之间通讯


Information about ports used with libvirt can be found at the libvirt documentation By default, libvirt listens on TCP port 16509 and an ephemeral TCP range from 49152 to 49261 is used for the KVM communications. As this guide has disabled libvirt auth, you should take good care that these ports are only open to hosts within your installation.


9.You can now configure options for live migration. In most cases, you do not need to configure any options. The following chart is for advanced usage only.





以下是高级用法,在/etc/nova/nova.conf添加 以下参数





live_migration_bandwidth=0
(IntOpt)Maximum bandwidth to be used during migration, in Mbps


live_migration_flag=VIR_MIGRATE_UNDEFINE_SOURCE, VIR_MIGRATE_PEER2PEER
(StrOpt)Migration flags to be set for live migration


live_migration_retry_count=30
(IntOpt)Number of 1 second retries needed in live_migration


live_migration_uri=qemu+tcp://%s/system
(StrOpt)Migration target URI (any included “%s” is replaced with the migration target hostname)





Enabling true live migration


By default, the Compute service does not use libvirt’s live migration functionality. To enable this functionality, add the following line to nova.conf:


默认情况下,计算服务不启用libvirt的
实时迁移功能,要想启用,添加以下内容


live_migration_flag=VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE


The Compute service does not use libvirt’s live miration by default because there is a risk that the migration process will never terminate. This can happen if the guest operating system dirties blocks on the disk faster than they can migrated.


默认情况下,计算服务不启用libvirt的实时迁移功能,原因是有可能出现迁移过程永不停止的风险,客户操作系统弄脏磁盘块的速度比迁移速度快时,就会出现该情况

_______________________________________________________________________________________________________________

Using Migration

使用迁移


Before starting migrations, review the Configuring Migrations section.


在开始迁移之前,请查看配置迁移部分。


Migration provides a scheme to migrate running instances from one OpenStack Compute server to another OpenStack Compute server. This feature can be used as described below.





1, look at the running instances, to get the ID of the instance you wish to migrate.


查看正在运行的实例,获取想要迁移的实例Id


# nova list


+————————————–+——+——–+—————–+


|                  ID                  | Name | Status |Networks         |


+————————————–+——+——–+—————–+


| d1df1b5a-70c4-4fed-98b7-423362f2c47c | vm1  | ACTIVE | private=a.b.c.d |


| d693db9e-a7cf-45ef-a7c9-b3ecb5f22645 | vm2  | ACTIVE | private=e.f.g.h |


+————————————–+——+——–+—————–+





2, look at information associated with that instance – our example is vm1 from above.


根据ID查看虚拟机实例详细信息


# nova show d1df1b5a-70c4-4fed-98b7-423362f2c47c


+————————————-+———————————————————-+


|               Property              |                          Value                           |


+————————————-+———————————————————-+





| OS-EXT-SRV-ATTR:host                | HostB                                                    |





| flavor                              | m1.tiny                                                  |


| id                                  | d1df1b5a-70c4-4fed-98b7-423362f2c47c                     |


| name                                | vm1                                                      |


| private network                     | a.b.c.d                                                  |


| status                              | ACTIVE                                                   |





+————————————-+———————————————————-+


 


In this example, vm1 is running on HostB.





3, select the server to migrate instances to.


查看每个节点服务列表


# nova-manage service list


HostA nova-scheduler enabled  :-) None


HostA nova-network enabled  :-) None


HostB nova-compute enabled  :-) None


HostC nova-compute enabled  :-) None


 


In this example, HostC can be picked up because nova-compute is running on it.





4, ensure that HostC has enough resource for migration.


查看HostC资源信息,确保满足迁移


# nova-manage service describe_resource HostC


HOST             PROJECT     cpu   mem(mb)     hdd


HostC(total)                  16     32232     878


HostC(used_now)               13     21284     442


HostC(used_max)               13     21284     442


HostC            p1            5     10240     150


HostC            p2            5     10240     150


…..


 


cpu:the number of cpu


mem(mb):total amount of memory (MB)


hdd:total amount of space for NOVA-INST-DIR/instances(GB)


1st line shows total amount of resource physical server has.


2nd line shows current used resource.


3rd line shows maximum used resource.


4th line and under is used resource per project.





5, use the nova live-migration command to migrate the instances.


执行迁移,将ID为d1df1b5a-70c4-4fed-98b7-423362f2c47c的实例迁移到HostC上


# nova live-migration d1df1b5a-70c4-4fed-98b7-423362f2c47c HostC


Migration of d1df1b5a-70c4-4fed-98b7-423362f2c47c initiated.


 


Make sure instances are migrated successfully with nova list. If instances are still running on HostB, check logfiles (src/dest nova-compute and nova-scheduler) to determine why.

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/219181.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • 树莓派连接到WiFi并用ssh连接

    树莓派连接到WiFi并用ssh连接硬件:树莓派zerow;系统:2019-09-26-raspbian-buster-lite;1、在/boot/目录下创建文件wpa_supplicant.conf,如下,即可连接到WiFi;country=CNctrl_interface=DIR=/var/run/wpa_supplicantGROUP=netdevupdate_config=1network={…

  • 利用python画图

    利用python画图因为最近论文收尾需要画图,于是学了一些画图的东西在这里分享一下一、环境配置 linuxubuntu下需安装下面三个包:Numpy,Scipy,Matplotlib分别输入下面的代码进行安装:二、开始画一些简单的图(1)直线图#coding:utf-8importnumpyasnpimportmatplotlib.pyplotaspltx=…

  • 指标异动分析「建议收藏」

    指标异动分析「建议收藏」What业务都会面对“为什么涨、为什么降、原因是什么?”,因此日常数据分析80%总是在围绕指标异动做分析,进行原因定位,常见的指标异动分析例如GMV、DAU等为何下降?Why指标异动分析有利于为业务方建立业务抓手,及时定位业务异常原因,进而制定相应的运营调整策略,保障业务正常稳定发展How1、明确异常指标波动标准(净值百分比)业务指标会随着内外部环境变动而不断变化,数据的波动主要体现在变动日期与基准日期的对比(同环比)出现上升或下降。指标波动通常分为周期性波动、突发性波动、持续性波动。**

  • snmptrap报文_snmp指定发送IP

    snmptrap报文_snmp指定发送IP#/bin/shOidWarnHead=1.3.6.1.4.1.53151.2.15.4.1targetIp=172.16.101.34targetPort=162trapOid=1.3.6.1.4.1.53151.3.1warnIdOid=${OidWarnHead}.1.0warnIdVal=1500000200warnSnOid=${OidWarnHead}.2.0…

  • GRC系统_S7snap与PLC通信

    GRC系统_S7snap与PLC通信本系列文档介绍4G/5G开源项目srsRAN(srsLTE升级版)的基本使用方法。本文给出该开源项目的基本介绍、安装方法及NB-IoT基本测试。

  • t460 拆解_转一个详尽、全面的的X201拆机 – ThinkPad系统与软件技术|应用技巧|软件分享区 – 鸿利在线|北京ibm水货|IBM水货|Thinkpad笔记本|Thinkpad全球购|…

    t460 拆解_转一个详尽、全面的的X201拆机 – ThinkPad系统与软件技术|应用技巧|软件分享区 – 鸿利在线|北京ibm水货|IBM水货|Thinkpad笔记本|Thinkpad全球购|…占楼············下载(30.5KB)2010-6-123:42下载(20.97KB)2010-6-123:42ThinkPadX201的防水键盘,其实很多商务机都具备防水键盘,并不是说底部没有排水口的笔记本其键盘就不防水,是否防水取决于键盘导电薄膜边缘是否被密封。X201的键盘侧面有漏口,严格来说这不仅是防水键盘,而是进一步的防泼溅键盘。下载(23.51KB)2010…

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号