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
150
誰のためのプロダクト?
sonod
8
3.6k
プロダクトのビルドトラップ
sonod
0
160
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
Taming you application's environments
salaboy
0
180
【令和最新版】AWS Direct Connectと愉快なGWたちのおさらい
minorun365
PRO
5
750
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
8
870
Terraform未経験の御様に対してどの ように導⼊を進めていったか
tkikuchi
2
430
20241120_JAWS_東京_ランチタイムLT#17_AWS認定全冠の先へ
tsumita
2
250
Adopting Jetpack Compose in Your Existing Project - GDG DevFest Bangkok 2024
akexorcist
0
110
10XにおけるData Contractの導入について: Data Contract事例共有会
10xinc
6
620
ExaDB-D dbaascli で出来ること
oracle4engineer
PRO
0
3.8k
Can We Measure Developer Productivity?
ewolff
1
150
透過型SMTPプロキシによる送信メールの可観測性向上: Update Edition / Improved observability of outgoing emails with transparent smtp proxy: Update edition
linyows
2
210
OCI Vault 概要
oracle4engineer
PRO
0
9.7k
[CV勉強会@関東 ECCV2024 読み会] オンラインマッピング x トラッキング MapTracker: Tracking with Strided Memory Fusion for Consistent Vector HD Mapping (Chen+, ECCV24)
abemii
0
220
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Navigating Team Friction
lara
183
14k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Facilitating Awesome Meetings
lara
50
6.1k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
860
How to Ace a Technical Interview
jacobian
276
23k
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ΛͬͯҰ෦ͷӡ༻Λָͯ͠·͢
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠