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
200万ドメインを超えるレンタルサーバのコンテンツキャッシュ機能の裏側/2_million_m...
Search
Takuma Kume
July 29, 2018
Technology
9
2.8k
200万ドメインを超えるレンタルサーバのコンテンツキャッシュ機能の裏側/2_million_more_than_the_domain_the_back_of_the_rental_server_content_cache
July Tech Festa 2018 (
https://2018.techfesta.jp/
)
Takuma Kume
July 29, 2018
Tweet
Share
More Decks by Takuma Kume
See All by Takuma Kume
ロリポップ! for Gamersを支えるインフラ/lolipop for gamers infrastructure
takumakume
0
420
ロリポップ! for Gamersの立ち上げ/lolipop for gamers launch
takumakume
0
1.8k
ホモグラフドメインを検出してみた/detect homograph domain
takumakume
0
410
ソフトウェアの継続的アップデートをコンテナ化によって加速させる/Accelerate continuous software updates with containerization
takumakume
0
4.6k
KubernetesにおけるSBOMを利用した脆弱性管理/Vulnerability_Management_with_SBOM_in_Kubernetes
takumakume
1
2k
ホスティング事業におけるSREの取り組みとSREの面白さ/SRE Efforts in the Hosting Business and the Interest of SRE
takumakume
1
2.3k
GitOpsで実現するPull Request毎のプレビュー環境/Preview environment for each Pull Request by GitOps
takumakume
0
1.5k
Goでkubernetes operatorを実装してアプリのプレビュー環境を作る/go-kubernetes-operator
takumakume
0
160
クラウドネイティブな開発環境への移行/Move to the cloud native development environment
takumakume
1
570
Other Decks in Technology
See All in Technology
Platform Engineering for Software Developers and Architects
syntasso
1
520
個人でもIAM Identity Centerを使おう!(アクセス管理編)
ryder472
4
230
The Rise of LLMOps
asei
7
1.7k
SRE×AIOpsを始めよう!GuardDutyによるお手軽脅威検出
amixedcolor
0
170
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.5k
生成AIが変えるデータ分析の全体像
ishikawa_satoru
0
170
エンジニア人生の拡張性を高める 「探索型キャリア設計」の提案
tenshoku_draft
1
130
20241120_JAWS_東京_ランチタイムLT#17_AWS認定全冠の先へ
tsumita
2
300
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
3
630
アプリエンジニアのためのGraphQL入門.pdf
spycwolf
0
100
【Startup CTO of the Year 2024 / Audience Award】アセンド取締役CTO 丹羽健
niwatakeru
0
1.3k
開発生産性を上げながらビジネスも30倍成長させてきたチームの姿
kamina_zzz
2
1.7k
Featured
See All Featured
10 Git Anti Patterns You Should be Aware of
lemiorhan
655
59k
Making Projects Easy
brettharned
115
5.9k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Building Adaptive Systems
keathley
38
2.3k
Navigating Team Friction
lara
183
14k
The World Runs on Bad Software
bkeepers
PRO
65
11k
The Invisible Side of Design
smashingmag
298
50k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
YesSQL, Process and Tooling at Scale
rocio
169
14k
4 Signs Your Business is Dying
shpigford
180
21k
Transcript
!UBLVNBLVNF(.01FQBCP *OD +VMZ5FDI'FTUB ສυϝΠϯΛ͑ΔϨϯλϧαʔόͷ ίϯςϯπΩϟογϡػೳͷཪଆ
(.0ϖύϘϗεςΟϯάࣄۀ෦ ΠϯϑϥΤϯδχΞ ٱถഅ!UBLVNBLVNF
None
ֹ݄ԁ͔Βར༻Ͱ͖Δʂ
ֹ݄ԁ͔Βར༻Ͱ͖Δʂ ඵؒສઍϦΫΤετΛॲཧʂ
ֹ݄ԁ͔Βར༻Ͱ͖Δʂ ສαΠτҎ্ӡ༻தʂ ඵؒສઍϦΫΤετΛॲཧʂ
None
ίϯςϯπΩϟογϡػೳ 3FWFSTF1SPYZ 8FSWFS ௨ৗ
ίϯςϯπΩϟογϡػೳ 3FWFSTF1SPYZ 8FSWFS 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS Ωϟογϡ ίϯςϯπΩϟογϡ͋Γ
ίϯςϯπΩϟογϡػೳ 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS Ωϟογϡ ίϯςϯπΩϟογϡ͋Γ 8FSWFSͷલஈͰΩϟογϡͯ͠ ߴʹԠ͢Δɻ
ίϯςϯπΩϟογϡػೳ 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS Ωϟογϡ ίϯςϯπΩϟογϡ͋Γ OHJOY IUUQE ύϑΥʔϚϯεͷߴ͍OHJOYͰϦΫΤετ Λॲཧ͢Δɻ
8FSWFSͷલஈͰΩϟογϡͯ͠ ߴʹԠ͢Δɻ
ίϯςϯπΩϟογϡػೳ 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS Ωϟογϡ ίϯςϯπΩϟογϡ͋Γ OHJOY IUUQE ύϑΥʔϚϯεͷߴ͍OHJOYͰϦΫΤετ Λॲཧ͢Δɻ
1)1ͷॲཧͰߴෛՙʹͳΓ͍͢ 8&#αʔόͷෛՙݮ 8FSWFSͷલஈͰΩϟογϡͯ͠ ߴʹԠ͢Δɻ
ฒྻສϦΫΤετ #FODI.BSLFS "QBDIF#FODI 3FWFSTF1SPYZ 8FSWFS 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS Ωϟογϡ 8PSE1SFTTαΠτ
8PSE1SFTTαΠτ
3FWFSTF1SPYZ 8FSWFS 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS Ωϟογϡ 8PSE1SFTTαΠτ 8PSE1SFTTαΠτ ύϑΥʔϚϯεഒʂ
3FWFSTF1SPYZ 8FSWFS 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS Ωϟογϡ 8PSE1SFTTαΠτ 8PSE1SFTTαΠτ ύϑΥʔϚϯεഒʂ ແྉఏڙ
ͳͥ࡞ͬͨͷ͔ʁ
ࠃ࠷ Ϩϯαό ࠷
ੈͷதʹଟ͘ͷ $%/ࣄۀऀ͕ଘࡏ͢Δ ίϯςϯπΩϟογϡͱ͍͑$%/
ϩϦϙοϓʂͰ֎෦$%/αʔϏε͏ *OUFSOFU 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS $%/ࣄۀऀ%$ ΞΫηε ϩϦϙοϓʂ
*OUFSOFU 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS $%/ࣄۀऀ%$ ΞΫηε ΦϦδϯͷαʔόʹΞΫηε Ωϟογϡର֎ͷίϯςϯπ ΩϟογϡظݶΕ ϩϦϙοϓʂ
ϩϦϙοϓʂͰ֎෦$%/αʔϏε͏
*OUFSOFU 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS $%/ࣄۀऀ%$ ΞΫηε ϩϦϙοϓʂ ΠϯλʔωοτΛߦ͖དྷ͢Δඞཁ͕͋Δ ϩϦϙοϓʂͰ֎෦$%/αʔϏε͏
ίϯςϯπΩϟογϡػೳͷ߹ *OUFSOFU 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS ΞΫηε ϩϦϙοϓʂ
ίϯςϯπΩϟογϡػೳͷ߹ *OUFSOFU 3FWFSTF1SPYZ $BDIF4FSWFS 8FSWFS ΞΫηε ߴ ϩϦϙοϓʂ
$%/োน͕ߴ͍
$%/োน͕ߴ͍ υϝΠϯΛ$%/ʹ͚ΔͨΊͷ%/4ͷઃఆ ͦͦ%/4ͱʁ $%/ػೳ͕ଟ͘ઃఆ͕ෳࡶ ඇΤϯδχΞͷํʹͱ͍ͬͯ͠ αʔϏεʹΑͬͯར༻ྉ͕ۚൃੜ͢Δ ϩϦϙοϓʂΤϯδχΞҎ֎ͷํʑ͔Β ଟ͘͝ར༻͍͍ͯΔ
ίϯςϯπΩϟογϡػೳʁ
None
Άͪͬ
Άͪͬ ଟػೳΑΓ؆୯Λ༏ઌ
͜͜·Ͱͷ͓͞Β͍ ίϯςϯπΩϟογϡػೳΛϦϦʔε ࠃ࠷ϨϯαόΛࢦ͢ʂ ֎෦$%/Λซ༻͢ΔΑΓɺંฦ͠ ͷ௨৴Ͱ݁͢Δɻ ୭Ͱ؆୯ʹઃఆͰ͖Δʂ $%/͕͍͠ͱײ͡Δ͓٬༷Ͱ؆୯ ʹઃఆ͕Մೳɻ
͜͜·Ͱ໘ന͘ͳ͍Ͷʁ
ຊ େنϗεςΟϯάͳΒͰͷ ίϯςϯπΩϟογϡػೳΛ ࢧ͑ΔΠϯϑϥٕज़ʹ͍ͭͯ ͓͠·͢ʂ
ઃܭ લఏ ࣮ ·ͱΊ ຊͷྲྀΕ ίϯςϯπΩϟογϡͷ֓ཁɾ։ൃܦҢ ࠓίί ίϯςϯπΩϟογϡͷػೳͱΠϯϑϥʹٻΊͨ͜ͱ
ઃܭ લఏ ࣮ ·ͱΊ ίϯςϯπΩϟογϡͷػೳͱ ΠϯϑϥʹٻΊͨ͜ͱ
ΩϟογϡϞʔυ
ΩϟογϡϞʔυ 81Ωϟογϡػೳ ੩తΩϟογϡػೳ
81Ωϟογϡػೳ 8PSE1SFTT༻ʹ࠷దԽͨ͠Ωϟογϡػೳ ϩϦϙοϓʂͷ͓٬༷ͷଟ͘8PSE1SFTTΛ ར༻͍ͯ͠Δ ੩తΩϟογϡػೳ ը૾+4 $44ͳͲͷ੩తίϯςϯπΛରʹ ͨ͠Ωϟογϡػೳ 8PSE1SFTTҎ֎Λར༻͍ͯ͠Δํ͚ ҆ఆͨ͠αΠτදࣔʹد༩
ΩϟογϡϞʔυ
ͯ͢ͷίϯςϯπΛΩϟογϡͨ͠߹ɿ 8PSE1SFTTͷϩάΠϯޙͷཧը໘͕Ωϟο γϡ͞Εͨ߹ʹҙਤ͠ͳ͍ใ͕࿙ΕΔ ಠࣗձһ੍8&#ΞϓϦέʔγϣϯͰɺผͷ ձһͷϖʔδ͕ݟ͑ͯ͠·͏ ϚωʔδυͳΩϟογϡػೳΛఏڙ ΩϟογϡϞʔυ ͳͥΩϟογϡϞʔυΛ͚Δඞཁ͕͋Δʁ
υϝΠϯͷઃఆʹԠͨ͡ ػೳͷϋϯυϦϯά
طଘͷߏ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ
طଘͷߏ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ
ສαΠτ
υϝΠϯͷઃఆʹԠͯ͡ϓϩΩγઌΛมߋ͍ͨ͠ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS PS ίϯςϯπΩϟογϡػೳ 0/ʁ0''ʁ
3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF# 4JUF$
4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS PS ΩϟογϡͷϞʔυ 81Ωϟογϡʁ ੩తΩϟογϡʁ υϝΠϯͷઃఆʹԠͯ͡ৼΔ͍Λ੍ޚ͍ͨ͠
εέʔϥϏϦςΟ
εέʔϥϏϦςΟ αʔόΛՃ͚ͨͩ͠Ͱউखʹػೳ͕εέʔϧ ͢ΔΠϯϑϥΞʔΩςΫνϟʹ͍ͨ͠ $BDIF4FSWFS $BDIF4FSWFS $BDIF4FSWFS 3FWFSTF1SPYZ
ߴՄ༻ੑ
ߴՄ༻ੑ αʔόյΕΔ յΕͯશࣗಈͰαʔϏεͷঢ়ଶ͕෮چ͢Δ ΠϯϑϥΞʔΩςΫνϟʹ͍ͨ͠ $BDIF4FSWFS $BDIF4FSWFS $BDIF4FSWFS 3FWFSTF1SPYZ
ޮతͳΩϟογϡ
ޮతͳΩϟογϡ ୯७ʹ$BDIF4FSWFSΛฒͯࢄ͢Δͱ 3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS 8FSWFS ΩϟογϡώοτԼ σΟεΫྖҬͷফඅ FYBNQMFDPN FYBNQMFDPN
ޮతͳΩϟογϡ υϝΠϯຖʹॲཧ͢Δ$BDIF4FSWFSΛݶఆ͍ͨ͠ 3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS 8FSWFS Ωϟογϡώοτ্ σΟεΫྖҬͷઅ FYBNQMFDPN FYBNQMFDPN
͜͜·Ͱͷ͓͞Β͍ ΩϟογϡϞʔυ 81 ੩తΩϟογϡ υϝΠϯͷઃఆʹԠͨ͡ػೳͷϋϯυϦϯά εέʔϥϏϦςΟ ߴՄ༻ੑ ޮతͳΩϟογϡ ίϯςϯπΩϟογϡͷػೳͱ
ɹɹɹɹɹɹɹɹΠϯϑϥʹٻΊͨ͜ͱ
͜ΕΒΛಉ࣌ʹຬͨ͢ ج൫Λ࣮͢Δඞཁ͕͋Δ
࣮ લఏ ઃܭ ·ͱΊ ίϯςϯπΩϟογϡػೳͷ࣮
͜͜Ͱ#FFS څਫ
ΩϟογϡϞʔυͷ࣮
ΩϟογϡϞʔυͷ࣮ http { : proxy_cache_path /var/cache/nginx/cache levels=1:2 \ keys_zone=zone1:1024m inactive=10m;
proxy_cache_valid 200 10m; proxy_cache_valid 404 1m; server { : proxy_cache zone1; proxy_cache_key $proxy_scheme://$host$ $is_args$args; proxy_pass $proxy_scheme://${Origin Server}; } } OHJOYඪ४ͷOHY@IUUQ@QSPYZ@NPEVMFΛར༻
http { : proxy_cache_path /var/cache/nginx/cache levels=1:2 \ keys_zone=zone1:1024m inactive=10m; proxy_cache_valid
200 10m; proxy_cache_valid 404 1m; server { : proxy_cache zone1; proxy_cache_key $proxy_scheme://$host$request_uri$is_args$args; proxy_pass $proxy_scheme://${Origin Server}; } } OHJOYඪ४ͷOHY@IUUQ@QSPYZ@NPEVMFΛར༻ DBDIFͷอଘઌαΠζɺ༗ޮظؒ ΩϟογϡϞʔυͷ࣮
http { : proxy_cache_path /var/cache/nginx/cache levels=1:2 \ keys_zone=zone1:1024m inactive=10m; proxy_cache_valid
200 10m; proxy_cache_valid 404 1m; server { : proxy_cache zone1; proxy_cache_key $proxy_scheme://$host$request_uri$is_args$args; proxy_pass $proxy_scheme://${Origin Server}; } } OHJOYඪ४ͷOHY@IUUQ@QSPYZ@NPEVMFΛར༻ εςʔλείʔυʹ ΑͬͯอଘظؒΛม͑Δ ΩϟογϡϞʔυͷ࣮
http { : proxy_cache_path /var/cache/nginx/cache levels=1:2 \ keys_zone=zone1:1024m inactive=10m; proxy_cache_valid
200 10m; proxy_cache_valid 404 1m; server { : proxy_cache zone1; proxy_cache_key $proxy_scheme://$host$request_uri$is_args$args; proxy_pass $proxy_scheme://${Origin Server}; } } OHJOYඪ४ͷOHY@IUUQ@QSPYZ@NPEVMFΛར༻ [POFΛͬͯΩϟογϡ͢Δ ΩϟογϡϞʔυͷ࣮
http { : proxy_cache_path /var/cache/nginx/cache levels=1:2 \ keys_zone=zone1:1024m inactive=10m; proxy_cache_valid
200 10m; proxy_cache_valid 404 1m; server { : proxy_cache zone1; proxy_cache_key $proxy_scheme://$host$request_uri$is_args$args; proxy_pass $proxy_scheme://${Origin Server}; } } OHJOYඪ४ͷOHY@IUUQ@QSPYZ@NPEVMFΛར༻ Ωϟογϡͷอଘɾ୳ࡧͷΩʔ ΩϟογϡϞʔυͷ࣮
ΩϟογϡϞʔυͷ࣮ http { : proxy_cache_path /var/cache/nginx/cache levels=1:2 \ keys_zone=zone1:1024m inactive=10m;
proxy_cache_valid 200 10m; proxy_cache_valid 404 1m; server { : proxy_cache zone1; proxy_cache_key $proxy_scheme://$host$request_uri$is_args$args; proxy_pass $proxy_scheme://${Origin Server}; } } OHJOYඪ४ͷOHY@IUUQ@QSPYZ@NPEVMFΛར༻ Ωϟογϡ͕ͳ͍߹ɾ༗ޮظݶΕͷ߹ʹ ΞΫηε͢ΔΦϦδϯαʔό
ΩϟογϡϞʔυͷ࣮ http { : server { : location /login {
proxy_no_cache 1; proxy_cache_bypass 1; } } } OHJOYඪ४ͷOHY@IUUQ@QSPYZ@NPEVMFΛར༻ Ωϟογϡ͠ͳ͍ ΩϟογϡΛ୳ࡧ͠ͳ͍
Ωϟογϡػೳ : location / { : set $do_not_cache 0; if
($http_cookie ~ '(wordpress_|comment_author|wp-postpass)') { set $do_not_cache 1; } proxy_no_cache $do_not_cache; proxy_cache_bypass $do_not_cache; proxy_cache zone1; proxy_cache_key "$proxy_scheme://$host$request_uri$is_args$args"; proxy_pass $proxy_scheme://${Origin Server}; } DPPLJFʹಛఆͷจࣈྻ͕ ͋Δ࣌Ωϟογϡ͠ͳ͍ 81Ωϟογϡػೳͷྫ Ұ෦ ɿ
ͬͯΔ͠ ͋Μ·໘ന͘ͳ͍Ͱ͢ΑͶʂ
Ҏ߱ͰɺϨϯαόʹ͓͚Δ ՝Λόʔϯͱղܾ͢Δ ιϑτΣΞͷΛ ͍͖ͯ͠·͢
υϝΠϯʹԠͨ͡ ػೳͷϋϯυϦϯάͷ࣮
Γ͍ͨ͜ͱ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS PS ίϯςϯπΩϟογϡػೳ 0/ʁ0''ʁ ΩϟογϡͷϞʔυ 81Ωϟογϡʁ ੩తΩϟογϡʁ
ͲͷΑ͏ʹ࣮͢Δ͔ʁ
طଘͷߏΛ͏গ͠ৄ͘͠ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ
3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ
ඦ طଘͷߏΛ͏গ͠ৄ͘͠
3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ
ສαΠτ طଘͷߏΛ͏গ͠ৄ͘͠
3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ
සൟʹ૿ݮ͢Δ طଘͷߏΛ͏গ͠ৄ͘͠
Ϩϯλϧαʔόͷ߹ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF%
େྔͷ૿ݮ͢ΔυϝΠϯΛ ͲͷΑ͏ʹϓϩΩγ͍ͯ͠Δ͔ʁ
େྔυϝΠϯͷϓϩΩγ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ ສαΠτҎ্ͷ ϓϩΩγͷઃఆΛ ॻ͘ͷݱ࣮తͰͳ͍
େྔυϝΠϯͷಈతͳϓϩΩγ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ OHJOY OHY@NSVCZ
ฐࣾͷ!NBUTVNPUPSZ͕։ൃ͍ͯ͠Δ OHJOYʹΈࠐΉ͜ͱͰϓϩηεͷىಈ ϦΫΤετͷλΠϛϯάͰNSVCZͷεΫϦ ϓτΛ࣮ߦͰ͖Δ NSVCZΈࠐΈ͚ͷܰྔ3VCZ࣮ OHY@NSVCZ
େྔυϝΠϯͷಈతͳϓϩΩγ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ OHJOY OHY@NSVCZ
େྔυϝΠϯͷಈతͳϓϩΩγ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ υϝΠϯͱ8FSWFSͷඥ͚ͮ σʔλϕʔε υϝΠϯTJUFBDPN αʔό8FSWFS OHJOY OHY@NSVCZ
େྔυϝΠϯͷಈతͳϓϩΩγ 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ υϝΠϯͱ8FSWFSͷඥ͚ͮ σʔλϕʔε υϝΠϯTJUFBDPN αʔό8FSWFS OHJOY OHY@NSVCZ NSVCZΛͬͯ ίϯςϯπΩϟογϡػೳͷ ϋϯυϦϯάΛߦ͏ʂ
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS PS ίϯςϯπΩϟογϡػೳ 0/ʁ0''ʁ ΩϟογϡͷϞʔυ 81Ωϟογϡʁ ੩తΩϟογϡʁ ίϯςϯπΩϟογϡػೳ 0/ʁ0''ʁ ΩϟογϡͷϞʔυ 81Ωϟογϡʁ ੩తΩϟογϡʁ 3FWFSTF1SPYZ 8FSWFS $BDIF4FSWFS
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS σʔλϕʔε υϝΠϯTJUFBDPN αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS σʔλϕʔε υϝΠϯTJUFBDPN αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 ΩϟογϡͷϞʔυ 81Ωϟογϡʁ ੩తΩϟογϡʁ ΩϟογϡͷϞʔυ 81Ωϟογϡʁ ੩తΩϟογϡʁ
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS σʔλϕʔε ΩϟογϡͷϞʔυ 81PS੩త ʹΑͬͯڍಈΛม͍ͨ Ωϟογϡର֎ ظݶΕͷ߹ʹ ΞΫηε͢Δ ΦϦδϯαʔόͷใ υϝΠϯTJUFBDPN αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS σʔλϕʔε OHY@NSVCZ υϝΠϯTJUFBDPN αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS σʔλϕʔε υϝΠϯTJUFBDPN αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 OHY@NSVCZ OHY@NSVCZΛ͑ ͬͱεϚʔτʹͰ͖Δ
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS σʔλϕʔε OHY@NSVCZ υϝΠϯTJUFBDPN αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 3FWFSTF1SPYZ σʔλϕʔε υϝΠϯTJUFBDPN αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 %#͔Βऔಘͨ͠σʔλΛ
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ 8FSWFS *OUFSOFU 8FSWFS IUUQTTJUFBDPN 4JUF" 4JUF#
4JUF$ 4JUF% ͓٬༷ͷίϯςϯπ $BDIF4FSWFS σʔλϕʔε OHY@NSVCZ υϝΠϯTJUFBDPN αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 σʔλϕʔε υϝΠϯTJUFBDPN αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 3FWFSTF1SPYZ $BDIF4FSWFS %#͔Βऔಘͨ͠σʔλΛ NSVCZͰ IUUQϔομʹ ༩ͯ͠ൖ )551ϔομ
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ OHJOY OHY@NSVCZ 8FSWFS 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF%
$BDIF4FSWFS IUUQTTJUFBDPN σʔλϕʔε αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ OHJOY OHY@NSVCZ 8FSWFS 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF%
$BDIF4FSWFS IUUQTTJUFBDPN σʔλϕʔε IUUQϔομΛՃ αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 9-0-*10161453&".8FC4FSWFS 9-0-*101$"$)&5:1&81 h = Nginx::Headers_in.new h['X-LOLIPOP-UPSTREAM'] = 'Web Server1' h['X-LOLIPOP-CACHE-TYPE'] = 'WP' ࣮ࡍ%#͔Βऔಘͨ͠
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ OHJOY OHY@NSVCZ 8FSWFS 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF%
$BDIF4FSWFS IUUQTTJUFBDPN σʔλϕʔε αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 9-0-*10161453&".8FC4FSWFS 9-0-*101$"$)&5:1&81 if ($http_x_lolipop_cache_type = "WP") { # WPΩϟογϡػೳͷڍಈ : } IUUQϔομΛՃ IUUQϔομΛͱʹ ΩϟογϡػೳͷڍಈΛมߋ
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ OHJOY OHY@NSVCZ 8FSWFS 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF%
$BDIF4FSWFS IUUQTTJUFBDPN σʔλϕʔε IUUQϔομΛͱʹϓϩΩγ αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 9-0-*10161453&".8FC4FSWFS 9-0-*101$"$)&5:1&81 IUUQϔομΛͱʹ ΩϟογϡػೳͷڍಈΛมߋ proxy_pass $proxy_scheme://$http_x_lolipop_upstream; IUUQϔομΛՃ
ػೳͷϋϯυϦϯά 3FWFSTF1SPYZ OHJOY OHY@NSVCZ 8FSWFS 8FSWFS 4JUF" 4JUF# 4JUF$ 4JUF%
$BDIF4FSWFS IUUQTTJUFBDPN σʔλϕʔε IUUQϦΫΤετϔομΛՃ IUUQϦΫΤετϔομΛͱʹϓϩΩγ αʔό8FSWFS ΩϟογϡPO ΩϟογϡλΠϓ81 9-0-*10161453&".8FC4FSWFS 9-0-*101$"$)&5:1&81 IUUQϦΫΤετϔομΛͱ ʹΩϟογϡػೳͷڍಈΛมߋ proxy_pass $proxy_scheme://$http_x_lolipop_upstream; NSVCZͰσʔλϕʔε͔Βऔಘͨ͠ΛIUUQ ϔομʹຒΊࠐΉ $BDIF4FSWFSଆຒΊࠐ·ΕͨIUUQϔομΛ ࢀর͚ͩͰυϝΠϯຖͷৼΔ͍ͷ੍ޚ͕Մೳ IUUQϔομʹΑΔใͷͳͷͰɺ$BDIF 4FSWFS௨ৗͷOHJOYͰΑ͍ͷͰγϯϓϧ
3FWFSTF1SPYZ OHJOY OHY@NSVCZ σʔλϕʔε ϦΫΤετ ύϑΥʔϚϯεେৎʁ
ύϑΥʔϚϯεྼԽΛ࠷খݶʹ ͑ΔςΫχοΫΛ͝հ͠·͢ʂ
Ωϟογϡͷಋೖ
Ωϟογϡͷಋೖ 3FWFSTF1SPYZ .Z42- ϦΫΤετ 3FEJT OHJOY OHY@NSVCZ
Ωϟογϡͷಋೖ 3FWFSTF1SPYZ .Z42- ϦΫΤετ 3FEJT OHJOY OHY@NSVCZ ᶃ ᶃ3FEJT͔ΒใΛऔಘ
Ωϟογϡͷಋೖ 3FWFSTF1SPYZ .Z42- ϦΫΤετ 3FEJT OHJOY OHY@NSVCZ ᶃ ᶄ ᶃ3FEJT͔ΒใΛऔಘ
ᶄᶃͰଘࡏ͠ͳ͚Ε.Z42-͔ΒใΛऔಘ
Ωϟογϡͷಋೖ 3FWFSTF1SPYZ .Z42- ϦΫΤετ 3FEJT OHJOY OHY@NSVCZ ᶃ ᶅ ᶄ
ᶃ3FEJT͔ΒใΛऔಘ ᶄᶃͰଘࡏ͠ͳ͚Ε.Z42-͔ΒใΛऔಘ ᶅᶄͰऔಘͨ͠ใΛ࣍ճϦΫΤετͷͨΊʹ 3FEJTʹॻ͖ࠐΈ
ϖύϘͰɺσʔλετΞΛ ֊Խͯ͠Λ͍͍ײ͡ʹ͢Δ NSCHFNΛެ։͍ͯ͠·͢ ֦ுػߏ 3VCZͰ͍͏HFN
NSVCZNTE MPDBMNFNDBDIF ΠϯϝϞϦ,74 3FEJT .Z42- ॲཧίετ͕͍ॱʹGFUDI ࣍ճҎ߱ͷGFUDIͷͨΊʹΩϟογϡ .VMUJ4UBHF%BUBTUPSF https://github.com/pepabo/mruby-msd NTE͕͍͍ײ͡ʹߴͳσʔλετΞ͔ΒGFUDI͢Δ
NSVCZNTE redis = Msd::Store::Redis.new mysql = Msd::Store::MySQL.new( 'SELECT host FROM
table WHERE domain = ?', 'localhost', 'root', 'password', 'DBName' ) msd = Msd::Client.new msd.configure do |c| c.stores = [redis, mysql] end msd.fetch('site-a.com') # => "Web Server1"
NSVCZNTE redis = Msd::Store::Redis.new mysql = Msd::Store::MySQL.new( 'SELECT host FROM
table WHERE domain = ?', 'localhost', 'root', 'password', 'DBName' ) msd = Msd::Client.new msd.configure do |c| c.stores = [redis, mysql] end msd.fetch('site-a.com') # => "Web Server1" ଓ
NSVCZNTE redis = Msd::Store::Redis.new mysql = Msd::Store::MySQL.new( 'SELECT host FROM
table WHERE domain = ?', 'localhost', 'root', 'password', 'DBName' ) msd = Msd::Client.new msd.configure do |c| c.stores = [redis, mysql] end msd.fetch('site-a.com') # => "Web Server1" ଓ σʔλετΞΛొ
NSVCZNTE redis = Msd::Store::Redis.new mysql = Msd::Store::MySQL.new( 'SELECT host FROM
table WHERE domain = ?', 'localhost', 'root', 'password', 'DBName' ) msd = Msd::Client.new msd.configure do |c| c.stores = [redis, mysql] end msd.fetch('site-a.com') # => "Web Server1" ଓ σʔλετΞΛొ σʔλΛΩϟογϡͭͭ͠GFUDI͢Δ
3FWFSTF1SPYZ OHJOY OHY@NSVCZ .Z42- 3FEJT ϦΫΤετ ϦΫΤετຖʹίωΫγϣϯΛ ுΔͷίετ͕ߴ͍ ίωΫγϣϯ
ίωΫγϣϯͷ͍ճ͠
OHY@NSVCZʹNSVCZͷϑοΫϙΠϯτ͕ଘࡏ͢Δ https://github.com/matsumotory/ngx_mruby/tree/master/docs/directives mruby_init_worker /path/to/init.rb; mruby_init_worker_code " # ίʔυ "; mruby_set
$variable /path/to/variable.rb; mruby_access_handler /path/to/access.rb; mruby_access_handler /path/to/access.rb cache; nginx.conf # Workerϓϩηεىಈ࣌ # cacheΦϓγϣϯΛ͚ͭΔͱnginxىಈ࣌ʹmrubyΛόΠτίʔυ # _code ͷσΟϨΫςΟϒΠϯϥΠϯͰmrubyͷίʔυΛهड़Ͱ͖Δ # mrubyͷ࣮ߦ݁ՌΛnginxͷมʹ֨ೲ͢Δ # ϦΫΤετ։࢝࣌ʹ࣮ߦ͞ΕΔ
OHY@NSVCZʹNSVCZͷϑοΫϙΠϯτ͕ଘࡏ͢Δ https://github.com/matsumotory/ngx_mruby/tree/master/docs/directives mruby_init_worker /path/to/init.rb; mruby_init_worker_code " # ίʔυ "; mruby_set
$variable /path/to/variable.rb; mruby_access_handler /path/to/access.rb; mruby_access_handler /path/to/access.rb cache; nginx.conf # Workerϓϩηεىಈ࣌ # cacheΦϓγϣϯΛ͚ͭΔͱnginxىಈ࣌ʹmrubyΛόΠτίʔυ # _code ͷσΟϨΫςΟϒΠϯϥΠϯͰmrubyͷίʔυΛهड़Ͱ͖Δ # mrubyͷ࣮ߦ݁ՌΛnginxͷมʹ֨ೲ͢Δ # ϦΫΤετ։࢝࣌ʹ࣮ߦ͞ΕΔ
OHY@NSVCZʹNSVCZͷϑοΫϙΠϯτ͕ଘࡏ͢Δ https://github.com/matsumotory/ngx_mruby/tree/master/docs/directives mruby_init_worker /path/to/init.rb; mruby_init_worker_code " # ίʔυ "; mruby_set
$variable /path/to/variable.rb; mruby_access_handler /path/to/access.rb; mruby_access_handler /path/to/access.rb cache; nginx.conf # Workerϓϩηεىಈ࣌ # cacheΦϓγϣϯΛ͚ͭΔͱnginxىಈ࣌ʹmrubyΛόΠτίʔυ # _code ͷσΟϨΫςΟϒΠϯϥΠϯͰmrubyͷίʔυΛهड़Ͱ͖Δ # mrubyͷ࣮ߦ݁ՌΛnginxͷมʹ֨ೲ͢Δ # ϦΫΤετ։࢝࣌ʹ࣮ߦ͞ΕΔ
OHY@NSVCZʹNSVCZͷϑοΫϙΠϯτ͕ଘࡏ͢Δ https://github.com/matsumotory/ngx_mruby/tree/master/docs/directives mruby_init_worker /path/to/init.rb; mruby_init_worker_code " # ίʔυ "; mruby_set
$variable /path/to/variable.rb; mruby_access_handler /path/to/access.rb; mruby_access_handler /path/to/access.rb cache; nginx.conf # Workerϓϩηεىಈ࣌ # cacheΦϓγϣϯΛ͚ͭΔͱnginxىಈ࣌ʹmrubyΛόΠτίʔυ # _code ͷσΟϨΫςΟϒΠϯϥΠϯͰmrubyͷίʔυΛهड़Ͱ͖Δ # mrubyͷ࣮ߦ݁ՌΛnginxͷมʹ֨ೲ͢Δ # ϦΫΤετ։࢝࣌ʹ࣮ߦ͞ΕΔ
OHY@NSVCZʹNSVCZͷϑοΫϙΠϯτ͕ଘࡏ͢Δ https://github.com/matsumotory/ngx_mruby/tree/master/docs/directives mruby_init_worker /path/to/init.rb; mruby_init_worker_code " # ίʔυ "; mruby_set
$variable /path/to/variable.rb; mruby_access_handler /path/to/access.rb; mruby_access_handler /path/to/access.rb cache; nginx.conf # Workerϓϩηεىಈ࣌ # cacheΦϓγϣϯΛ͚ͭΔͱnginxىಈ࣌ʹmrubyΛόΠτίʔυ # _code ͷσΟϨΫςΟϒΠϯϥΠϯͰmrubyͷίʔυΛهड़Ͱ͖Δ # mrubyͷ࣮ߦ݁ՌΛnginxͷมʹ֨ೲ͢Δ # ϦΫΤετ։࢝࣌ʹ࣮ߦ͞ΕΔ
ίωΫγϣϯΛ͍ճ͢ https://github.com/matsumotory/ngx_mruby/tree/master/docs/directives mruby_init_worker /path/to/init.rb; mruby_init_worker_code " # ίʔυ "; mruby_set
$variable /path/to/variable.rb; mruby_access_handler /path/to/access.rb; mruby_access_handler /path/to/access.rb cache; nginx.conf # Workerϓϩηεىಈ࣌ # cacheΦϓγϣϯΛ͚ͭΔͱnginxىಈ࣌ʹmrubyΛόΠτίʔυ # _code ͷσΟϨΫςΟϒΠϯϥΠϯͰmrubyͷίʔυΛهड़Ͱ͖Δ # mrubyͷ࣮ߦ݁ՌΛnginxͷมʹ֨ೲ͢Δ # ϦΫΤετ։࢝࣌ʹ࣮ߦ͞ΕΔ mruby_init_worker /path/to/init.rb; # Workerϓϩηεىಈ࣌ # ϦΫΤετ։࢝࣌ʹ࣮ߦ͞ΕΔ mruby_access_handler /path/to/access.rb;
OHJOY 3FEJT 8PSLFSىಈ࣌ʹ3FEJTͱଓ͠ίωΫγϣϯΛอଘ͢Δ
OHJOY XPSLFS 3FEJT ίωΫγϣϯ 8PSLFSىಈ࣌ʹ3FEJTͱଓ͠ίωΫγϣϯΛอଘ͢Δ 8PSLFSϓϩηεͷ ىಈ
OHJOY XPSLFS 3FEJT mruby_init_worker_code " Userdata.new.redis = Redis.new('127.0.0.1', 6379) ";
ίωΫγϣϯ 8PSLFSىಈ࣌ʹ3FEJTͱଓ͠ίωΫγϣϯΛอଘ͢Δ 8PSLFSϓϩηεͷ ىಈ NSVCZVTFSEBUBͱ͍͏NSCHFNΛͬͯɺNSVCZεΫϦϓτ͔Βࢀর Ͱ͖ͳ͍NSVCZͷάϩʔόϧมʹ3FEJTͷίωΫγϣϯΛ֨ೲ ൺֱత҆શʹάϩʔόϧมʹΦϒδΣΫτΛ֨ೲͰ͖Δ
OHJOY XPSLFS 3FEJT 8PSLFSىಈ࣌ʹଓͨ͠3FEJTͷίωΫγϣϯΛ͏
OHJOY XPSLFS 3FEJT 8PSLFSىಈ࣌ʹଓͨ͠3FEJTͷίωΫγϣϯΛ͏ ϦΫΤετ ΞΫηε mruby_access_handler_code " Userdata.new.redis.get('hoge') ";
OHJOY XPSLFS 3FEJT 8PSLFSىಈ࣌ʹଓͨ͠3FEJTͷίωΫγϣϯΛ͏ ϦΫΤετ ΞΫηε mruby_access_handler_code " Userdata.new.redis.get('hoge') ";
8PSLFSىಈ࣌ʹଓͨ͠ίωΫγϣϯΛऔΓग़ͯ͠ɺར༻͢Δɻ NSVCZͷΠϯλϓϦλ͕8PSLFSͰ͍ճ͞Ε͍ͯΔͨΊΞΫηε͕Մೳ ͦͷͨΊɺผͷ8PSLFS͔ΒผͷΠϯλϓϦλͳͷͰࢀরͰ͖ͳ͍
OHJOY XPSLFS 3FEJT 8PSLFSىಈ࣌ʹଓͨ͠3FEJTͷίωΫγϣϯΛ͏ ϦΫΤετ ΞΫηε mruby_access_handler_code " Userdata.new.redis.get('hoge') ";
ίωΫγϣϯΛுͬͨޙʹ3FEJT͕࠶ىಈ͞ΕΔͳͲɺ ίωΫγϣϯ͕அ͞ΕΔ͜ͱΛఆͯ͠࠶ଓॲཧͷ࣮ඞཁɻ NSVCZNTE࣮ࡁΈ
εέʔϥϏϦςΟ ߴՄ༻ੑ
εέʔϥϏϦςΟ ߴՄ༻ੑ ໘ͳखॱͳ͘؆୯ɺࣗಈʹ
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS ϓϩΩγ͕ਖ਼ৗͳαʔόΛೝࣝͯ͠ ಈతʹϓϩΩγઌΛܾΊΔ
$POTVM OHY@NSVCZ CZ)BTIJ$PSQ
)BTIJ$PSQ͕։ൃ͍ͯ͠ΔιϑτΣΞ ػೳɿ αʔϏεσ ΟεΧόϦ ϔϧενΣοΫ ͳͲͳͲ DPOTVM
DPOTVMͷΠϕϯτʹൃՐͯ͠ɺ༧Ί༻ҙ͠ ͨςϯϓϨʔτΛͬͯϑΝΠϧΛੜͰ ͖Δɻ αʔόͷ૿ݮ ϔϧενΣοΫͷ݁Ռ DPOTVMUFNQMBUF
$POTVMΛ͏ͱͲ͏ͳΔʁ
3FWFSTF1SPYZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS $POTVMΛ͏ͱͲ͏ͳΔʁ
3FWFSTF1SPYZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS $POTVMͰTFSJWDFΛఆٛ ϔϧενΣοΫ TFSWJDFΛఆٛͯ͠ϔϧενΣοΫ͕Ͱ͖Δ
{ "service": { "name": "cache-server", "checks": [ { "script": "ϔϧενΣοΫίϚϯυ", } ] } }
3FWFSTF1SPYZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS # curl -s http://localhost:8500/v1/health/service/
\ cache-server | jq '.[].Node.Node' "cache-server-1" "cache-server-2" TFSWJDFDBDIFTFSWFS ϔϧενΣοΫ DPOTVM"1*ʹΞΫηε͢ΔͱαʔϏεʹଐ͢Δ ϊʔυΛಘΔ͜ͱ͕Ͱ͖Δɻ ϔϧενΣοΫ݁ՌಘΔ͜ͱ͕Ͱ͖Δɻ αʔϏεʹଐ͢ΔϊʔυͷҰཡϔϧενΣοΫ݁ՌΛಘΒΕΔ
DPOTVMUFNQMBUFΛͬͯɺ ಈతʹϑΝΠϧΛੜ͢Δ
3FWFSTF1SPYZ OHJOY XJUIOHY@NSVCZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS DPOTVMUFNQMBUFΛͬͯɺಈతʹϑΝΠϧΛੜ͢Δ
DPOTVMUFNQMBUF
3FWFSTF1SPYZ OHJOY XJUIOHY@NSVCZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS DPOTVMUFNQMBUF
{{ range service "cache-server|passing" }} - {{ .Address }} {{ end }} servers.yml.ctmpl DPOTVMUFNQMBUFΛͬͯɺಈతʹϑΝΠϧΛੜ͢Δ ϩʔυ ςϯϓϨʔτϑΝΠϧ
3FWFSTF1SPYZ OHJOY XJUIOHY@NSVCZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS DPOTVMUFNQMBUF
{{ range service "cache-server|passing" }} - {{ .Address }} {{ end }} servers.yml.ctmpl TFSWJDF ϔϧενΣοΫঢ়ଶ OPEFͷ*1ΞυϨε DPOTVMUFNQMBUFΛͬͯɺಈతʹϑΝΠϧΛੜ͢Δ ϩʔυ ςϯϓϨʔτϑΝΠϧ
3FWFSTF1SPYZ OHJOY XJUIOHY@NSVCZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS DPOTVMUFNQMBUF
{{ range service "cache-server|passing" }} - {{ .Address }} {{ end }} - cache-server-1ͷIPΞυϨε - cache-server-2ͷIPΞυϨε servers.yml.ctmpl servers.yml DPOTVMUFNQMBUFΛͬͯɺಈతʹϑΝΠϧΛੜ͢Δ ϩʔυ औಘ ੜ ςϯϓϨʔτϑΝΠϧ
3FWFSTF1SPYZ OHJOY XJUIOHY@NSVCZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS DPOTVMUFNQMBUF
{{ range service "cache-server|passing" }} - {{ .Address }} {{ end }} - cache-server-1ͷIPΞυϨε - cache-server-2ͷIPΞυϨε - cache-server-3ͷIPΞυϨε servers.yml.ctmpl servers.yml αʔόΛ૿ઃͨ͠ͱ͖ DPOTVM DBDIFTFSWFS ςϯϓϨʔτϑΝΠϧ
3FWFSTF1SPYZ OHJOY XJUIOHY@NSVCZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS DPOTVMUFNQMBUF
{{ range service "cache-server|passing" }} - {{ .Address }} {{ end }} - cache-server-1ͷIPΞυϨε - cache-server-2ͷIPΞυϨε servers.yml.ctmpl servers.yml αʔό͕μϯͨ͠ͱ͖ ϔϧενΣοΫ ςϯϓϨʔτϑΝΠϧ
αʔόͷ૿ݮ࣌ʹ ਖ਼ৗͳαʔόҰཡΛ ಈతੜ͢Δ͜ͱ͕Ͱ͖ͨʂ
NSVCZΛΈ߹ͤͯ ಈతʹઃఆΛಡΈࠐΉ
3FWFSTF1SPYZ OHJOY XJUIOHY@NSVCZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ
DPOTVMUFNQMBUF mruby_init_worker_code " servers = YAML.load( File.open('servers.yml').read ) Userdata.new.servers = servers "; nginx.conf DPOTVM DBDIFTFSWFS
3FWFSTF1SPYZ OHJOY XJUIOHY@NSVCZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS DPOTVMUFNQMBUF
mruby_init_worker_code " servers = YAML.load( File.open('servers.yml').read ) Userdata.new.servers = servers "; nginx.conf DPOTVM DBDIFTFSWFS XPSLFSϓϩηεىಈ࣌ʹ ੜ͞Εͨ:".-Λϩʔυ *1ΞυϨεͷྻΛอଘ NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ
3FWFSTF1SPYZ OHJOY XJUIOHY@NSVCZ DPOTVM DPOTVM DBDIFTFSWFS DPOTVM DBDIFTFSWFS TFSWJDFDBDIFTFSWFS DPOTVMUFNQMBUF
mruby_init_worker_code " servers = YAML.load( File.open('servers.yml').read ) Userdata.new.servers = servers "; nginx.conf DPOTVM DBDIFTFSWFS XPSLFSϓϩηεىಈ࣌ʹ ੜ͞Εͨ:".-Λϩʔυ *1ΞυϨεͷྻΛอଘ DPOTVMUFNQMBUFͰϑΝΠϧੜޙʹOHJOYSFMPBEΛ࣮ࢪͯ͠ϩʔυ͢Δʂ OHJOY SFMPBE NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ
NSVCZͷੈքʹϓϩΩγઌͷ αʔόҰཡΛ͢͜ͱ͕Ͱ͖ͨʂ
NSVCZͰಈతʹ6QTUSFBNΛ ܾఆ͢Δ
NSVCZͰಈతʹ6QTUSFBNΛܾఆ͢Δ 3FWFSTF1SPYZ DBDIFTFSWFS DBDIFTFSWFS DBDIFTFSWFS 8FC4FSWFS ίϯςϯπΩϟογϡػೳແޮ࣌
NSVCZͰಈతʹ6QTUSFBNΛܾఆ͢Δ 3FWFSTF1SPYZ DBDIFTFSWFS DBDIFTFSWFS DBDIFTFSWFS 8FC4FSWFS ίϯςϯπΩϟογϡػೳ༗ޮ࣌ ͲΕ͔̍
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server μϛʔͷ6QTUSFBN OHY@NSVCZͰॻ͖͑Δ nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server OHJOYͷมʹNSVCZͷ࣮ߦ݁ՌΛ֨ೲ͢Δ nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server mruby_init_worker_code " servers = YAML.load( File.open('servers.yml').read ) Userdata.new.servers = servers "; ىಈ࣌ʹऔಘͨ͠$BDIF4FSWFSҰཡ nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server ଓઌͷϙʔτ൪߸ nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server μϛʔͰఆٛͨ͠6QTUSFBN nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server 6QTUSFBNͷαʔόΛॻ͖͑Δ nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server 6QTUSFBNͷαʔόΛॻ͖͑Δ ϥϯμϜʹΩϟογϡαʔόΛ1ฦ͢ nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server ࠷ޙʹࢀরͨ͠ͷ͕มʹ֨ೲ͞ΕΔ nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server ࠷ޙʹࢀরͨ͠ͷ͕มʹ֨ೲ͞ΕΔ ϓϩΩγ͢Δ nginx.conf
NSVCZΛΈ߹ͤͯಈతʹઃఆΛಡΈࠐΉ upstream dynamic_cache_server { server 127.0.0.1:80; mruby_upstream_keepalive 64; } mruby_set_code
$upstream " : if result.enable_contents_cache? servers = Userdata.new.servers port = Nginx::Connection.new.local_port index = SecureRandom.random_number(servers.size) upstream = Nginx::Upstream.new("dynamic_cache_server") upstream.server = "#{servers[index]}:#{port}" "dynamic_cache_server" else result.upstream end "; proxy_pass $upstream; # DB͔Βऔಘͨ͠ίϯςϯπΩϟογϡػೳͷར༻༗ແ # DB͔Βऔಘͨ͠υϝΠϯʹඥͮ͘Web Server ίϯςϯπΩϟογϡػೳ͕ແޮͷ߹ %#͔Βऔಘͨ͠8FC4FSWFSΛฦ͢ nginx.conf
DPOTVMͱOHY@NSVCZͷΈ߹ͤͰ αʔόͷ૿ݮʹ߹Θͤͯࣗಈతʹ ϓϩΩγઌΛܾఆ͢ΔΈ͕Ͱ͖ͨ
ޮతͳΩϟογϡ
ޮతͳΩϟογϡ ୯७ʹ$BDIF4FSWFSΛฒͯࢄ͢Δͱ 3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS 8FSWFS ΩϟογϡώοτԼ σΟεΫྖҬͷফඅ FYBNQMFDPN FYBNQMFDPN
ޮతͳΩϟογϡ υϝΠϯຖʹॲཧ͢Δ$BDIF4FSWFSΛݶఆ͍ͨ͠ 3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS 8FSWFS Ωϟογϡώοτ্ σΟεΫྖҬͷઅ FYBNQMFDPN FYBNQMFDPN
υϝΠϯຖʹΩϟογϡαʔόΛ ݶఆ͍͚ͨͩ͠Ͱͳ͘ ʴ αʔόͷεέʔϧʹࣗಈରԠ͍ͨ͠ ʴ Մ༻ੑΛҡ͍࣋ͨ͠
NSVCZͰ؆୯ͳΞϧΰϦζϜΛ࣮
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN F Y B N Q M F D P N υϝΠϯͷઌ಄͔Β̑จࣈநग़
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN F Y B N Q M F D P N ਐͷ"4$**ίʔυΛऔಘ υϝΠϯͷઌ಄͔Β̑จࣈநग़
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN F Y B N Q M F D P N ਐͷ"4$**ίʔυΛ͢ υϝΠϯͷઌ಄͔Β̑จࣈநग़
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN F Y B N Q M F D P N <> <> <> <> <> <> "SSBZ DPOTVMUFNQMBUFʹΑΔ:".-ੜˠ:".-MPBE ˠ"SSBZ
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN F Y B N Q M F D P N <> <> <> <> <> <> "SSBZ MFOHUI
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN F Y B N Q M F D P N <> <> <> <> <> <> "SSBZ
αʔόͷ૿ݮ͕ൃੜͨ͠߹
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN F Y B N Q M F D P N <> <> <> <> <> <> "SSBZ
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN F Y B N Q M F D P N <> <> <> <> <> <> "SSBZ MFOHUI DPOTVMUFNQMBUFͰઃఆϑΝΠϧ͕࠶ੜ OHJOYSFMPBE
3FWFSTF1SPYZ $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF 4FSWFS $BDIF
4FSWFS $BDIF 4FSWFS FYBNQMFDPN F Y B N Q M F D P N <> <> <> <> <> <> "SSBZ
NSVCZΛͬͨ؆୯ͳΞϧΰϦζϜͷ ࣮ʹΑͬͯ ޮతͳΩϟογϡΛ࣮ݱͨ͠ʂ
·ͱΊ
·ͱΊ ίϯςϯπΩϟογϡػೳΛϦϦʔεͨ͠ ંฦ͠Ͱߴɾઃఆ؆୯ NSVCZΛ׆༻ͯ͠େنϨϯαόڥʹඞཁͳཁ݅ Λຬͨͨ͠ NSVCZNTE NSVCZVTFSEBUBΛ༻͍ͨύϑΥʔϚ ϯε্5JQTΛհͨ͠ DPOTVMͱNSVCZΛΈ߹ͤͯɺαʔόͷঢ়ଶʹ߹ ΘͤͯಈతʹมԽ͢ΔΠϯϑϥΞʔΩςΫνϟΛ
࣮ݱͨ͠
܅ϖύϘͰಇ͔ͳ͍͔ʁ ࠷৽ͷ࠾༻ใΛνΣοΫˠ !QC@SFDSVJU
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠