Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CRIUをホスティングで試していく #hostingcasual / My CRIU Life...

CRIUをホスティングで試していく #hostingcasual / My CRIU Life in Progress

@ホスティングカジュアル #5
直近のイベント宣伝等を抜いています。

KONDO Uchio

March 22, 2019
Tweet

More Decks by KONDO Uchio

Other Decks in Technology

Transcript

  1. Memory dump Network conf File descriptors cgroup params ...... CRIU

    Target
 process Syscalls, /proc files ... Kernel $3*6ͰΠϝʔδΛ࡞੒ɺ͔ͦ͜Βىಈ ˞ࢀߟ
  2. ϦετΞ͞ΕͨϓϩηεΛɺ )BDPOJXBͷԼʹ໭͍ͨ͠ɻ Haconiwa sv-sv \- criu restore \- Container Haconiwa

    sv-sv \- Haconiwa sv \- Container ௨ৗىಈ CRIUܦ༝ͷىಈ ϑοΫॲཧ͸ ओʹ͜͜Ͱߦ͏ ʁʁʁ
  3. ํ๏  TXSLNPEF SFTUPSFTJCMJOH shd: vagrant@pts/0 \_ -bash \_ sudo

    ../mruby/bin/mruby example/restore_child.rb \_ ../mruby/bin/mruby example/restore_child.rb <- libcriuΛݺͼग़ͨ͠mruby script \_ /usr/local/apache2/bin/httpd -DFOREGROUND -X <- ͜Ε͕ίϯςφϓϩηε \_ /usr/local/sbin/criu swrk 6 <- ͜Ε͕swrkϞʔυͰ্ཱ͕ͪͬͨαʔϏεͰɺ cr_restore_tasks() ͸͜͜ͰಡΜͰ͍Δ \_ sh -c ps auxf <- ֬ೝͷͨΊʹ system() ͨ͠΋ͷ \_ ps auxf
  4. DMPOF $-0/&@1"3&/5 $ ./clone-tarou parent --use-clone-parent [!] Hey, maybe a

    new sibling is added 26627 pts/1 S+ 0:00 \_ ./clone-tarou parent --use-clone-parent 26628 pts/1 S+ 0:00 \_ clone-tarou tarou --use-clone-parent 26629 pts/1 S+ 0:00 \_ clone-tarou jirou [!] exit: PID=26628 [!] exit: PID=26629 <DMPOFͷ$-0/&@1"3&/5ϑϥάͷڍಈΛ؍࡯͢Δ><ݕࡧ>
  5. ํ๏  FYFDDNEͬͪ͜Λ࠾༻ Haconiwa sv \- criu restore \- Container

    Haconiwa sv \- haconiwa _restored \- Container FYFD XBJU wDSJVίϚϯυͰϦετΞ͔ͯ͠Βɺ೚ҙͷϓϩάϥϜʹFYFDWF Ͱ͖Δ wFYFDલʹGPSLͨ͠ϓϩηεΛɺ৽͍͠ϓϩάϥϜଆͰXBJU Ͱ͖Δ
  6. &YUFSOBMCJOENPVOUରԠ /path/to/pivot_root `- / (bind-mount self) `- /etc -> /other/etc

    `- /home/foo -> /other2/home `- /var/log -> /other3/log wSPPUGTͷ֎ଆʹ͋ΔϑΝΠϧγεςϜSPPUΛCJOENPVOUͯ͠ɺ
 DISPPUQJWPU@SPPU  ͔ͯ͠Β΋࢖͑ΔΑ͏ʹ͢Δ͜ͱ͕Α͋͘Δ™ wͦ͏͍͏֎ଆͷϑΝΠϧγεςϜΛ$3*6͕ཧղͰ͖ΔΑ͏ʹ͢Δ ͜͜ʹpivot_root
  7. Web Proxy Web Request Dispatcher FastContainer Runtime CMDB ❌ FastContainer

    Killed 1. Check 2. Boot 3. Forward 4. Terminate 'BTU3FNPUF$IFDLͱ͍͏ NHFNΛར༻ͯ͠଴͍ͬͯΔ͕ɺ ઃఆ͕มʁ