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
Elasticsearch x AutoScaling
Search
mats
June 02, 2015
Technology
0
59
Elasticsearch x AutoScaling
第10回elasticsearch勉強会で使用した資料です。
mats
June 02, 2015
Tweet
Share
More Decks by mats
See All by mats
「生成系AI」と「ソフトウェアライセンス」の今 / Generative AI and OSS License
mats16
4
1.4k
🦜️🔗LangChain入門 / LangChain 101
mats16
1
570
Supabase - AWS DevDay 2022
mats16
3
1.7k
AWS スタートアップ支援プログラム / AWS Activate
mats16
0
1.1k
AWS Startup ゼミ 2021 秋期講習 / AWS Startup Seminar 2021 Autumn class - AWS Dev Day
mats16
4
2.4k
Unicorns run on AWS
mats16
0
200
AWS Startup tech Meetup Online 6
mats16
0
930
シードスタートアップに知っておいてほしいこと / What seed startups need to know
mats16
0
320
Introduction to AWS App Runner
mats16
0
950
Other Decks in Technology
See All in Technology
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.1k
ExaDB-D dbaascli で出来ること
oracle4engineer
PRO
0
3.8k
データプロダクトの定義からはじめる、データコントラクト駆動なデータ基盤
chanyou0311
2
310
【Startup CTO of the Year 2024 / Audience Award】アセンド取締役CTO 丹羽健
niwatakeru
0
1k
AWS Media Services 最新サービスアップデート 2024
eijikominami
0
200
Why does continuous profiling matter to developers? #appdevelopercon
salaboy
0
190
スクラム成熟度セルフチェックツールを作って得た学びとその活用法
coincheck_recruit
1
140
複雑なState管理からの脱却
sansantech
PRO
1
140
個人でもIAM Identity Centerを使おう!(アクセス管理編)
ryder472
3
200
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
110
マルチモーダル / AI Agent / LLMOps 3つの技術トレンドで理解するLLMの今後の展望
hirosatogamo
37
12k
VideoMamba: State Space Model for Efficient Video Understanding
chou500
0
190
Featured
See All Featured
A designer walks into a library…
pauljervisheath
204
24k
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
Become a Pro
speakerdeck
PRO
25
5k
Code Reviewing Like a Champion
maltzj
520
39k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Writing Fast Ruby
sferik
627
61k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Designing for humans not robots
tammielis
250
25k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
93
16k
Ruby is Unlike a Banana
tanoku
97
11k
We Have a Design System, Now What?
morganepeng
50
7.2k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Transcript
Amazon Web Searvice Ͱ࣮ݱ͢Δ elasticsearchͷେنӡ༻ × גࣜձࣾΠϯςΟϝʔτɾϚʔδϟʔɹদాथ
ࣗݾհ দా थ גࣜձࣾΠϯςΟϝʔτɾϚʔδϟʔʢࣾһ໊̕ʣ ։ൃຊ෦ • ύϒϦοΫDMPʮAudienceSearchʯͷ։ൃ • ओʹΠϯϑϥपΓΛ୲
ΞδΣϯμ • IMʹ͓͚ΔelasticsearchͷΘΕํ • elasticsearchͷߏ • ߏͷܾΊํ • AutoScalingͷϙΠϯτ •
ͦͷଞઃఆͷϙΠϯτ
elasticsearchͷΘΕํ ̐ԯͷϢχʔΫIDʹର༷ͯ͠ʑͳଐੑใΛ༩ • Ӿཡཤྺʹجͮ͘Ωʔϫʔυ • ֤ϝσΟΞΑΓఏڙ͞ΕΔηάϝϯτ • User Agent •
ΞΫηεݩIPʹجͮ͘ॅॴاۀใ ҙͷ݅ͰIDΛߜΓࠐΉͨΊʹɺɹɹɹɹɹɹɹɹɹɹɹɹΛ ར༻͍ͯ͠·͢ɻ
AudienceSearchʹ͍ͭͯ ϝσΟΞདྷ๚ऀ ωοτϦαʔν ࠂ৴πʔϧ ˞ɹਤҰྫͰ͢ ཱྀߦʹڵຯ ऩສ ԣࢢॴ
ঁੑ
શମߏ • શͯAWSڥ • Cluster: 1, Type: 1, Node: 86
• master: 3 (master:true, data: false) • data: 80 (master:false, data:true) • searcher: 2 (master:false, data: false) • indexer: 1 (master:false, data: false)ɹ˞όονॲཧ • version: 1.3.8 → 1.5.2 (5/26Ξοϓσʔτ)
શମߏ master data searcher x2 indexer indexerҎ֎ɺશAutoScalingͰӡ༻ x3 x80 ELB
ߏܾఆʹ͍ͭͯ
Cluster Size • Shard = Node ʹݻఆͯ͠ݕূ • 10 ʙ
200 ͱΛมߋ͠ɺԠ࣌ؒΛൺֱ • ʙ100Ґ·ͰʹԠͯ͡ύϑΥʔϚϯε্͕ • 200نͰAggregationͷύϑΥʔϚϯε͕ྼԽ →ɹूܭ݁ՌͷϚʔδίετͷ૿Ճʁ • σʔλ༰ྔΛՃຯ͠ɺ80Ͱελʔτ
Shard • Node = 80 ʹݻఆͯ͠ݕূʢc3.largeʣ (1) shard: 40, replica:
1 ʢshard/node = 0.5ʣ (2) shard: 80, reprica: 1 ʢshard/node = 1ʣ (3) shard: 160, replica:1 ʢshard/node = 2ʣ • shard/node ͕̍Λ͑Δͱܹ͘͠ύϑΥʔϚϯε͕ྼԽ ※ shard/nodeͰͳ͘ɺshard/cpuͷํ͕ॏཁ͔͠Εͳ͍ɾɾ
Instance Size • ΠϯσΫγϯάߴԽͷͨΊɺϩʔΧϧSSDͷੑೳΛॏࢹ →ɹEphemeral DiskΛ̎ͭੵΊΔc3ϑΝϛϦʔ͔Βબ • σʔλྔ͕ଟ͍߹xlargeҎ্ͷํ͕CPʹ༏ΕΔ →ɹجຊతʹՁ͕֨ഒʹͳΔͱɺ༰ྔഒʹͳΔ͕ɺ ɹɹlarge→xlargeͷ࣌ͷΈ30GB→80GB
• JVMͷϝϞϦͷׂྔશମͷ̎ʙׂ̏ʢdoc_valueʣ
AutoScallingͷϙΠϯτ
Why AutoScaling ? AutoScaling͍ͤͯ͞Δཧ༝ • ̍̌̌نͷαʔόΛ̍̍ཧͯ͠ӡ༻͢Δ͜ͱ͕ɺ ਓతʹݫ͔ͬͨ͠ • terminate͢Εݩͷڥ͕࠶ݱՄೳ •
εϙοτΠϯελϯε͕ར༻ՄೳʹͳΔ • ύϥϝʔλΛ͍͡Δ͚ͩͰεέʔϧΞτՄೳ
recoveryͷνϡʔχϯά • LifeCycleʹΑΓఆظతʹΠϯελϯε͕ೖΕସΘΔ͜ͱ͕͋Δ • ଳҬಉ࣌ҠಈՄೳͳγϟʔυΛௐ͠ɺrecoveryʹ͔͔Δ ࣌ؒΛॖ͍ͯ͠Δ • ϨϓϦΧ̍Ͱӡ༻ʢ0ͰΔͱ࣌ʑσʔλ͕ແ͘ͳΓ·͢ʣ indices: recovery:
max_bytes_per_sec: 500mb concurrent_streams: 4
recoveryͷνϡʔχϯά • LifeCycleʹΑΓՃ͞ΕͨΠϯελϯεͷෛՙ • σʔλྔ: 40GB Ͱ10ఔʢc3.xlargeʣ
ΫϥελϦϯάͷߴԽ • elasticsearch-cloud-awsϓϥάΠϯΛར༻ • λάࢦఆͰdiscoveryΛߦ͍ɺmaster nodeʹͷΈλάΛઃఆ͢Δ • SGࢦఆͰର͕ଟ͕͔͔͗ͯ࣌ؒ͢Δ discovery: type:
ec2 ec2: tag: es_cluster: production
ΫϥελϦϯάͷߴԽ • master nodeͷΦʔτεέʔϧͷઃఆ࣌ʹλάΛࢦఆ • ʮaws:autoscaling:groupNameʯλάར༻Մೳʁ
ELBʹΑΔࢹ • ݕࡧΛड͚ͳ͍ϊʔυʹؔͯ͠ɺࢮ׆ࢹ༻ʹELBͱͷ ඥ͚Λઃఆʢmaster, dataʣ • ࢹର9200൪ϙʔτʢ9300ͷํ͕͍͍͔ʣ
ͦͷଞͷϙΠϯτ
Խ • Multi-AZߏͰߏஙʢ˞3ڌҎ্ͷ߹ෆ໌ʣ • ԼهઃఆͰɺࣗϊʔυͷอ࣋͢ΔshardͷreplicaΛɺҟͳΔAZ ͷϊʔυ্ʹஔ͢Δ cluster: routing: allocation: awareness:
attributes: aws_availability_zone
Խ • ”aws_availability_zone”ʹࣗϊʔυͷஔ͞Ε͍ͯΔAZ͕ύϥ ϝʔλͱͯ͠༩͑ΒΕΔʢelasticsearch-cloud-awsʣ • Ұɺյͨ͠ࡍແࣄͰͨ͠ { "attributes" : {
"aws_availability_zone" : "ap-northeast-1c", "master" : "false" } }
ϊʔυ໊Λhostnameʹ͢Δ • ࣗಈͰઃఆ͞ΕΔhostname(ip-10-0-0-1)ʹɺES্ͷϊʔυ໊Λ ߹ΘͤΔ • ΕͯAMIʹݻΊͨΓ͢Δͱɺશϊʔυಉ໊͡લʹɾɾ node: name: ${HOSTNAME} export
HOSTNAME=$(hostname -s) /etc/sysconfig/elasticsearch /etc/elasticsearch/elasticsearch.yml
ࢹ ࢹͷ̏ຊபʢΦʔτεέʔϧͱͷ૬ੑॏࢹʣ • ELBͷϔϧενΣοΫ • MackerelʢϦιʔεɾϓϩηεࢹʣ • Papertrailʢϩάࢹʣ • ʢىಈ/ఀࢭ࣌ͷSlackͷwebhookʣ
ʢࢀߟʣPapertrail master data searcher x2 x3 x80 αʔόʹSSHෆཁͰɺରͷϩάΛtailՄೳ syslog
·ͱΊ • εέʔϧΞτͷ͠қ͞ͰɺAWSͱES૬ੑ͕ྑ͍ • ઃఆ࣍ୈͰ͋Δ͕ɺAutoScallingຊ൪Ͱͷӡ༻ʹ͑͏Δ • Cluster SizeҰఆҎ্͕ඞཁ • ϊʔυͷೖΕସΘΓΛߟྀ͢Δ͜ͱ͕ඞཁ
• 1ͭͷindex͕ԯ݅ϨϕϧͰ͋ͬͯɺelasticsearch࣮༻ʹ ͑ΒΕΔ
ΤϯδχΞืू ࠷৽ͷٕज़ʹڵຯͷ͋Δ৽ϝϯόʔΛืूதͰ͢ʂ ࠾༻ٕज़ ։ൃج൫
͋Γ͕ͱ͏͍͟͝·ͨ͠