NFS shared storage live migration to achieve KVM-based virtual machine

NFS shared storage live migration to achieve KVM-based virtual machine

A: configuration environment

II: related to the installation dependencies

Three: to achieve NFS shared storage

Four: KVM machine configuration same procedure

Five: Installation KVM01 install the virtual machine

Six: realization of migration 

Initial test configuration: all hosts turn off the firewall and selinux

[root@localhost ~]# iptables -F

[root@localhost ~]# systemctl stop firewalld

[root@localhost ~]# systemctl disable firewalld

 

[root@localhost ~]# setenforce 0

[root@localhost ~]# sed -i '/SELINUX/ s/enforcing/disabled/g' /etc/sysconfig/selinux

NFS shared storage live migration to achieve KVM-based virtual hosting

Running virtual machines can be migrated from one KVM KVM KVM host to another host running without any downtime. If both KVM hosts can access the same storage pool, then the live migration work fine. To make the storage pool can be accessed on the KVM host, you need to use NFS or GFS2 file system (cluster file system). In this example, I use the NFS file system to store the VM image file. During the migration, VM "Memory" contents will be copied to the target KVM host, but at some point in time, the VM migration occurs. Note that when you share a file system on a KVM host, will not be VM disk image transmission over the network, since both KVM hosts can access the same storage pool.

 

Introduction Migration: Migration is running on a KVM virtual machine system that will run on KVM transferred to other physical machines

Static Migration: Migration in the case of virtual machines authorities

Dynamic Migration: Migrating the case of normal service running on a virtual machine, to be based on shared storage

Live migration features:

It will not cause significant impact on end users

Only a very short downtime

Live migration topology

 

 

lab environment:

KVM01 192,168,200.10

KVM02 192,168,200.11

NFS 192.168.200.12 

 

 

1, a three server hostname, the configuration / etc / hosts to ensure network connection

2, KVM connected to two hosts 'the NFS shared storage'

3, the KVM new source host and the virtual machine system is mounted

4, connected to KVM, and migration

Live migration demonstration

Source host KVM01 192.168.200.10

The destination host KVM02 192.168.200.11

NFS Share 192.168.200.12 shared storage / kvm-share

KVM01 and KVM02 KVM hosts are required to install the software and adjust the network mode, be sure to close all server iptables and selinux.

 

VMware virtual machine linux boot before the need to check the Inter VT-x / EPT or AMD / RVI (v)

A: configuration environment

[root@localhost ~]#hostname KVM01

[root@localhost ~]#bash

 

[root@localhost ~]#hostname KVM02

[root@localhost ~]#bash

[root@localhost ~]#hostname NFS

[root@localhost ~]#bash

 

 

[root@KVM01 ~]# cat /proc/cpuinfo | grep vmx                     #查看是否支持虚拟化功能
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ssbd ibrs ibpb stibp tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec arat spec_ctrl intel_stibp flush_l1d arch_capabilities
flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ssbd ibrs ibpb stibp tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec arat spec_ctrl intel_stibp flush_l1d arch_capabilities

 

[Root @ KVM01 ~] # vim / etc / hosts # edit the hosts file         

 

192168200111 KVM01

 

192168200112 KVM02

 

192.168.200.113 NFS

 

[root@KVM01 ~]# scp /etc/hosts 192.168.200.11:/etc

 

[root@KVM01 ~]# scp /etc/hosts 192.168.200.12:/etc

 

II: Installation dependent packages

Two KVM need to install dependencies

 

CD image CentOS7 system, a KVM has been provided to install the required software, by deploying a local disc image source yum, yum mounted directly to the required software.

[Root @ KVM01 ~] # yum -y groupinstall "GNOME Desktop" # install the GNOME desktop environment

[Root @ KVM01 ~] # yum -y install qemu-kvm #KVM module

[Root @ KVM01 ~] # yum -y install qemu-kvm-tools #KVM debugging tool, not installed

[Root @ KVM01 ~] # yum -y install qemu-img #qemu components, creating a disk, start the virtual machine

[Root @ KVM01 ~] # yum -y install bridge-utils # network support tools

[Root @ KVM01 ~] # yum -y install libvirt # VM management tools

[Root @ KVM01 ~] # yum -y install virt-manage0r # graphical interface to manage virtual machines

[root@KVM01 ~]# yum -y install qemu-kvm qemu-kvm-tools virt-install qemu-img bridge-utils libvirt virt-manager

Detecting whether the KVM module is installed successfully

[Root @ KVM01 ~] # lsmod | grip sq.m.

kvm_intel 174841 0

sqm 578518 1 kvm_intel

irqbypass 13503 1 sq.m

Note: Use yum after you install the desktop, the system default run target revised to graphical.target. After rebooting the system into a graphical interface, if not modify the system's default run target, errors may occur when restarted.

Open the service, after installation also need to open libvirtd Service

[root@KVM01 ~]# systemctl start libvirtd     

[root@KVM01 ~]# systemctl enable libvirtd

Three: to achieve shared NFS storage

NFS SERVER: Configure a shared directory / kvm-share

[root@NFS ~]# cat /etc/exports

[root@NFS ~]# mkdir /kvm-share

[root@NFS ~]# systemctl start nfs

KVM operation on both hosts:

View shared success

[Root @ KVM01 ~] # showmount -e 192,168,200,113

Export list for 192.168.200.113:

/ Sq-share 192.168.200.112,192.168.200.111

[Root @ KVM02 ~] # showmount -e 192,168,200,113

Export list for 192.168.200.113:

/ Sq-share 192.168.200.112,192.168.200.111

 Four: KVM machine configuration same procedure

Click QEMU / KVM

 

 

 

 

 

 

 

 

 The image transmitted by the xftp / virtual / IOS

Create a shared storage pool

 

 

 

 

 Create a shared storage volume in kvm-share in

 

 

 

 

 Five: KVM01 install the virtual machine

 

KVM01: 192.168.200.10 create virtual machines on shared storage

 

New Virtual Machine

go ahead

 

 

Select your uploaded image

 

Memory can be adjusted according to their needs little major

 Select the shared storage pool created yourself

Click to select the storage volume management have created yourself

 

 

 

Define your own configuration settings before installing

 

If the network configuration options before the bridge done BRIDGE

 

I did not do, so I chose NET mode

 

 

 

Set the host boot, there needs to be selected in your own image, because sometimes automatically deselected 

 

 

 

Click to start the installation, with the installation of Linux behind the same is not elaborated here 

Six: realization of migration

 

KVM migration: Open virt-manager to select the file select Add Connection

Source host connection destination host

 

 

 

If you encounter the following error need to install openssh-askpass

 

 

[root@KVM01 ~]# yum -y install openssh-askpass

[root@KVM02 ~]# yum -y install openssh-askpass

输入密码

 

 

 

 连接到会有新的一个QEMU/KVM后面有自己的ip

 

尝试迁移

 

 

有相同的报错做如下操作

 

 

 

 

 

[root@KVM01 ~]# virsh shutdown centos7.0

域 centos7.0 被关闭

 

[root@KVM01 ~]# virsh edit centos7.0

<driver name='qemu' type='raw' cache='none'/>

 

[root@KVM01 ~]# virsh start centos7.0

域 centos7.0 已开始

 

[root@KVM01 ~]# virsh list --all

Id 名称 状态

----------------------------------------------------

2 centos7.0 running

 这样就可以迁移成功了

 

Guess you like

Origin www.cnblogs.com/CAPF/p/11765501.html