×ðÁú¿­Ê±¹ÙÍøµÇ¼

ÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõÄÐéÄ⻯ÇéÐÎ

ÔõÑùÔÚlinuxÉÏÉèÖø߿ÉÓõÄÐéÄ⻯ÇéÐÎ

¸ÅÊö£º

Ëæ×ÅÐéÄ⻯ÊÖÒÕµÄÒ»Ö±Éú³¤£¬Ô½À´Ô½¶àµÄÆóÒµ×îÏȽÓÄÉÐéÄ⻯ÊÖÒÕÀ´Ìá¸ßIT×ÊԴʹÓÃÂʺͿɿ¿ÐÔ¡£ÔÚLinux²Ù×÷ϵͳÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýÉèÖø߿ÉÓõÄÐéÄ⻯ÇéÐÎÀ´È·±£ÔÚһ̨ÎïÀíЧÀÍÆ÷¹ÊÕÏʱ£¬ÐéÄâÐÔÄܹ»ÎÞ·ìǨáãµ½Áíһ̨ÊÂÇéÕý³£µÄЧÀÍÆ÷ÉÏ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚlinuxÉÏÉèÖø߿ÉÓõÄÐéÄ⻯ÇéÐΣ¬²¢¸½ÉÏ´úÂëʾÀý¡£

×°ÖÃÐéÄ⻯Èí¼þ

Ê×ÏÈ£¬ÎÒÃÇÐèҪװÖÃÒ»¸ö¿É¿¿µÄÐéÄ⻯Èí¼þ£¬ÈçKVM (Kernel-based Virtual Machine)¡£ÔÚ´ó´ó¶¼Linux¿¯ÐаæÖУ¬KVMÒѾ­°üÀ¨ÔÚÄÚºËÖУ¬Òò´ËÎÒÃÇÖ»Ðè×°ÖÃһЩÌØÁíÍâÈí¼þ°ü¼´¿É¡£ÒÔÏÂÊÇÔÚ³£¼ûµÄDebianºÍRed HatϵÁп¯ÐаæÖÐ×°ÖÃKVMµÄÏÂÁ

DebianϵÁУº

$ sudo apt-get install qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager

Red HatϵÁУº

$ sudo yum install qemu-kvm libvirt bridge-utils virt-manager

½¨ÉèÐéÄâ»ú

ÔÚ×°ÖÃÍê³ÉKVMºó£¬ÎÒÃÇ¿ÉÒÔʹÓÃvirt-managerÀ´½¨ÉèºÍÖÎÀíÐéÄâ»ú¡£·­¿ªÖնˣ¬ÔËÐÐÒÔÏÂÏÂÁîÒÔÆô¶¯virt-manager£º

$ sudo virt-manager

ÔÚvirt-managerµÄ½çÃæÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýµã»÷”Create a new virtual machine”À´½¨ÉèеÄÐéÄâ»ú¡£Æ¾Ö¤ÐèÒª£¬ÉèÖÃÐéÄâ»úµÄÃû³Æ¡¢ÄÚ´æ¾Þϸ¡¢Ó²Å̾ÞϸµÈ²ÎÊý¡£

ÉèÖù²Ïí´æ´¢

ҪʵÏָ߿ÉÓÃÐÔ£¬ÎÒÃÇÐèÒªÉèÖù²Ïí´æ´¢£¬Ê¹µÃÐéÄâÐÔÄܹ»ÔÚ¶ą̀ÎïÀíЧÀÍÆ÷Ö®¼äǨáã¡£Õâ¿ÉÒÔͨ¹ýʹÓÃiSCSI£¨Internet Small Computer System Interface£©ÊµÏÖ¡£ÒÔÏÂÊÇһЩ³£¼ûµÄiSCSIЧÀÍÆ÷Èí¼þµÄ×°ÖÃÏÂÁ

DebianϵÁУº

$ sudo apt-get install targetcli

Red HatϵÁУº

$ sudo yum install targetcli

×°ÖÃÍê³Éºó£¬ÎÒÃÇ¿ÉÒÔʹÓÃtargetcliÏÂÁîÀ´½¨ÉèiSCSI¹²Ïí´æ´¢¡£ÒÔÏÂÊÇÒ»¸öʾÀý£º

$ sudo targetcli

/> backstores/block create storage /dev/sdb

/> iscsi/ create iqn.2020-01.com.example:storage

/> iscsi/iqn.2020-01.com.example:storage/tpg1/luns create /backstores/block/storage

/> exit

ÉèÖø߿ÉÓÃÐÔ

ÔÚ±¾Ê¾ÀýÖУ¬ÎÒÃǽ«Ê¹ÓÃPacemakerºÍCorosyncÀ´ÊµÏָ߿ÉÓÃÐÔ¡£PacemakerÊÇÒ»¸ö¿ªÔ´µÄ¼¯ÈºÖÎÀí¹¤¾ß£¬CorosyncÓÃÓÚÔÚ¼¯ÈºÖоÙÐÐͨѶ¡£ÒÔÏÂÊÇÔÚDebianºÍRed HatϵÁп¯ÐаæÖÐ×°ÖÃÕâЩÈí¼þµÄÏÂÁ

DebianϵÁУº

$ sudo apt-get install pacemaker corosync fence-agents

Red HatϵÁУº

$ sudo yum install pacemaker corosync fence-agents

×°ÖÃÍê³Éºó£¬ÎÒÃÇÐèÒª¶ÔPacemaker¾ÙÐÐÉèÖ᣷­¿ªÖնˣ¬ÔËÐÐÒÔÏÂÏÂÁ

$ sudo crm configure

ʹÓÃÒÔÏÂÏÂÁÉèÒ»¸öÐéÄâip×ÊÔ´²¢½«Æä¹ØÁªµ½ÐéÄâ»ú£º

crm(live)# primitive virtual-ip ocf:heartbeat:IPaddr2 params ip=”192.168.0.100″ cidr_netmask=”24″ nic=”eth0″ op monitor interval=”30s”

crm(live)# primitive virtual-machine ocf:pacemaker:VirtualDomain params hypervisor=”qemu:///system” config=”/etc/libvirt/qemu/some_guest.xml” op monitor interval=”30s”

crm(live)# group vm-group virtual-ip virtual-machine

crm(live)# commit

²âÊԸ߿ÉÓÃÐÔ

ΪÁ˲âÊԸ߿ÉÓÃÐÔ£¬ÎÒÃÇÐèÒªÊÖ¶¯¹Ø±ÕÄ¿½ñÔËÐÐÐéÄâ»úµÄÎïÀíЧÀÍÆ÷¡£ÔÚÁíһ̨ÊÂÇéÕý³£µÄЧÀÍÆ÷ÉÏ£¬ÎÒÃÇÓ¦¸Ã¿´µ½ÐéÄâ»úÀֳɵØǨá㵽еĽڵ㲢¼ÌÐøÔËÐС£ÒÔÏÂÊÇÔÚÖÕ¶ËÉϾÙÐвâÊÔµÄÏÂÁ

$ sudo virsh destroy some_guest

$ sudo virsh undefine some_guest

ÔÚδ¹Ø±ÕÐéÄâ»ú֮ǰ£¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÉó²éÐéÄâ»úËùÔڵĽڵ㣺

$ sudo crm status

½áÂÛ£º

ͨ¹ýÉèÖø߿ÉÓõÄÐéÄ⻯ÇéÐΣ¬ÎÒÃÇ¿ÉÒÔÈ·±£ÔÚһ̨ÎïÀíЧÀÍÆ÷¹ÊÕÏʱ£¬ÐéÄâÐÔÄܹ»ÎÞ·ìǨáãµ½Áíһ̨ÊÂÇéÕý³£µÄЧÀÍÆ÷ÉÏ¡£±¾ÎÄÏÈÈÝÁËÔõÑùÔÚLinuxÉÏʹÓÃKVM¡¢iSCSI¡¢PacemakerºÍCorosyncÀ´ÉèÖø߿ÉÓõÄÐéÄ⻯ÇéÐΣ¬²¢ÌṩÁËÏìÓ¦µÄ´úÂëʾÀý¡£Ï£Íû±¾ÎÄÄܶԶÁÕßÔÚÉèÖø߿ÉÓõÄÐéÄ⻯ÇéÐÎʱÓÐËù×ÊÖú¡£

²Î¿¼Á´½Ó£º

https://www.debian.org/

https://www.redhat.com/

https://help.ubuntu.com/community/KVM

https://www.linux-kvm.org/page/Main_Page

ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõÄÐéÄ⻯ÇéÐεÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ