Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

附录 B. 实​​​​​​​验​​​​​​​ 2

Live 移​​​​​​​植​​​​​​​
目​​​​​​​标​​​​​​​:在​​​​​​​两​​​​​​​台​​​​​​​主​​​​​​​机​​​​​​​之​​​​​​​间​​​​​​​配​​​​​​​置​​​​​​​并​​​​​​​执​​​​​​​行​​​​​​​ live 移​​​​​​​植​​​​​​​。​​​​​​​
先​​​​​​​决​​​​​​​条​​​​​​​件​​​​​​​:两​​​​​​​台​​​​​​​装​​​​​​​有​​​​​​​附​​​​​​​带​​​​​​​虚​​​​​​​拟​​​​​​​化​​​​​​​平​​​​​​​台​​​​​​​的​​​​​​​红​​​​​​​帽​​​​​​​企​​​​​​​业​​​​​​​ Linux 5.0 Beta 2 的​​​​​​​工​​​​​​​作​​​​​​​站​​​​​​​,其​​​​​​​中​​​​​​​一​​​​​​​台​​​​​​​装​​​​​​​有​​​​​​​ Fedora Core 6 Xen 客​​​​​​​户​​​​​​​机​​​​​​​。​​​​​​​
在​​​​​​​这​​​​​​​个​​​​​​​实​​​​​​​验​​​​​​​里​​​​​​​,你​​​​​​​将​​​​​​​为​​​​​​​移​​​​​​​植​​​​​​​进​​​​​​​行​​​​​​​配​​​​​​​置​​​​​​​并​​​​​​​在​​​​​​​这​​​​​​​两​​​​​​​个​​​​​​​主​​​​​​​机​​​​​​​之​​​​​​​间​​​​​​​执​​​​​​​行​​​​​​​移​​​​​​​植​​​​​​​。​​​​​​​
说​​​​​​​明​​​​​​​:在​​​​​​​你​​​​​​​开​​​​​​​始​​​​​​​之​​​​​​​前​​​​​​​
在​​​​​​​这​​​​​​​个​​​​​​​实​​​​​​​验​​​​​​​里​​​​​​​,你​​​​​​​将​​​​​​​需​​​​​​​要​​​​​​​两​​​​​​​台​​​​​​​虚​​​​​​​拟​​​​​​​化​​​​​​​主​​​​​​​机​​​​​​​:一​​​​​​​个​​​​​​​ Xen 客​​​​​​​户​​​​​​​机​​​​​​​和​​​​​​​一​​​​​​​个​​​​​​​用​​​​​​​于​​​​​​​共​​​​​​​享​​​​​​​存​​​​​​​储​​​​​​​空​​​​​​​间​​​​​​​的​​​​​​​主​​​​​​​机​​​​​​​。​​​​​​​你​​​​​​​必​​​​​​​须​​​​​​​用​​​​​​​ UTP 电​​​​​​​缆​​​​​​​连​​​​​​​接​​​​​​​这​​​​​​​两​​​​​​​台​​​​​​​主​​​​​​​机​​​​​​​。​​​​​​​其​​​​​​​中​​​​​​​一​​​​​​​台​​​​​​​用​​​​​​​ NFS 导​​​​​​​出​​​​​​​共​​​​​​​享​​​​​​​的​​​​​​​存​​​​​​​储​​​​​​​空​​​​​​​间​​​​​​​。​​​​​​​你​​​​​​​必​​​​​​​须​​​​​​​配​​​​​​​置​​​​​​​这​​​​​​​两​​​​​​​台​​​​​​​机​​​​​​​器​​​​​​​来​​​​​​​成​​​​​​​功​​​​​​​地​​​​​​​进​​​​​​​行​​​​​​​移​​​​​​​植​​​​​​​。​​​​​​​Xen 客​​​​​​​户​​​​​​​机​​​​​​​存​​​​​​​放​​​​​​​在​​​​​​​共​​​​​​​享​​​​​​​的​​​​​​​存​​​​​​​储​​​​​​​空​​​​​​​间​​​​​​​里​​​​​​​。​​​​​​​在​​​​​​​ Xen 客​​​​​​​户​​​​​​​机​​​​​​​上​​​​​​​,你​​​​​​​应​​​​​​​该​​​​​​​安​​​​​​​装​​​​​​​一​​​​​​​个​​​​​​​ streaming 服​​​​​​​务​​​​​​​器​​​​​​​。​​​​​​​当​​​​​​​ live 移​​​​​​​植​​​​​​​在​​​​​​​两​​​​​​​台​​​​​​​主​​​​​​​机​​​​​​​间​​​​​​​进​​​​​​​行​​​​​​​时​​​​​​​,你​​​​​​​必​​​​​​​须​​​​​​​确​​​​​​​保​​​​​​​这​​​​​​​个​​​​​​​ streaming 服​​​​​​​务​​​​​​​器​​​​​​​在​​​​​​​ Xen 客​​​​​​​户​​​​​​​机​​​​​​​上​​​​​​​不​​​​​​​间​​​​​​​断​​​​​​​地​​​​​​​运​​​​​​​行​​​​​​​。​​​​​​​对​​​​​​​于​​​​​​​实​​​​​​​验​​​​​​​ 2,这​​​​​​​两​​​​​​​台​​​​​​​虚​​​​​​​拟​​​​​​​化​​​​​​​主​​​​​​​机​​​​​​​被​​​​​​​称​​​​​​​为​​​​​​​ host1 和​​​​​​​ host2 。​​​​​​​
步​​​​​​​骤​​​​​​​ 1:配​​​​​​​置​​​​​​​ xend(两​​​​​​​台​​​​​​​ Xen 主​​​​​​​机​​​​​​​)
在​​​​​​​本​​​​​​​实​​​​​​​验​​​​​​​的​​​​​​​过​​​​​​​程​​​​​​​中​​​​​​​,你​​​​​​​将​​​​​​​配​​​​​​​置​​​​​​​ xend 来​​​​​​​作​​​​​​​为​​​​​​​ HTTP 服​​​​​​​务​​​​​​​器​​​​​​​和​​​​​​​ relocation 服​​​​​​​务​​​​​​​器​​​​​​​启​​​​​​​动​​​​​​​。​​​​​​​缺​​​​​​​省​​​​​​​情​​​​​​​况​​​​​​​下​​​​​​​,xend 守​​​​​​​护​​​​​​​进​​​​​​​程​​​​​​​不​​​​​​​初​​​​​​​始​​​​​​​化​​​​​​​ HTTP 服​​​​​​​务​​​​​​​器​​​​​​​。​​​​​​​它​​​​​​​启​​​​​​​动​​​​​​​ UNIX 域​​​​​​​套​​​​​​​接​​​​​​​字​​​​​​​管​​​​​​​理​​​​​​​服​​​​​​​务​​​​​​​器​​​​​​​(xm)并​​​​​​​与​​​​​​​ xend 进​​​​​​​行​​​​​​​通​​​​​​​信​​​​​​​。​​​​​​​要​​​​​​​启​​​​​​​用​​​​​​​跨​​​​​​​机​​​​​​​器​​​​​​​的​​​​​​​ live 移​​​​​​​植​​​​​​​,你​​​​​​​必​​​​​​​须​​​​​​​对​​​​​​​它​​​​​​​进​​​​​​​行​​​​​​​配​​​​​​​置​​​​​​​:
  1. 备​​​​​​​份​​​​​​​ xend-config.sxp 文​​​​​​​件​​​​​​​:
        cp -pr /etc/xen/xend-config.sxp /etc/xen/xend-config.sxp.default
    
  2. 编​​​​​​​辑​​​​​​​ /etc/xen/xend-config.sxp 并​​​​​​​进​​​​​​​行​​​​​​​如​​​​​​​下​​​​​​​修​​​​​​​改​​​​​​​:
    #(xend-unix-server yes)(xend-relocation-server
        yes)(xend-relocation-port 8002)(xend-relocation-address
        '')(xend-relocation-hosts-allow '')#(xend-relocation-hosts-allow '^localhost$
        ^localhost\\.localdomain$')
    
  3. 重​​​​​​​启​​​​​​​ xend:service 并​​​​​​​ xend restart。​​​​​​​
步​​​​​​​骤​​​​​​​ 2:通​​​​​​​过​​​​​​​ NFS 导​​​​​​​出​​​​​​​共​​​​​​​享​​​​​​​存​​​​​​​储​​​​​​​空​​​​​​​间​​​​​​​
在​​​​​​​这​​​​​​​个​​​​​​​实​​​​​​​验​​​​​​​的​​​​​​​过​​​​​​​程​​​​​​​中​​​​​​​,你​​​​​​​将​​​​​​​配​​​​​​​置​​​​​​​ NFS 并​​​​​​​用​​​​​​​它​​​​​​​来​​​​​​​导​​​​​​​出​​​​​​​一​​​​​​​个​​​​​​​共​​​​​​​享​​​​​​​存​​​​​​​储​​​​​​​空​​​​​​​间​​​​​​​。​​​​​​​
  1. 编​​​​​​​辑​​​​​​​ /etc/exports 并​​​​​​​包​​​​​​​含​​​​​​​如​​​​​​​下​​​​​​​的​​​​​​​一​​​​​​​行​​​​​​​:/xen *(rw,sync,no_root_squash)/
  2. 保​​​​​​​存​​​​​​​ /etc/exports 并​​​​​​​重​​​​​​​新​​​​​​​启​​​​​​​动​​​​​​​ NFS 服​​​​​​​务​​​​​​​器​​​​​​​。​​​​​​​确​​​​​​​保​​​​​​​用​​​​​​​ default:service nfs startchkconfig nfs on 启​​​​​​​动​​​​​​​ NFS 服​​​​​​​务​​​​​​​器​​​​​​​。​​​​​​​
  3. 在​​​​​​​ host1 上​​​​​​​启​​​​​​​动​​​​​​​ NFS 服​​​​​​​务​​​​​​​器​​​​​​​后​​​​​​​,我​​​​​​​们​​​​​​​就​​​​​​​可​​​​​​​以​​​​​​​挂​​​​​​​载​​​​​​​它​​​​​​​:host2:mount host1:/xen 。​​​​​​​
  4. 现​​​​​​​在​​​​​​​在​​​​​​​ host1 上​​​​​​​启​​​​​​​动​​​​​​​ Xen 客​​​​​​​户​​​​​​​机​​​​​​​并​​​​​​​选​​​​​​​择​​​​​​​ fc6-pv1 (或​​​​​​​实​​​​​​​验​​​​​​​ 1 里​​​​​​​的​​​​​​​ fc6-pv2 ):
    xm create -c fc6-pv1
    
步​​​​​​​骤​​​​​​​ 3:安​​​​​​​装​​​​​​​ Xen 客​​​​​​​户​​​​​​​机​​​​​​​的​​​​​​​ streaming 服​​​​​​​务​​​​​​​器​​​​​​​
在​​​​​​​这​​​​​​​个​​​​​​​步​​​​​​​骤​​​​​​​里​​​​​​​,你​​​​​​​将​​​​​​​安​​​​​​​装​​​​​​​用​​​​​​​于​​​​​​​演​​​​​​​示​​​​​​​目​​​​​​​的​​​​​​​的​​​​​​​ streaming 服​​​​​​​务​​​​​​​器​​​​​​​:gnump3d。​​​​​​​你​​​​​​​将​​​​​​​选​​​​​​​择​​​​​​​ gnump3d,因​​​​​​​为​​​​​​​它​​​​​​​支​​​​​​​持​​​​​​​ OGG vorbis 文​​​​​​​件​​​​​​​且​​​​​​​易​​​​​​​于​​​​​​​安​​​​​​​装​​​​​​​、​​​​​​​配​​​​​​​置​​​​​​​和​​​​​​​修​​​​​​​改​​​​​​​。​​​​​​​
  1. 从​​​​​​​ http://www.gnump3d.org/ 下​​​​​​​载​​​​​​​ gnump3d-2.9.9.9.tar.bz2 tarball。​​​​​​​在​​​​​​​ gnump3d-2.9.9.9/ 目​​​​​​​录​​​​​​​里​​​​​​​解​​​​​​​压​​​​​​​这​​​​​​​个​​​​​​​ tarball 文​​​​​​​件​​​​​​​、​​​​​​​编​​​​​​​译​​​​​​​并​​​​​​​安​​​​​​​装​​​​​​​: gnump3d application:tar xvjf gnump3d-2.9.9.9.tar.bz2cd gnump3d-2.9.9.9/make install
  2. Create a /home/mp3 directory and copy TruthHappens.ogg from Red Hat's Truth Happens page to mkdir /home/mp3wget -c http://www.redhat.com/v/ogg/TruthHappens.ogg
  3. 输​​​​​​​入​​​​​​​下​​​​​​​面​​​​​​​的​​​​​​​命​​​​​​​令​​​​​​​来​​​​​​​启​​​​​​​动​​​​​​​ streaming 服​​​​​​​务​​​​​​​器​​​​​​​
     command:gnump3d
    
  4. 在​​​​​​​两​​​​​​​台​​​​​​​ Xen 主​​​​​​​机​​​​​​​的​​​​​​​任​​​​​​​何​​​​​​​一​​​​​​​台​​​​​​​上​​​​​​​,运​​​​​​​行​​​​​​​ Movie Player。​​​​​​​如​​​​​​​果​​​​​​​没​​​​​​​有​​​​​​​安​​​​​​​装​​​​​​​,在​​​​​​​运​​​​​​​行​​​​​​​ Movie Player 之​​​​​​​前​​​​​​​安​​​​​​​装​​​​​​​ totem 和​​​​​​​ iso-codecs 软​​​​​​​件​​​​​​​包​​​​​​​。​​​​​​​点​​​​​​​击​​​​​​​ Applications,然​​​​​​​后​​​​​​​是​​​​​​​ Sound & Video,最​​​​​​​后​​​​​​​选​​​​​​​择​​​​​​​ Movie Player。​​​​​​​
  5. 点​​​​​​​击​​​​​​​ Movie,然​​​​​​​后​​​​​​​ Open Location,输​​​​​​​入​​​​​​​ http://guest:8888/TruthHappens.ogg。​​​​​​​
步​​​​​​​骤​​​​​​​ 4:执​​​​​​​行​​​​​​​ live 移​​​​​​​植​​​​​​​
  1. 在​​​​​​​两​​​​​​​台​​​​​​​ Xen 主​​​​​​​机​​​​​​​的​​​​​​​其​​​​​​​中​​​​​​​一​​​​​​​台​​​​​​​上​​​​​​​运​​​​​​​行​​​​​​​ TruthHappens.ogg 文​​​​​​​件​​​​​​​。​​​​​​​
  2. 执​​​​​​​行​​​​​​​从​​​​​​​ host1 到​​​​​​​ host2 的​​​​​​​ live 移​​​​​​​植​​​​​​​:
    xm migrate –live fc6-pv1 host2
    
  3. 用​​​​​​​下​​​​​​​面​​​​​​​的​​​​​​​命​​​​​​​令​​​​​​​在​​​​​​​两​​​​​​​台​​​​​​​ Xen 主​​​​​​​机​​​​​​​上​​​​​​​打​​​​​​​开​​​​​​​多​​​​​​​个​​​​​​​窗​​​​​​​口​​​​​​​终​​​​​​​端​​​​​​​:
    watch -n1 xm list
    
  4. 观​​​​​​​察​​​​​​​ live 移​​​​​​​植​​​​​​​。​​​​​​​注​​​​​​​意​​​​​​​完​​​​​​​成​​​​​​​这​​​​​​​个​​​​​​​移​​​​​​​植​​​​​​​需​​​​​​​要​​​​​​​多​​​​​​​少​​​​​​​时​​​​​​​间​​​​​​​。​​​​​​​
挑​​​​​​​战​​​​​​​性​​​​​​​的​​​​​​​步​​​​​​​骤​​​​​​​:在​​​​​​​ Xen 客​​​​​​​户​​​​​​​机​​​​​​​里​​​​​​​配​​​​​​​置​​​​​​​ VNC 服​​​​​​​务​​​​​​​器​​​​​​​
If time permits, from within the Xen guest, configure the VNC server to initiate when gdm starts up. Run VNC viewer and connect to the Xen guest. Play with the Xen guest when the live migration occurs. Attempt to pause/resume, and save/restore the Xen guest and observe what happens to the VNC viewer. If you connect to the VNC viewer via localhost:590x, and do a live migration, you won't be able to connect to the VNC viewer again when it dies. This is a known bug.