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
開発生産性向上! 育成を「改善」と捉えるエンジニア育成戦略
shoota
1
230
Storage Browser for Amazon S3
miu_crescent
1
130
OpenShift Virtualizationのネットワーク構成を真剣に考えてみた/OpenShift Virtualization's Network Configuration
tnk4on
0
130
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
【re:Invent 2024 アプデ】 Prompt Routing の紹介
champ
0
140
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
1
110
AWS re:Invent 2024 ふりかえり
kongmingstrap
0
130
アップデート紹介:AWS Data Transfer Terminal
stknohg
PRO
0
170
私なりのAIのご紹介 [2024年版]
qt_luigi
1
120
宇宙ベンチャーにおける最近の情シス取り組みについて
axelmizu
0
110
新機能VPCリソースエンドポイント機能検証から得られた考察
duelist2020jp
0
210
日本版とグローバル版のモバイルアプリ統合の開発の裏側と今後の展望
miichan
1
120
Featured
See All Featured
Six Lessons from altMBA
skipperchong
27
3.5k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
A better future with KSS
kneath
238
17k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Side Projects
sachag
452
42k
Automating Front-end Workflow
addyosmani
1366
200k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
247
1.3M
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
A Modern Web Designer's Workflow
chriscoyier
693
190k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Into the Great Unknown - MozCon
thekraken
33
1.5k
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ΛͬͯҰ෦ͷӡ༻Λָͯ͠·͢
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠