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
マネージドクラウドとCの世界
Search
sonod
May 23, 2018
Technology
3
660
マネージドクラウドとCの世界
HashiCorp社のConsulとマネージドクラウドのお話
sonod
May 23, 2018
Tweet
Share
More Decks by sonod
See All by sonod
プロダクト開発を通して学んだナレッジマネジメントの哲学
sonod
0
160
誰のためのプロダクト?
sonod
8
3.7k
プロダクトのビルドトラップ
sonod
0
170
Overlay&Underlay Network 僕の思い出
sonod
1
420
OpenStackの攻略本
sonod
1
200
OpenStackの攻略本 第2号
sonod
0
170
物理サーバ構築のここんとこ-MAASのはなしをしまーず-
sonod
5
6.1k
Other Decks in Technology
See All in Technology
Amazon SageMaker Unified Studio(Preview)、Lakehouse と Amazon S3 Tables
ishikawa_satoru
0
150
KubeCon NA 2024 Recap / Running WebAssembly (Wasm) Workloads Side-by-Side with Container Workloads
z63d
1
240
NW-JAWS #14 re:Invent 2024(予選落ち含)で 発表された推しアップデートについて
nagisa53
0
260
20241214_WACATE2024冬_テスト設計技法をチョット俯瞰してみよう
kzsuzuki
3
440
あの日俺達が夢見たサーバレスアーキテクチャ/the-serverless-architecture-we-dreamed-of
tomoki10
0
440
kargoの魅力について伝える
magisystem0408
0
200
成果を出しながら成長する、アウトプット駆動のキャッチアップ術 / Output-driven catch-up techniques to grow while producing results
aiandrox
0
270
Amazon VPC Lattice 最新アップデート紹介 - PrivateLink も似たようなアップデートあったけど違いとは
bigmuramura
0
190
re:Invent 2024 Innovation Talks(NET201)で語られた大切なこと
shotashiratori
0
310
非機能品質を作り込むための実践アーキテクチャ
knih
3
1.1k
コンテナセキュリティのためのLandlock入門
nullpo_head
2
320
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
100
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Designing for humans not robots
tammielis
250
25k
Bash Introduction
62gerente
608
210k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Building Applications with DynamoDB
mza
91
6.1k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
What's in a price? How to price your products and services
michaelherold
243
12k
Optimising Largest Contentful Paint
csswizardry
33
3k
A Tale of Four Properties
chriscoyier
157
23k
A designer walks into a library…
pauljervisheath
204
24k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Navigating Team Friction
lara
183
15k
Transcript
ాफҰ(.01&1"#0JOD ϩϦϙοϓʂϚωʔδυΫϥυ::NFFUJOH ϚωʔδυΫϥυͱ$ͷੈք
ΠϯϑϥΤϯδχΞ ాफҰ !OETPFB ϗεςΟϯάࣄۀ෦ϚωʔδυΫϥυνʔϜ
$ͷੈքͱ
ੜࢮʹؔͳ͘ɺ ਓͷ৺ͱهԱ͕ू·Δੈքʢू߹ແҙࣝʣ XJLJQFEJBҾ༻ IUUQTKBXJLJQFEJBPSHXJLJ&#&#$&&"&&"&#@&'%&&"&&"#&"#&#$&#&"&"&&"&#&"&"
ੜࢮʹؔͳ͘ɺ ਓͷ৺ͱهԱ͕ू·Δੈքʢू߹ແҙࣝʣ XJLJQFEJBҾ༻ ίʔυΪΞεٯͷϧϧʔγϡ IUUQTKBXJLJQFEJBPSHXJLJ&#&#$&&"&&"&#@&'%&&"&&"#&"#&#$&#&"&"&&"&#&"&"
ϚωʔδυΫϥυͷ$ͱ
օ͞Μ͜ͷϩΰݟͨ͜ͱ͋Γ·͔͢ʁ
ͦ͏Ͱ͢Ͷ
8IBUJT$POTVM w)BTIJ$PSQ͕ࣾఏڙ͍ͯ͠ΔΫϥελͷཧπʔϧͰ͢ wެࣜϖʔδͪ͜ΒIUUQTXXXDPOTVMJP w(JU)VCͪ͜ΒIUUQTHJUIVCDPNIBTIJDPSQDPOTVM w։ൃݴޠɺ(Pݴޠ
8IBUJT$POTVM w)BTIJ$PSQ͕ࣾఏڙ͍ͯ͠ΔΫϥελͷཧπʔϧͰ͢ʁʁ wެࣜϖʔδͪ͜ΒIUUQTXXXDPOTVMJP w(JU)VCͪ͜ΒIUUQTHJUIVCDPNIBTIJDPSQDPOTVM w։ൃݴޠɺ(Pݴޠ
8IBUJT$POTVM $POTVMIBTNVMUJQMFDPNQPOFOUT CVUBTBXIPMF JUJTBUPPMGPSEJTDPWFSJOHBOEDPOpHVSJOHTFSWJDFTJO ZPVSJOGSBTUSVDUVSF Β͍͠ʂʂ $POTVMʹෳͷίϯϙʔωϯτ͕͋Γ·͕͢ɺ શମͱͯ͠ɺΠϯϑϥετϥΫνϟͷαʔϏεΛൃݟͯ͠ ߏ͢ΔͨΊͷπʔϧͰ͢ɻ
ެࣜతʹ
8IBUJT$POTVM ΠϯϑϥετϥΫνϟͷαʔϏεΛൃݟͯ͠ ߏ͢ΔͨΊͷπʔϧͱʁʁ
8IBUJT$POTVM $POTVMɺҎԼͷͭͷॏཁͳػೳ͕Έ߹Θ͞Δ͜ͱʹΑΓɺ ࣗಈͰΠϯϑϥͷαʔϏεΛൃݟ͠ઃఆߏΛ͍ͯ͠·͢ɻ 4FSWJDF %JTDPWFSZ )FBMUI $IFDLJOH ,74UPSF .VMUJ %BUBDFOUFS
8IBUJT$POTVM $POTVMɺҎԼͷͭͷॏཁͳػೳ͕Έ߹Θ͞Δ͜ͱʹΑΓɺ ࣗಈͰΠϯϑϥͷαʔϏεΛൃݟ͠ઃఆߏΛ͍ͯ͠·͢ɻ 4FSWJDF %JTDPWFSZ )FBMUI $IFDLJOH ,74UPSF .VMUJ %BUBDFOUFS
8IBUJT$POTVM 4FSWJDF %JTDPWFSZ $POTVMΫϥΠΞϯτͰʮBQJʯʮNZTRMʯͳͲͷαʔϏεΛఆٛ͢Δͱɺ ଞͷΫϥΠΞϯτ$POTVMͰಛఆͷαʔϏεΛൃݟʢ%JTDPWFSZʣ͢Δ͜ͱ͕ग़དྷΔ ·ͨɺ%/4·ͨ)551Λར༻͢Δ͜ͱͰɺ ΞϓϦέʔγϣϯґଘ͍ͯ͠ΔαʔϏεͷใΛ؆୯ʹݟ͚ͭΔ͜ͱ͕ग़དྷΔ ܰ͘۷ΓԼ͛Δͱ
{ "service": { { “name”: “keepalived”, “tags”: [“keepalived”], “checks”: [
{ "script”: "/usr/lib/nagios/plugins/check_procs -c 1: -a keepalived”, “interval”: "30s” } ] } } 8IBUJT$POTVM ˝LFFQBMJWFEKTPO ͜Μͳײ͡Ͱɺ+40/Ͱ$POTVMʹαʔϏεΛఆٛ͢Δͱ
# consul catalog services keepalived # dig keepalived.service.consul ;; ANSWER
SECTION: keepalived.service.consul. 0 IN A 172.16.1.1 # curl http://127.0.0.1:8500/v1/catalog/services | jq. { "weblb-keepalived": [ "weblb-keepalived" ] } 8IBUJT$POTVM $POTVMΫϥΠΞϯτ%/4)551͔Β؆୯ʹಛఆͷαʔϏεΛݟ͚ͭΕΔΑ͏ʹͳΓ·͢
{ "service": { { “name”: “keepalived”, “tags”: [“keepalived”], “checks”: [
{ "script”: "/usr/lib/nagios/plugins/check_procs -c 1: -a keepalived”, “interval”: "30s” } ] } } 8IBUJT$POTVM ˝LFFQBMJWFEKTPO ͜Μͳײ͡Ͱɺ+40/Ͱ$POTVMʹαʔϏεΛఆٛ͢Δͱ ͪͳΈʹ͜ͷϑΝΠϧͰ͕͢
# consul agent -data-dir=/etc/consul # cat /etc/consul/keepalived.json { "service": {
{ “name”: “keepalived”, “tags”: [“keepalived”], “checks”: [ { "script”: "/usr/lib/nagios/plugins/check_procs -c 1: -a keepalived”, “interval”: "30s” } ] } } 8IBUJT$POTVM $POTVMBHFOUΛىಈ͢Δࡍʹࢦఆͨ͠σΟϨΫτϦʹஔ͠·͢ ͜ͷσΟϨΫτϦʹஔ
8IBUJT$POTVM $POTVMɺҎԼͷͭͷॏཁͳػೳ͕Έ߹Θ͞Δ͜ͱʹΑΓɺ ࣗಈͰΠϯϑϥͷαʔϏεΛൃݟ͠ઃఆߏΛ͍ͯ͠·͢ɻ 4FSWJDF %JTDPWFSZ )FBMUI $IFDLJOH ,74UPSF .VMUJ %BUBDFOUFS
8IBUJT$POTVM $POTVMɺҎԼͷͭͷॏཁͳػೳ͕Έ߹Θ͞Δ͜ͱʹΑΓɺ ࣗಈͰΠϯϑϥͷαʔϏεΛൃݟ͠ઃఆߏΛ͍ͯ͠·͢ɻ 4FSWJDF %JTDPWFSZ )FBMUI $IFDLJOH ,74UPSF .VMUJ %BUBDFOUFS
8IBUJT$POTVM 4FSWJDF %JTDPWFSZ ಛఆͷαʔϏε·ͨϊʔυͷϔϧενΣοΫΛ͢Δ͜ͱ͕ग़དྷΔ αʔϏεͷϔϧενΣοΫʹɺεΫϦϓτ/BHJPTϓϥάΠϯΛ༻Ͱ͖Δ )FBMUI $IFDLJOH ܰ͘۷ΓԼ͛Δͱ
{ "service": { { “name”: “keepalived”, “tags”: [“keepalived”], “checks”: [
{ "script”: "/usr/lib/nagios/plugins/check_procs -c 1: -a keepalived”, “interval”: "30s” } ] } } 8IBUJT$POTVM ˝LFFQBMJWFEKTPO ઌఔɺʮ4FSWJDF%JTDPWFSZʯͰͬͨ+40/ͷઢͰׅހͬͨ෦ͷΑ͏ʹॻ͘͜ͱͰ༻Ͱ͖·͢ ͜Ε/BHJPTϓϥάΠϯΛ༻͍ͯ͠ΔύλʔϯʹͳΓ·͢ɻ
8IBUJT$POTVM $POTVMɺҎԼͷͭͷॏཁͳػೳ͕Έ߹Θ͞Δ͜ͱʹΑΓɺ ࣗಈͰΠϯϑϥͷαʔϏεΛൃݟ͠ઃఆߏΛ͍ͯ͠·͢ɻ 4FSWJDF %JTDPWFSZ )FBMUI $IFDLJOH ,74UPSF .VMUJ %BUBDFOUFS
8IBUJT$POTVM $POTVMɺҎԼͷͭͷॏཁͳػೳ͕Έ߹Θ͞Δ͜ͱʹΑΓɺ ࣗಈͰΠϯϑϥͷαʔϏεΛൃݟ͠ઃఆߏΛ͍ͯ͠·͢ɻ 4FSWJDF %JTDPWFSZ )FBMUI $IFDLJOH ,74UPSF .VMUJ %BUBDFOUFS
8IBUJT$POTVM 4FSWJDF %JTDPWFSZ $POTVMͷ෦σʔλΛอ͢Δ֊ΩʔόϦϡʔετΞͰɺ ΫϥελͷͲͷϊʔυ͔ΒΞΫηεग़དྷΔΑ͏ʹͳ͍ͬͯΔ ΞϓϦέʔγϣϯʹΑΔಈతઃఆมߋ$POTVMͷϦʔμʔબग़ʹ༻Ͱ͖Δ $POTVMαʔόͱσʔληϯλʔͷใ͍࣋ͬͯΔ ·ͨɺ)551"1*Λ༻͢Δ͜ͱͰ؆୯ʹΞΫηεग़དྷΔ ,74UPSF
8IBUJT$POTVM ҙͱͯ͠ɺWBMVFͷ্ݶ͕,#ͱ͍͏ ͜ͱ͚͓͍֮ͩ͑ͯͯ͑Εͱࢥ͍·͢ IUUQTXXXDPOTVMJPEPDTGBRIUNMRXIBUJTUIFQFSLFZWBMVFTJ[FMJNJUBUJPOGPSDPOTVMTLFZWBMVFTUPSF
8IBUJT$POTVM $POTVMɺҎԼͷͭͷॏཁͳػೳ͕Έ߹Θ͞Δ͜ͱʹΑΓɺ ࣗಈͰΠϯϑϥͷαʔϏεΛൃݟ͠ઃఆߏΛ͍ͯ͠·͢ɻ 4FSWJDF %JTDPWFSZ )FBMUI $IFDLJOH ,74UPSF .VMUJ %BUBDFOUFS
8IBUJT$POTVM $POTVMɺҎԼͷͭͷॏཁͳػೳ͕Έ߹Θ͞Δ͜ͱʹΑΓɺ ࣗಈͰΠϯϑϥͷαʔϏεΛൃݟ͠ઃఆߏΛ͍ͯ͠·͢ɻ 4FSWJDF %JTDPWFSZ )FBMUI $IFDLJOH ,74UPSF .VMUJ %BUBDFOUFS
8IBUJT$POTVM 4FSWJDF %JTDPWFSZ ΫϥελʔΛ%BUBDFOUFSͱ͍͏୯ҐͰཧ͓ͯ͠Γɺ ͦͷ%BUBDFOUFSͱҟͳΔ%BUBDFOUFSؒͷ࿈ܞΛαϙʔτ͍ͯ͠·͢ ͦΕͦ͜ཧతͳ%BUBDFOUFSؒΛͭͳ͛ΔΠϝʔδͰ͢ $POTVMతʹɺ ʮ$POTVMͷϢʔβʔ͕ෳͷҬʹ͢ΔͨΊʹ நϨΠϠʔΛՃ͢Δ͜ͱΛ৺͢Δඞཁ͕ͳ͍͜ͱΛҙຯ͠·͢ɻʯ ͱͷ͜ͱͰ͢ɻ
.VMUJ %BUBDFOUFS
8IBUJT$POTVM ͜ͷΑ͏ͳҎԼͷͭͷॏཁͳػೳ͕Έ߹Θ͞Δ͜ͱʹΑΓɺ ࣗಈͰΠϯϑϥͷαʔϏεΛൃݟ͠ઃఆߏΛ͍ͯ͠·͢ͷͰɺ $POTVMɺΠϯϑϥετϥΫνϟͷαʔϏεΛൃݟͯ͠ߏ͢ΔͨΊͷπʔϧ 4FSWJDF %JTDPWFSZ )FBMUI $IFDLJOH ,74UPSF .VMUJ
%BUBDFOUFS
$POTVMͷ"SDIJUFDUVSF
#BTJD"SDIJUFDUVSFPG$POTVM $POTVMʹେ͖͚ͯ̎ͭ͘ͷϞʔυ͕ଘࡏ͠·͢ ʮ4FSWFSʯͱʮ$MJFOUʯͰ͢ ֤ϊʔυɺ$POTVM"HFOUΛىಈ͢Δࡍʹɺ ͜ͷͲͪΒ͔ͷϞʔυΛࢦఆ͠·͢ 4FSWFS $MJFOU
#BTJD"SDIJUFDUVSFPG$POTVM $POTVMͷશͯͷσʔλͷ֨ೲ͠ཧ͢Δׂ $POTVMͷΫϥελΛΉ্ͰඞͣҎ্ඞཁͱͳΓɺ σʔλଛࣦγφϦΦΛආ͚ΔͨΊʹdߏ͕ਪͱ͞Ε͍ͯ·͢ Խʹ͍ͭͯɿ ੑΛอͪͭͭσʔλͷҰ؏ੑΛ୲อ͢ΔͨΊʹɺ ࢄ߹ҙΞϧΰϦζϜͰ͋Δ3BGUϓϩτίϧ͕࠾༻͞Ε͍ͯ·͢ -FBEFS͕બग़͞Εɺଞ'PMMPXFSͱͳΓ·͢ -FBEFSͷΈ͕σʔλΛίϛοτ͠ɺ
'PMMPXFSσʔλΛਵ࣌ϨϓϦέʔγϣϯ͞Ε·͢ 4FSWFS $MJFOU $POTVMαʔόͱ௨৴Λ͠ΫϥελใͷऔಘͱొΛ͢Δׂ $POTVMαʔόͱ௨৴Ͱ͖ͳ͍ͱΫϥελ͔Β֎͞ΕΔ
#BTJD"SDIJUFDUVSFPG$POTVM */5&3/&5 4FSWFS 'PMMPXFS 4FSWFS -FBEFS 4FSWFS 'PMMPXFS $MJFOU $MJFOU
%BUBDFOUFS -"/(044*1 5$16%1 3&1-*$"5*0/ 5$1 3&1-*$"5*0/ 5$1 31$ 5$1 31$ 5$1 -"/(044*1 5$16%1 %BUBDFOUFS -&"%&3 '038"3%*/( 8"/(044*1 5$16%1 3&.05&%$ '038"3%*/( 5$1
#BTJD"SDIJUFDUVSFPG$POTVM (044*1ϓϩτίϧʹ͍ͭͯɿ ͔͜͜Β ϥϯμϜʹબΜͩ૬खͱใΛަ͠ɺ͕ࣗ࣋ͭσʔλͷߋ৽Λ܁Γฦ͢ɻ γεςϜͷࢀՃऀ͕ෆఆظతʹ૿ݮͯ͠શମΛѲͰ͖ͳ͍ঢ়گɺ Ұ࣌తʹ௨৴Ͱ͖ͳ͍߹ͰใΛൖͰ͖Δɻ ͜͜·ͰҾ༻ ΫϥελʔมߋͷӨڹΛड͚ͣʹ௨৴Λߦ͑Δোੑͷߴ͍ใڞ༗ϓϩτίϧΒ͍͠ ʢXJLJQFEJB͔ΒҾ༻ʣ IUUQTKBXJLJQFEJBPSHXJLJΰγοϓϓϩτίϧ
ϚωʔδυΫϥυͱ$POTVM
͔͜͜ΒϚωʔδυΫϥυͰ $POTVMΛ ͍ͬͯΔ෦Λհ͠·͢
$POTVMͷ ͝հͰ͖͍ͯͳ͍ػೳ͕ ·ͩ·ͩ͋ΔͷͰซͤͯ͝հ͠·͢
ϚωʔδυΫϥυͷશମߏ
$POTVMΛ ͍ͬͯΔͷ͕Ͳ͜ͳͷ͔ʂ ϚωʔδυΫϥυͷશମߏ
ϚωʔδυΫϥυͷશମߏ શ෦Ͱ͢Ͷ
ϚωʔδυΫϥυͷશମߏ $POTVM $MJFOU $POTVM $MJFOU $POTVM $MJFOU $POTVM $MJFOU $POTVM
$MJFOU $POTVM $MJFOU $POTVM $MJFOU $POTVM $MJFOU $POTVM $MJFOU $POTVM $MJFOU $POTVM $MJFOU $POTVM $MJFOU $POTVM $MJFOU $POTVM $MJFOU $POTVM $MJFOU $POTVM $MJFOU $POTVM $MJFOU $POTVM 4FSWFS $POTVM 4FSWFS $POTVM 4FSWFS 3&1-*$"5*0/ 5$1 3&1-*$"5*0/ 5$1 31$ 5$1 31$ 5$1 31$ 5$1
ϚωʔδυΫϥυͷશମߏ $POTVM 4FSWFS $POTVM 4FSWFS $POTVM 4FSWFS $POTVM 4FSWFS $POTVM
4FSWFS $POTVM 4FSWFS 4UBHJOH 1SPEVDUJPO ߋʹɺ.VMUJ%BUBDFOUFSߏʹͳ͍ͬͯ·͢ ڑతʹΕͨ%BUBDFOUFSͱ͔Ͱͳ͘ɺোͷӨڹൣғ໊લղܾͷൣғΛͤ͞Δͨ Ίʹ͍ͬͯ·͢ .VMUJ %BUBDFOUFS
ϚωʔδυΫϥυͷશମߏ w ϚωʔδυΫϥυɺશମͰ$POTVMΛ༻͍ͯ͠·͢ w ֤ϊʔυͰ$POTVM͕"HFOUͰىಈ͓ͯ͠ΓαʔϏεొΛߦ͍ͬͯ·͢ w $POTVM4FSWFSͰԽߏʹͳ͍ͬͯ·͢ $POTVM4FSWFS֤%BUBDFOUFSʹඞཁͳͷͰɺ͍ͬͺ͍͋Γ·͢ ͜͜Ͱ$POTVMͷඪ४ػೳͰ͋ΔΜͰ͕͢ɺ Ұ൪͓ੈʹͳ͍ͬͯΔػೳͷ͓Λ
$POTVM%/4
$POTVM%/4 w $POTVMʹɺ%/4ػೳ͕͋Γ·͢ w ϚωʔδυΫϥυͰɺϩʔΧϧͷαʔόͷ໊લղܾΛશͯ$POTVMʹ·͔͍ͤͯ·͢ w σϑΥϧτͰɺOPEFDPOTVMͱ͍͏υϝΠϯ͕͖ͭ·͢ ਖ਼֬ʹɺOPEF\%BUBDFOUFS໊^DPOTVM w αʔϏεΛొ͓͚ͯ͠ɺTFSWJDFDPOTVMͱ͍͏υϝΠϯͰ໊લղܾ͢Δ͜ͱՄೳ
w $POTVM%/4ͷϙʔτͳͷͰɺΞϓϦέʔγϣϯSFTPMW͔Β༻͍ͨ͠߹ ɺEOTNBTRΛ༻͢Δඞཁ͕͋Γ·͢ ϚωʔδυΫϥυͰɺ6OCPVOEΛ༻͍ͯ͠·͢ 4FSWJDF %JTDPWFSZ
$POTVM%/4 $POTVM 4FSWFS $PNQVUF ྫ͑$PNQVUFͱݴΘΕΔϊʔυͰɺ ͜Μͳײ͡Ͱʮ6OCPVOE /4% $POTVMʯͰߏ͍ͯ͠·͢ $POTVM
$MJFOU 6OCPVOE /4% # cat unbound.conf server: interface: 127.0.0.1 do-not-query-localhost: no stub-zone: name: "consul." stub-addr: 172.16.1.1@8600 stub-zone: name: “lolipop.jp.” stub-addr: 172.16.1.1@10053 DPOTVMͩͬͨΒ$POTVM%/4 MPMJQPQKQͩͬͨΒ/4% /BNF4FSWFS%BFNPO ໊લղܾͩ 4FSWJDF %JTDPWFSZ
$POTVM%/4 $POTVMΛىಈ͢Ε)551%/4͕༻ՄೳͱͳΓ·͢ͷͰɺ͜Μͳײ͡Ͱ֬ೝͰ͖·͢ # consul members Node Address Status Type Build
Protocol DC server-1 10.11.1.1:80 alive client 0.9.0 2 dc1 # dig server-1.node.consul ;; ANSWER SECTION: server-1.node.consul. 0 IN A 10.11.1.1 # curl http://127.0.0.1:8500/v1/catalog/nodes|jq .[]
{ "service": { { “name”: “keepalived”, “tags”: [“keepalived”], “checks”: [
{ "script”: "/usr/lib/nagios/plugins/check_procs -c 1: -a keepalived”, “interval”: "30s” } ] } } ˝LFFQBMJWFEKTPO αʔϏεͷ߹ɺ͜Μͳײ͡Ͱ+40/Ͱ$POTVMʹαʔϏεΛఆٛ͢Δͱ $POTVM%/4 4FSWJDF %JTDPWFSZ
# dig keepalived.service.consul ;; ANSWER SECTION: keepalived.service.consul. 0 IN A
172.16.1.1 keepalived.service.consul. 0 IN A 172.16.1.2 ͜Μͳײ͡ͰTFSWJDF୯ҐͰͷ໊લղܾΛ͢Δ͜ͱͰ͖·͢ $POTVM%/4 ͍ͭͮͯ 4FSWJDF %JTDPWFSZ
$POTVM5FNQMBUF
$POTVM5FNQMBUF w (JU)VCͪ͜ΒIUUQTHJUIVCDPNIBTIJDPSQDPOTVMUFNQMBUF w $POTVMͷঢ়ଶมԽΛࢹ͢ΔσʔϞϯ w $POTVMͷ,74ͷใΛ)551ܦ༝Ͱৗʹࢹ͍ͯ͠Δ w $POTVMͷԿ͔͠ΒͷΠϕϯτ ϊʔυͷ૿ݮ
͕ൃੜͨ͠ࡍʹɺςϯϓϨʔτϑΝΠϧΛͱ ʹઃఆϑΝΠϧΛ࠶࡞͠ίϚϯυͷ࣮ߦ σʔϞϯͷ࠶ىಈ Λͯ͘͠ΕΔ ,74UPSF )FBMUI $IFDLJOH 4FSWJDF %JTDPWFSZ
$POTVM5FNQMBUF ͜Μͳ࣌ʹ͍ͬͯΔ$POTVM5FNQMBUF Ұ൪ଟ͍ύλʔϯ͕͜͏͍ͬͨ3FWFSTF1SPYZͷ૿ݮΛࣗಈతʹ࣮ࢪ͢Δͱ͜ΖͰ͢ -PBE #BMBODFS 3FWFSTF 1SPYZ 3FWFSTF 1SPYZ 3FWFSTF
1SPYZ -PBE #BMBODFS 3FWFSTF 1SPYZ 3FWFSTF 1SPYZ 3FWFSTF 1SPYZ ઃఆ͕ࣗಈͰॻ͖ΘΓɺΓ͞ΕΔ ઃఆ͕ࣗಈͰॻ͖ΘΓɺ-PBE#BMBODFSʹՃ͞ΕΔ 3FWFSTF 1SPYZ ˝3FWFSTF1SPYZ͕%PXO ˝ 3FWFSTF1SPYZΛ"%% 3WFSTF1SPYZΛΓͨ͠ઃఆΛ࡞ͯ͠࠶ىಈ 3FWFSTF1SPYZΛՃͨ͠ઃఆΛ࡞ͯ͠࠶ىಈ ,74UPSF )FBMUI $IFDLJOH 4FSWJDF %JTDPWFSZ
͜Μͳײ͡Ͱઃఆͱ5FNQMBUFΛॻ͍ͯஔ͓͚ͯͩ͘͠Ͱউखʹͬͯ͘Ε·͢ʂศརʂ # cat keepavilved.conf.ctmpl virtual_server 172.1.1.1 80 { delay_loop 10
lvs_sched rr lvs_method NAT protocol TCP {{range service "reverseproxy|passing"}} real_server {{.Address}} 80 { weight 1 TCP_CHECK { connect_port 80 connect_timeout 30 } }{{end}} } $POTVM5FNQMBUF ## cat config.hcl consul { address = "127.0.0.1:8500" ssl { enabled = false } } pid_file = "/var/run/consul-template/pid" template { source = "/etc/consul-template/keepalived.conf.ctmpl" destination = “/etc/keepalived/conf.d/reverseproxy.conf" command = "sudo systemctl reload keepalived" } SFWFSTFQSPYZͷαʔϏεΛྻʹͯ͠ ͦΕΛશͯొ͠·͢ ϊʔυͷ*1ΞυϨε ஔͯ͠σʔϞϯΛSFMPBE ˝5FNQMBUF ˝$POTVM5FNQMBUFͷઃఆ ,74UPSF )FBMUI $IFDLJOH 4FSWJDF %JTDPWFSZ
$POTVMBMFSUT
$POTVMBMFSUT w (JU)VCͪ͜ΒIUUQTHJUIVCDPN"DBMFQI4UPSBHFDPOTVMBMFSUT w $POTVMͷαʔϏεϊʔυͷมԽ͕ൃੜͨ͠ࡍʹɺ.BJM4MBDLʹ௨Λͯ͘͠ΕΔ σʔϞϯ w ϚωʔδυΫϥυͰɺ4MBDL௨Λ͓ͯ͠Γ͜Μͳײ͡Ͱ௨ͯ͘͠Ε·͢ ,74UPSF
)FBMUI $IFDLJOH 4FSWJDF %JTDPWFSZ
$POTVMFYQPSUFS
$POTVM͔Βएׯ֎Ε͖ͯͯΔ͕ $POTVMFYQPSUFS
$POTVMFYQPSUFS w (JU)VCͪ͜ΒIUUQTHJUIVCDPNQSPNFUIFVTDPOTVM@FYQPSUFS w $POTVMͷαʔϏεͷঢ়ଶΛ1SPNFUIFVTʹసૹ͢ΔσʔϞϯ w ϚωʔδυΫϥυͷࢹج൫1SPNFUIFVTΛ༻͍ͯ͠·͢ͷͰɺ ϊʔυͷঢ়ଶཧͷͨΊʹ༻͍ͯ͠·͢ 1SPNFUIFVTʹ͍ͭͯɿ
ͬ͘͟Γઆ໌͢Δͱɺ༷ʑͳϝτϦΫεΛ࣌ܥྻͰ͍͍ײ͡ʹूܭɾهͰ͖ΔπʔϧͰ͢ ৄ͘͠ฐࣾVE[VSBͷ͜ͷลΓͷهࣄΛݟͯΒ͑Δͱྑ͍͔ͱࢥ͍·͢ IUUQTVE[VSBIBUFOBCMPHKQFOUSZ IUUQTTQFBLFSEFDLDPNVE[VSBNBOBHFEDMPVEXJUIQSPNFUIFVT ,74UPSF )FBMUI $IFDLJOH 4FSWJDF %JTDPWFSZ
$POTVMFYQPSUFS .FUSJD .FBOJOH DPOTVM@VQ $POTVMͷ࠷ޙͷ2VFSZ͕ޭ͔ͨ͠ DPOTVM@TFSG@MBO@NFNCFST Ϋϥελʔͷϝϯόʔ DPOTVM@DBUBMPH@TFSWJDFT Ϋϥελʔʹؚ·ΕΔαʔϏε DPOTVM@DBUBMPH@TFSWJDF@OPEF@IFBMUIZ
ϊʔυ্ͷαʔϏε͕ਖ਼ৗ͔ DPOTVM@IFBMUI@OPEF@TUBUVT ϊʔυʹؔ࿈͚ΒΕͨϔϧενΣοΫͷεςʔλε DPOTVM@IFBMUI@TFSWJDF@TUBUVT αʔϏεʹؔ࿈͚ΒΕͨϔϧενΣοΫͷεςʔλε શ෦Ͱͳ͍͕औಘͰ͖Δใ͜ͷΑ͏ͳײ͡Ͱɺ 1SPNFUIFVTଆ͔Β͜ͷΑ͏ͳײ͡Ͱ֬ೝ͢Δ͜ͱ͕Ͱ͖·͢
ଞʹ৭ʑ͍ͬͯΔ෦͋ΔΜͰ͕͢ ࠓճ࣌ؒͷ্ؔ͜͜·ͰͰɾɾɾ
·ͱΊ
$POTVMΛ͏ͱ؆୯ʹ ΫϥελʔཧΛ͢Δ͜ͱ͕Ͱ͖ͯɺ ϊʔυͷཧΛָͰ͖Δ 1.
ϩʔΧϧͷ%/4ొͷखؒ 1SPNFUIFVTͰͷϊʔυཧͷखؒͳͲ ͕Ϳ͚Δ 2.
αʔϏε୯ҐͰϔϧενΣοΫͰ͖ΔͷͰ ϊʔυͷ૿ݮରԠোݕΛ ؆୯ʹग़དྷΔ 3.
ͭ·Γ
ϚωʔδυΫϥυ $POTVMΛͬͯҰ෦ͷӡ༻Λָͯ͠·͢
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠