Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
on-premises-cloud-and-docker
Search
Yuuki Tsubouchi (yuuk1)
December 02, 2014
Technology
4
940
on-premises-cloud-and-docker
Hatena Engineer Seminar #3 @ Tokyo
Yuuki Tsubouchi (yuuk1)
December 02, 2014
Tweet
Share
More Decks by Yuuki Tsubouchi (yuuk1)
See All by Yuuki Tsubouchi (yuuk1)
クラウドのテレメトリーシステム研究動向2025年
yuukit
3
820
博士論文公聴会: Scaling Telemetry Workloads in Cloud Applications: Techniques for Instrumentation, Storage, and Mining / PhD Defence
yuukit
1
120
博士学位論文予備審査 / Scaling Telemetry Workloads in Cloud Applications: Techniques for Instrumentation, Storage, and Mining
yuukit
1
1.8k
MetricSifter:クラウドアプリケーションにおける故障箇所特定の効率化のための多変量時系列データの特徴量削減 / FIT 2024
yuukit
2
230
工学としてのSRE再訪 / Revisiting SRE as Engineering
yuukit
19
13k
Cloudless Computingの論文紹介
yuukit
2
510
#SRE論文紹介 Detection is Better Than Cure: A Cloud Incidents Perspective V. Ganatra et. al., ESEC/FSE’23
yuukit
3
1.9k
エンジニアのためのSRE論文への招待 / Introduction to SRE Papers for Engineers
yuukit
2
11k
博士課程での研究まとめ 2023年1月版 / Summary of my research in the PhD course
yuukit
1
300
Other Decks in Technology
See All in Technology
はてなの開発20年史と DevOpsの歩み / DevOpsDays Tokyo 2025 Keynote
daiksy
6
1.5k
Amebaにおける Platform Engineeringの実践
kumorn5s
6
920
いつも初心者向けの記事に助けられているので得意分野では初心者向けの記事を書きます
toru_kubota
2
280
Would you THINK such a demonstration interesting ?
shumpei3
1
180
【日本Zabbixユーザー会】LLDを理解するときの勘所 〜LLDのある世界を楽しもう!〜
yoshitake945
0
130
SREの視点で考えるSIEM活用術 〜AWS環境でのセキュリティ強化〜
coconala_engineer
1
270
20250413_湘南kaggler会_音声認識で使うのってメルス・・・なんだっけ?
sugupoko
1
440
AWS全冠芸人が見た世界 ~資格取得より大切なこと~
masakiokuda
4
4.7k
SDカードフォレンジック
su3158
1
550
AWS Control Towerを 数年運用してきての気づきとこれから/aws-controltower-ops-tips
tadayukinakamura
0
110
改めて学ぶ Trait の使い方 / phpcon odawara 2025
meihei3
1
610
LLM as プロダクト開発のパワードスーツ
layerx
PRO
1
220
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
328
21k
Adopting Sorbet at Scale
ufuk
76
9.3k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
13
660
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
119
51k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.7k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.4k
Fontdeck: Realign not Redesign
paulrobertlloyd
83
5.5k
Code Reviewing Like a Champion
maltzj
522
39k
The Cult of Friendly URLs
andyhume
78
6.3k
Designing for humans not robots
tammielis
252
25k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Site-Speed That Sticks
csswizardry
5
480
Transcript
ΦϯϓϨϛεɺΫϥυ ͦͯ͠%PDLFS Hatena Engineer Seminar #3 id:y_uuki
@y_uuk1 id:y_uuki ӡ༻
Agenda ͯͳͷΠϯϑϥࣄ Docker ΛͲͷΑ͏ʹଊ͍͑ͯΔ͔ ͯͳͷWebΦϖϨʔγϣϯΤϯδχΞ
ͯͳͷ Πϯϑϥࣄ
%BUB$FOUFS "84 ࣗ࡞ αʔό 9FO ϕϯμ αʔό &$ 4 $MPVE'SPOU
3PVUF -74LFFQBMJWFE (MBJDJFS 71$ &-# )"1SPYZ .PHJMF'4 "LBNBJ
DC ͱ AWS • DCͰ Xen ͬͯͨΓ͢Δͱ AWS ͷ෦ΛͳΜͱͳ͘༧ Ͱ͖ͨΓ͢Δ
• ͳΜ͔ϩʔυόϥϯαͷεϧʔϓοτͰͳ͍ → ϋΠύʔ όΠβଆͰ nf_conntrack ᷓΕٙ • ΠϯελϯελΠϓ͝ͱʹ state ͷ্ݶҧ͏ٙ • Domain 0ಉډΠϯελϯε • ΞΫςΟϒɾελϯόΠ2ͱಉډͰ೦ • Ϧιʔεͷ৯͍߹͍ (CPU %steal)
%FW 0QT $IFG $BQJTUSBOP /BHJPT .BDLFSFM .JEMMFXBSF "QQMJDBUJPO +FOLJOT 04
Dev ͱ Ops • αʔόͬΆ͍͜ͱʢσϓϩΠΑΓԼʣ͍͍ͩͨ Ops • Ξϥʔτ Dev ड͚ͱΔ
• Dev ͱ Ops ͕ڠྗͯ͠োରԠ • DevνʔϜͷmeetingʹఆظతʹࢀՃ • Ops GHE ͷ issue ΈΔ (ઃఆม͑Δͱ͖PR) • ༵ۚϦϦʔε͠ͳ͍ • ஈ֊తͳϦϦʔε
՝
DCڥͱAWSڥͷڞ௨Խ • αʔόߏཧ Chef ✓ • ωοτϫʔΫ(VPC + VPN) ✓
• αʔόཧ/ϞχλϦϯάπʔϧ (Mackerel) ✓ • ࢹ(Nagios) ✓ • ϑΣΠϧΦʔό ✘ • Chef ద༻લͷOSΠϝʔδ(Packer) ✘
AWSͷݻ༗ͷػೳ͕͍ͮΒ͍ AWSϩοΫΠϯ AWSαʔϏεʹґଘͨ͠ΈΛ࡞ΔͱDC ଆʹྲྀ༻ͮ͠Β͍
Dev ͱ Ops ͷίϛϡχέʔγϣϯ • Dev ͔Β Ops ʹϗετߏஙΛґཔ •
ຊ൪ʹ Redis ͕ͳͯ͘ࣄނ • Dev ͔Β Ops ʹ Jenkins ϗετʹඞཁͳύοέʔ δΛΠϯετʔϧґཔ • ޓ͍ʹ໘ • ΄͍͠ਓͱ༻ҙ͢Δਓ͕ҟͳΔͷ͕ • ͦͦ Dev ͕ϗετߏங͍͢͠ڥ͕Α͍
Docker
It is Not Docker • VMͱ͔ੜLXC Έ͍ͨʹϩάΠϯͯ͠ੜ׆͢Δ ͷͰͳ͍ • Linuxίϯςφ
≠ Docker • Docker ಛผɺେنڥ͚ͱ͍͏Θ͚Ͱ ͳ͍
It is Docker • Linux ͷϢʔβϥϯυڥΛؙ͝ͱΠϝʔδԽ • ΞϓϦέʔγϣϯ͝ͱʹίϯςφԽ • ls
ίϚϯυ͚ͩͷ Docker ίϯςφͱ͔ • Dockerίϯςφͷ࣮ମͨͩͷOSͷϓϩηε • Χʔωϧ෦Ͱִ͞ΕͯΔ
όʔδϣϯͷҧ͏ MySQL Λ3 ಉ͡ϗετͰಈ͔ͤ·͔͢ʁ
user, datadir, port, socket, pidfile, install_dir, my.cnf ! ͳͲͷϦιʔεΛ3ͭͣͭ࡞Δ UNIX
ʹ౷తʹϦιʔε ػೳ͕ͳ͍
$ docker run -d mysql:5.5 $ docker run -d mysql:5.6
$ docker run -d mysql:5.7 It is Docker
Chef ͱ͔ͬͯOSͷϢʔβϥϯυ γεςϜ͕ෳࡶ͗ͯ͢ཧͰ͖ͳ͍ ! ·ͱʹཧ͢ΔͷΛ͖͋ΒΊͯ ΞϓϦέʔγϣϯ͝ͱʹ ϢʔβϥϯυΛ༻ҙ͍͢͠ΈΛ ఏڙͨ͠ͷ͕ Docker
DockerͰͳʹ͕Ͱ͖Δ͔ • DC ڥ ͱ Ϋϥυڥͷڞ௨Խ • DCͱΫϥυͰಉ͡ Docker image
͕ಈ͘ • αʔϏεͷਰʹซͤͯɺDC <=> Ϋϥυ • Dev ͱ Ops ͷίϛϡχέʔγϣϯ • Dev ΤϯδχΞ͕ඞཁͳΞϓϦέʔγϣϯͷ Dockerfile Λॻ͍ͯɺOps ΤϯδχΞ͕ϨϏϡʔͯ͠ ͦͷ··σϓϩΠ • ΄͍͠ਓ͕४උ͍͢͠
ͦΕDockerͰͰ͖ΔΑ
Docker͕ؔΘΔྖҬଟ͍ • ΞϓϦέʔγϣϯσϓϩΠ • ϩʔΧϧڥ͔Β CI Λܦ༝ͯ͠ຊ൪·Ͱ • ߏཧπʔϧʢChef, Puppet…)
• Docker ࣌ͷαʔόϞχλϦϯά • Docker ࣌ͷϩάऩू • LinuxΧʔωϧ • LinuxίϯςφɺAUFS ͳͲ
ΞϓϦέʔγϣϯσϓϩΠ • શͯͷڥͰಉ͡ Docker image ΛΘͳ͍ͱ ϝϦοτ͕ബ͍ • ϩʔΧϧڥɺ։ൃڥɺstagingڥɺCI ڥɺຊ൪ڥ
• ෦తʹಋೖ͢Δͱ Docker ڥͱ௨ৗͷ ڥΛ྆ํϝϯς͠ͳ͍ͱ͍͚ͳ͘ͳΔ • ։ൃνʔϜͷΤϯδχΞશһ+σβΠφʔ DockerڥͰ։ൃ͢Δ͜ͱʹͳΔ
@ Hatena
߹॓ͰσϓϩΠཧπʔϧ࣮ ࣮ࡍʹෳࡶ࣮͗ͯ͢༻͔ͬͨ͠ *NNVUBCMF*OGSBTUSVDUVSFʹඞཁͳཁૉ٧·ͬͯͨ
SQN EFCύοέʔδΛ࡞ΔڥΛ࡞Δͷ͕໘ͩͬͨ
DBUVTSCJOSSEUPPM CJOTI FYFDEPDLFSSVOSNNBDLFSFMSSEUPPM! RRDtool ☓ Docker Πϯετʔϧ͕໘ͳίϚϯυΛ%PDLFSԽ $POUBJOFS$PNNBOE1BUUFSO
Graphite ☓ Docker • Graphite ͷΑ͏ͳڥߏங͕໘ͳͷ Docker ͰϩʔΧϧڥͱCIڥΛߏங • https://registry.hub.docker.com/u/mackerel/graphite/
EPDLFSSVOEOBNFHSBQIJUFWUNQMPHWBSMPHHSBQIJUFW UNQXIJTQFSWBSMJCHSBQIJUFTUPSBHFXIJTQFSQQ QNBDLFSFMHSBQIJUF
Docker ΞΠσΞ • ϒϥϯν͝ͱʹαʔϏεηοτΛ࡞ΔΈ • ϚΠΫϩαʔϏεͷ֤ίϯϙʔωϯτΛDockerԽ • ڥߏங͕؆୯ʹͳΔ • ςετͰଞαʔϏεΛୟ͘ͱ͖ʹϞοΫԽ͍ͯ͠
ͨͱ͜ΖΛຊΛ͚ͨͨͨΓ͢Δ • Docker cron • cron ͕ಈ͔ͳ͍ • खݩͰ࣮ߦ͍͢͠Α͏ʹ
Docker ࣗମΛ ࣗલͰӡ༻͢Δ or ͠ͳ͍
Docker ͷӡ༻ • Docker ࣗମͷτϥϒϧγϡʔςΟϯά • ಥવDNSҾ͚ͳ͘ͳΔ • ΰϛআ (ཹ͢Δίϯςφ)
• ϚϧνϗετσϓϩΠ • ΦʔέετϨʔγϣϯπʔϧԿΛ͏͔ • Kubernetes, fleet, Consul, … • DNSͰσΟεΧόϦͨ͘͠ͳ͍ • Docker ίϯςφͷωοτϫʔΫߏ • ϗετଆͱϑϥοτ or NAPT • ௐࠪͷํ๏ͷཱ֬ • ssh ͰϩάΠϯͱ͍͏ੈքͰͳ͍ (docker exec /bin/bash)
ΫϥυαʔϏε • AWS EC2 Container Service • Google Container Engine
! • Dockerͷӡ༻Λશ෦ͤΒΕΔ • AWS <-> Google Մ
ઐ༻αʔό • શͯͷαʔϏεΛΫϥυʹͷͤΔͱߴ͍ • ωοτϫʔΫ&ϋʔυΣΞཧΛΦϑϩʔυͭ͠ ্͕ͭ҆Γ • Xen ͰԾԽͤͣʹɺཧϋʔυͷ্ʹίϯςφ •
Docker ͳΒ Ϋϥυ 㱻 ΦϯϓϨϛεͷҠಈ͕ Γ͍͢ • ৽αʔϏεશ෦Ϋϥυ -> ྲྀߦΒͳ͔ͬͨΒ ઐ༻αʔόڥୀආ ͷΑ͏ͳઓུ͕ͱΓ͍͢
ͦΕͰ·ͩෆ҆ • ࠓॻ͍ͨ Dockerfile 1 ޙಈ͔ͳ͍Մೳੑ (DockerfileࣗମͰόʔδϣϯݻఆͱ͔Ͱ͖ΔΘ ͚Ͱͳ͍) •
Docker image Λޙੜେࣄʹ͓࣋ͬͯ͘ඞཁ ͕͋Δ • ࠓ࡞ͬͨ Docker image ͕1ޙͷDocker runtimeͰಈ͔͘Ͳ͏͔
Docker ύϥμΠϜΛม͑Δ
͔ͩΒͦ͜ӡ༻ج൫ͱ։ൃج൫Λ શͯDockerલఏͰߟ͑ͳ͍ͱ Ձ͕Ͱͳ͍
None
ͯͳͷ WebΦϖϨʔγϣϯ ΤϯδχΞ
None
ͬͯΔ͜ͱ͕ҧ͏
y_uuki ͷ߹
ɾΞϧόΠτ࣌: ࣾMackerel։ൃ(Perl) (YAPC Asia) ɾೖࣾ: EC2Ͱ HAProxy νϡʔχϯά http://yuuki.hatenablog.com/entry/2014/03/20/085600 ɾXen,
LVS(keepalived), Chef, Nagios Ұ௨Γ ɾ߹॓: Docker + Mesos σϓϩΠཧπʔϧ࡞Δ http://yuuki.hatenablog.com/entry/2013/12/22/174813 ! ɾ৽αʔϏεͷߏஙӡ༻ʢMackerelʣ ɾJVM, PostgreSQL, Graphite(࣌ܥྻDB) ɾmackerel-agent ύοέʔδఏڙ http://yuuki.hatenablog.com/entry/docker-package-ci ! ɾJVM Operation Casual http://yuuki.hatenablog.com/entry/2014/04/08/074507 ɾGraphiteνϡʔχϯά http://yuuki.hatenablog.com/entry/monitoringcasual6 ɾMackerel OSS ·ΘΓϝϯςφϯε ɾISUCON4 ຊઓग़ http://yuuki.hatenablog.com/entry/dockerized-isucon ɾMackerel CLI tool github.com/y-uuki/gomkr ɾ߹॓: GoͰδϣϒΩϡʔγεςϜ
WebΞϓϦέʔγϣϯ։ൃ ϋʔυΣΞௐୡͱ͔ωοτϫʔΫઃܭ ্ Լ OSΧʔωϧ ϛυϧΣΞ: MySQL, PostgreSQL, Redis, memcached,
Nginx, Apache, Elasticsearch, Solr, Varnish, Squid Jenkins(CI) Capistrano(σϓϩΠ) Nagios Chef
ࣗͷϨΠϠʔ: N N → N - 1 N + 1
→ N ! ͕Ͱ͖Δڥ
ઍਓ
ઍਓ ʜ ৽αʔϏε ৽αʔϏε ৽αʔϏε
5ਓʂʁ
CRITICAL
We are Hiring! IUUQIBUFOBDPSQKQSFDSVJUDBSFFSPQFSBUJPOFOHJOFFS