{"id":98,"date":"2015-08-20T15:12:55","date_gmt":"2015-08-20T07:12:55","guid":{"rendered":"http:\/\/vmnote.104.es\/?p=91"},"modified":"2015-08-20T15:12:55","modified_gmt":"2015-08-20T07:12:55","slug":"kvm-live-migration-environment","status":"publish","type":"post","link":"https:\/\/104.es\/index.php\/2015\/08\/20\/kvm-live-migration-environment\/","title":{"rendered":"\u5229\u7528\u4e09\u53f0\u4f3a\u670d\u5668\u5efa\u7acbKVM Live Migration\u5be6\u9a57\u74b0\u5883"},"content":{"rendered":"<p>\u5728\u9019\u908a\uff0c\u5148\u66ab\u6642\u4e0d\u8003\u616e\u7cfb\u7d71\u5b89\u5168\u6027\u7684\u554f\u984c\uff0c\u55ae\u7d14\u5c31\u53ea\u662f\u8981\u67b6\u69cb\u4e00\u500b\u53ef\u4ee5Zero Downtime Live Migration\u7684\u74b0\u5883\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e9b\u6ce8\u610f\u4e8b\u9805\u3002<\/p>\n<p>\u9996\u5148\uff0c\u6e96\u5099\u4e09\u53f0PC\uff0c\u5206\u5225\u662fHostA, HostB, and NFS\uff0c\u5176\u4e2dHostA\u4ee5\u53caHostB\u578b\u865f\u8981\u4e00\u6a23\uff0c\u56e0\u70ba\u5b83\u5011\u662f\u8981\u505aLive Migration\u7684\u5169\u53f0\u4f3a\u670d\u5668\u3002\u4e5f\u5c31\u662f\u6211\u5011\u5efa\u7acb\u7684VM\u8981\u80fd\u5920\u5728HostA\u548cHostB\u4e4b\u9593\u4efb\u610f\u5730Live Migration\u3002\u81f3\u65bcNFS\u5247\u4e0d\u8981\u6c42\u3002<\/p>\n<p>\u6211\u5011\u4f7f\u7528192.168.1.*\u7684\u5167\u7db2\uff0c\u5176\u4e2dHostA\u914d\u7f6e\u70ba192.168.1.10\uff0cHostB\u914d\u7f6e\u70ba192.168.1.11\uff0cVM\u914d\u7f6e\u70ba192.168.1.99\uff0c\u800cNFS\u5247\u914d\u7f6e\u5728192.168.1.103\u3002<\/p>\n<p><!--more--><\/p>\n<p>HostA\u548cHostB\u4f7f\u7528\u7684\u4f5c\u696d\u7cfb\u7d71\u662fCentOS 7\uff0c\u800cNFS\u6211\u5011\u7528\u7684\u662fUbuntu\uff0cVM\u5916\u662f\u5b89\u88ddFedora 22\uff0c\u4e26\u555f\u7528Apache2\u7db2\u9801\u4f3a\u670d\u5668\u3002<\/p>\n<p>\u5728\u5efa\u7acbKVM\u865b\u64ec\u6a5f\u4e4b\u524d\uff0c\u5b89\u88ddCentOS\u6642\u9700\u8981\u5148\u505a\u4e00\u4e9b\u8a2d\u5b9a\u7684\u5de5\u4f5c\uff0c\u4ee5\u4e0b\u662f\u8a2d\u5b9a\u5de5\u4f5c\u7684\u6458\u8981\uff1a<\/p>\n<ul>\n<li>HostA\u4ee5\u53caHostB\u5b89\u88ddCentOS<\/li>\n<li>\u66f4\u65b0 \/etc\/hostname \u4ee5\u53ca \/etc\/hosts \u5169\u500b\u6a94\u6848\uff0c\u8a2d\u5b9a\u6b63\u78ba\u7684\u4e3b\u6a5f\u540d\u7a31\uff0c\u7136\u5f8creboot<\/li>\n<li>\u57f7\u884c\u7cfb\u7d71\u66f4\u65b0 yum -y update<\/li>\n<li>\u5b89\u88dd\u5716\u5f62\u5316\u684c\u9762 yum -y groupinstall &#8220;GNOME Desktop&#8221;<\/li>\n<li>\u4f7f\u7528systemctl set-default graphical.target\u6307\u4ee4\uff0c\u5c07\u5716\u5f62\u5316\u684c\u9762\u8a2d\u5b9a\u70ba\u958b\u6a5f\u555f\u52d5\uff0c\u7136\u5f8creboot<\/li>\n<li>\u7de8\u8f2f \/etc\/selinux\/config\uff0c\u628aSELINUX\u8a2d\u70badisabled<\/li>\n<li>\u57f7\u884c systemctl disable firewalld\uff0c\u95dc\u9589firewall<\/li>\n<li>reboot<\/li>\n<li>\u4f7f\u7528\u4ee5\u4e0b\u6307\u4ee4\u5b89\u88dd kvm<\/li>\n<li>yum -y install qemu-kvm libvirt virt-install bridge-utils virt-manager<\/li>\n<li>\u628a\u6240\u6709\u7684.iso\u4ee5\u53caqcow2\u6a94\u6848\u5747\u653e\u5728NFS\u7684\/var\/images\u8cc7\u6599\u593e\u4e2d<\/li>\n<li>mount -t nfs 192.168.1.103:\/var\/images \/var\/lib\/libvirt\/images<\/li>\n<li>\u4f7f\u7528 yum -y remove NetworkManager\u79fb\u9664NetworkManger\uff0c\u4ee5\u907f\u514d\u7db2\u8def\u8a2d\u5b9a\u4e0a\u7684\u5e72\u64fe<\/li>\n<li>\u4fee\u6539\/etc\/sysconfig\/network-script\/ifcfg-eno1\u7684\u5167\u5bb9\uff0c\u4e26\u65b0\u589e\/etc\/sysconfig\/network-script\/ifcfg-bridge\u6a94\u6848<\/li>\n<li>reboot<\/li>\n<li>\u4ee5virt-manager\u6307\u4ee4\u9032\u5165Virtual Machine Manager<\/li>\n<li>\u5efa\u7acbVM\uff0c\u9032\u5165VM\u7684details\u8a2d\u5b9a\u4e2d\uff0c\u627e\u51faIDE Diske 1\uff0c\u7136\u5f8c\u5230Performance\u8a2d\u5b9a\u4e2d\uff0c\u8a2d\u5b9aCache mode\u70banone<\/li>\n<li>\u78ba\u5b9aVirutal Machine Mangager\u4e2d\u7684Virtual Machine\u6240\u4f7f\u7528\u7684NIC\u662fBridge bridge (Host device eno1)<\/li>\n<\/ul>\n<p>\u4f60\u9700\u53c3\u8003\u4f60\u7684ifcfg-ens1\u4fee\u6539\u548c\u65b0\u589e\u4ee5\u4e0b\u9019\u5169\u500b\u6a94\u6848\uff1a<\/p>\n<p>ifcfg-ens1\u6539\u70ba<\/p>\n<p>[code]<\/p>\n<p>TYPE=&quot;Ethernet&quot;<br \/>\nBOOTPROTO=&quot;none&quot;<br \/>\nDEFROUTE=&quot;yes&quot;<br \/>\nIPV4_FAILURE_FATAL=&quot;no&quot;<br \/>\nIPV6INIT=&quot;yes&quot;<br \/>\nIPV6_AUTOCONF=&quot;yes&quot;<br \/>\nIPV6_DEFROUTE=&quot;yes&quot;<br \/>\nIPV6_FAILURE_FATAL=&quot;no&quot;<br \/>\nNAME=&quot;eno1&quot;<br \/>\nUUID=&quot;8bf6b734-0c6f-4cdd-b738-981e132deb3b&quot;<br \/>\nDEVICE=&quot;eno1&quot;<br \/>\nONBOOT=&quot;yes&quot;<br \/>\nIPADDR=&quot;192.168.1.11&quot;<br \/>\nPREFIX=&quot;24&quot;<br \/>\nGATEWAY=&quot;192.168.1.1&quot;<br \/>\nDNS1=&quot;168.95.1.1&quot;<br \/>\nIPV6_PEERDNS=&quot;yes&quot;<br \/>\nIPV6_PEERROUTES=&quot;yes&quot;<br \/>\nIPV6_PRIVACY=&quot;no&quot;<br \/>\nBRIDGE=bridge<br \/>\nNM_CONTROLLED=&quot;no&quot;<br \/>\nUSERCTL=&quot;no&quot;<\/p>\n<p>[\/code]<\/p>\n<p>&nbsp;<\/p>\n<p>ifcfg-bridge\u7684\u5167\u5bb9\u5247\u70ba\uff1a<\/p>\n<p>[code]<\/p>\n<p>TYPE=&quot;Bridge&quot;<br \/>\nBOOTPROTO=&quot;none&quot;<br \/>\nDEFROUTE=&quot;yes&quot;<br \/>\nIPV4_FAILURE_FATAL=&quot;no&quot;<br \/>\nNAME=&quot;eno1&quot;<br \/>\nDEVICE=&quot;bridge&quot;<br \/>\nONBOOT=&quot;yes&quot;<br \/>\nIPADDR=&quot;192.168.1.11&quot;<br \/>\nPREFIX=&quot;24&quot;<br \/>\nGATEWAY=&quot;192.168.1.1&quot;<br \/>\nDNS1=&quot;168.95.1.1&quot;<br \/>\nNM_CONTROLLED=&quot;no&quot;<br \/>\nUSERCTL=&quot;no&quot;<\/p>\n<p>[\/code]<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u9019\u908a\uff0c\u5148\u66ab\u6642\u4e0d\u8003\u616e\u7cfb\u7d71\u5b89\u5168\u6027\u7684\u554f\u984c\uff0c\u55ae\u7d14\u5c31\u53ea\u662f\u8981\u67b6\u69cb\u4e00\u500b\u53ef\u4ee5Zero Downtime Live Migration\u7684\u74b0\u5883\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e9b\u6ce8\u610f\u4e8b\u9805\u3002<\/p>\n<p>\u9996\u5148\uff0c\u6e96\u5099\u4e09\u53f0PC\uff0c\u5206\u5225\u662fHostA, HostB, and NFS\uff0c\u5176\u4e2dHostA\u4ee5\u53caHostB\u578b\u865f\u8981\u4e00\u6a23\uff0c\u56e0\u70ba\u5b83\u5011\u662f\u8981\u505aLive Migration\u7684\u5169\u53f0\u4f3a\u670d\u5668\u3002\u4e5f\u5c31\u662f\u6211\u5011\u5efa\u7acb\u7684VM\u8981\u80fd\u5920\u5728HostA\u548cHostB\u4e4b\u9593\u4efb\u610f\u5730Live Migration\u3002\u81f3\u65bcNFS\u5247\u4e0d\u8981\u6c42\u3002<\/p>\n<p>\u6211\u5011\u4f7f\u7528192.168.1.*\u7684\u5167\u7db2\uff0c\u5176\u4e2dHostA\u914d\u7f6e\u70ba192.168.1.10\uff0cHostB\u914d\u7f6e\u70ba192.168.1.11\uff0cVM\u914d\u7f6e\u70ba192.168.1.99\uff0c\u800cNFS\u5247\u914d\u7f6e\u5728192.168.1.103\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[97],"tags":[114,134,145,192],"class_list":["post-98","post","type-post","status-publish","format-standard","hentry","category-kvm-libvirt","tag-centos","tag-kvm-live-migration","tag-live-migration","tag-virutal-machine"],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/98","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/comments?post=98"}],"version-history":[{"count":0,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/98\/revisions"}],"wp:attachment":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/media?parent=98"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/categories?post=98"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/tags?post=98"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}