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
900
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)
MetricSifter:クラウドアプリケーションにおける故障箇所特定の効率化のための多変量時系列データの特徴量削減 / FIT 2024
yuukit
2
120
工学としてのSRE再訪 / Revisiting SRE as Engineering
yuukit
19
11k
Cloudless Computingの論文紹介
yuukit
2
420
#SRE論文紹介 Detection is Better Than Cure: A Cloud Incidents Perspective V. Ganatra et. al., ESEC/FSE’23
yuukit
3
1.5k
エンジニアのためのSRE論文への招待 / Introduction to SRE Papers for Engineers
yuukit
2
11k
博士課程での研究まとめ 2023年1月版 / Summary of my research in the PhD course
yuukit
1
250
AI時代に向けたクラウドにおける信頼性エンジニアリングの未来構想 / DICOMO2022 6A-1
yuukit
7
2.9k
AIOps研究録―SREのための システム障害の自動原因診断 / SRE NEXT 2022
yuukit
10
12k
Interactive AIOps
yuukit
0
2.1k
Other Decks in Technology
See All in Technology
B2B SaaS × AI機能開発 〜テナント分離のパターン解説〜 / B2B SaaS x AI function development - Explanation of tenant separation pattern
oztick139
2
170
元旅行会社の情シス部員が教えるおすすめなre:Inventへの行き方 / What is the most efficient way to re:Invent
naospon
2
320
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
150
透過型SMTPプロキシによる送信メールの可観測性向上: Update Edition / Improved observability of outgoing emails with transparent smtp proxy: Update edition
linyows
2
200
メールサーバ管理者のみ知る話
hinono
1
110
社内で最大の技術的負債のリファクタリングに取り組んだお話し
kidooonn
1
510
【Pycon mini 東海 2024】Google Colaboratoryで試すVLM
kazuhitotakahashi
2
320
20241108_CS_LLMMT
shigashiyama
0
270
DMARC 対応の話 - MIXI CTO オフィスアワー #04
bbqallstars
1
150
テストコード品質を高めるためにMutation Testingライブラリ・Strykerを実戦導入してみた話
ysknsid25
6
2.3k
3次元点群データ「VIRTUAL SHIZUOKA』のオープンデータ化による恩恵と協働の未来/FOSS4G Japan 2024
kazz24s
0
140
Platform Engineering for Software Developers and Architects
syntasso
1
460
Featured
See All Featured
KATA
mclloyd
29
14k
Fireside Chat
paigeccino
33
3k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
How to Ace a Technical Interview
jacobian
276
23k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Git: the NoSQL Database
bkeepers
PRO
427
64k
RailsConf 2023
tenderlove
29
900
Done Done
chrislema
181
16k
Thoughts on Productivity
jonyablonski
67
4.3k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Embracing the Ebb and Flow
colly
84
4.5k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
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