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
glusterfs-pmux
Search
maebashi
November 13, 2013
Technology
2
390
glusterfs-pmux
GlusterFSを利用した軽量MapReduceフレームワークpmux
2013/11/13 Gluster Cloud Night 発表資料
(於 レッドハット株式会社)
maebashi
November 13, 2013
Tweet
Share
More Decks by maebashi
See All by maebashi
docker-metrics-grafana
maebashi
2
840k
monitoring-tool-gri
maebashi
1
400
glusterfs-pmux-en
maebashi
0
32
pmux
maebashi
0
41
Other Decks in Technology
See All in Technology
オブザーバビリティの Primary Signals
onk
PRO
0
550
強みを伸ばすキャリアデザイン
yug1224
0
200
SIEMを用いて、セキュリティログ分析の可視化と分析を実現し、PDCAサイクルを回してみた
coconala_engineer
0
220
プロデザ! BY リクルート vol.18_リクルートのリサーチ実践組織「リサーチブーストコミュニティ」
recruitengineers
PRO
3
240
NgRx Signal Store
rainerhahnekamp
0
110
長期間TiDBを使ってきた話 @ 私たちはなぜNewSQLを使うのかTiDB選定5社が語る選定理由と活用LT / Experiences with TiDB Over Time
chibiegg
2
700
AIQ株式会社 エンジニア向け会社紹介資料
aiqlab
0
370
The CloudCompare project by Dr. Daniel Girardeau-Montaut
kentaitakura
0
510
HEXA OSINT CTF V3 作戦会議
meow_noisy
0
110
Aurora MySQL v3(MySQL8.0互換)の オンラインDDLの罠挙動を全バージョンで検証した
yutakikai
1
150
o11y入門_外形監視を利用したWebアプリケーションへの最適なモニタリング_TechBrew
k5k
3
100
SREとその組織類型
tatsuo48
8
1.5k
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
24
5.8k
Facilitating Awesome Meetings
lara
41
5.6k
Pencils Down: Stop Designing & Start Developing
hursman
117
11k
GitHub's CSS Performance
jonrohan
1023
450k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
1
3.4k
Automating Front-end Workflow
addyosmani
1355
200k
Web development in the modern age
philhawksworth
202
10k
Teambox: Starting and Learning
jrom
128
8.4k
How GitHub (no longer) Works
holman
304
140k
Bootstrapping a Software Product
garrettdimon
PRO
301
110k
Product Roadmaps are Hard
iamctodd
43
9.7k
Making the Leap to Tech Lead
cromwellryan
123
8.5k
Transcript
©ɹ2013 Internet Initiative Japan Inc. ©ɹ2013 Internet Initiative Japan Inc.
GlusterFSΛར༻ͨ͠ ܰྔMapReduceϑϨʔϜϫʔΫ Pmux גࣜձࣾΠϯλʔωοτΠχγΞςΟϒ
[email protected]
©ɹ2013 Internet Initiative Japan Inc. ࣗݾհ • લڮ(Takahiro Maebashi) •
גࣜձࣾΠϯλʔωοτΠχγΞςΟϒ(IIJ) • ITpro: ITݕূϥϘ -- ࢄϑΝΠϧγεςϜͷ GlusterFSɿ͜Μͳͱ͖ɺͲ͏ͳΔ – http://itpro.nikkeibp.co.jp/ article/COLUMN/20130104/447701/!
©ɹ2013 Internet Initiative Japan Inc. GlusterFS @ IIJ Tokyo Osaka
Matsue
©ɹ2013 Internet Initiative Japan Inc. ίϯςφϢχοτʮIZmoʯ (Matsue Data Center Park)
IT module air-conditioning unit
©ɹ2013 Internet Initiative Japan Inc. GlusterFS servers in IZmo •
ϥοΫ͕ࣼΊʹஔ͞Ε͍ͯΔ
©ɹ2013 Internet Initiative Japan Inc. Today's Talk
©ɹ2013 Internet Initiative Japan Inc. glusterfs-hadoop
©ɹ2013 Internet Initiative Japan Inc. What is MapReduce? MapͱReduceͷ2ஈ֊Ͱࢄॲཧ (1)
Map – நग़ɺม (2) Reduce – ूɺूܭ
©ɹ2013 Internet Initiative Japan Inc. What is GlusterFS?
©ɹ2013 Internet Initiative Japan Inc. What is GlusterFS? (2) (ྫ:
distributed volume ͷ߹) ϑΝΠϧ୯ҐͰɺϑΝΠϧ໊ʹԠͯ͡ࢄ
©ɹ2013 Internet Initiative Japan Inc. What is pmux? (1) •
pipeline multiplexer ʹ༝དྷ • RubyͰهड़͞Ε͍ͯΔ • https://github.com/iij/pmux! • https://forge.gluster.org/pmux!
©ɹ2013 Internet Initiative Japan Inc. What is pmux? (2) •
ϑΝΠϧϕʔεͷ map/reduce πʔϧ • Unix ͷඪ४ೖྗ/ग़ྗΛΠϯλϑΣʔεͱͯ͠ ͏ $ pmux --mapper="grep PATTERN" *.log Example: ࢄgrep GlusterFS্ͷϑΝΠϧ
©ɹ2013 Internet Initiative Japan Inc. What is pmux? (3)
©ɹ2013 Internet Initiative Japan Inc. Install $ gem install pmux
$ gem install pmux $ gem install gflocator $ sudo gflocator
©ɹ2013 Internet Initiative Japan Inc. Execution Overview (1) MapReduceɺreduce phaseͳ͠ͷ߹
©ɹ2013 Internet Initiative Japan Inc. 1. ରͱ͢ΔϑΝΠϧ܈Λ୳͢ pmux ίϚϯυ͜ͷϗετ Ͱ࣮ߦ͢Δ
USVTUFEHMVTUFSGTQBUIJOGP ΛಡΈग़͢
©ɹ2013 Internet Initiative Japan Inc. ֦ுϑΝΠϧଐੑ(xattr) • ϝλσʔλΛϢʔβ͕ϑΝΠϧʹ݁ͼ͚ͭΔ͜ ͱ͕ग़དྷΔΑ͏ʹ͢ΔϑΝΠϧγεςϜͷػ ೳ
(wikipedia) • GlusterFS ɺ֦ுϑΝΠϧଐੑΛ֎෦ͱΓ ͱΓ͢ΔͨΊͷΈͱͯ͠͏
©ɹ2013 Internet Initiative Japan Inc. ֦ுϑΝΠϧଐੑ (2) $ sudo getfattr
-n trusted.glusterfs.pathinfo \! access_log.20131020! # file: access_log.20131020! trusted.glusterfs.pathinfo="(<DISTRIBUTE:d2r2-! dht> (<REPLICATE:d2r2-replicate-0> <POSIX(/glu! sterfs/brick/d2r2):ex01.example.com:/glusterfs! /brick/d2r2/log/0000/access_log.20131020> <POS! IX(/glusterfs/brick/d2r2):ex00.example.com:/gl! usterfs/brick/d2r2/log/0000/access_log.2013102! 0>))"
©ɹ2013 Internet Initiative Japan Inc. ֦ுϑΝΠϧଐੑ (3) (glusterfs-hadoop GlusterFSXattr.java)
©ɹ2013 Internet Initiative Japan Inc. 2. ֤ϊʔυͰpmuxΛىಈ dispatcher worker
©ɹ2013 Internet Initiative Japan Inc. 3. map tasks Λ֤ϊʔυʹׂΓͯ tasks
are assigned to nodes(workers) dynamically dispatcher worker
©ɹ2013 Internet Initiative Japan Inc. 4. popen (map task ࣮ߦ)
dispatcher worker
©ɹ2013 Internet Initiative Japan Inc. 5. ݁ՌΛ dispatcher ʹฦ͢ dispatcher
worker
©ɹ2013 Internet Initiative Japan Inc. Execution Overview (2) reduce phase
͕͋Δ߹
©ɹ2013 Internet Initiative Japan Inc. 4. popen (map task ࣮ߦ)
dispatcher worker
©ɹ2013 Internet Initiative Japan Inc. 5. mapper ͕Ұ࣌ϑΝΠϧੜ mapperதؒ݁ՌΛؚΜͩҰ࣌ϑΝΠϧΛੜ dispatcher
worker
©ɹ2013 Internet Initiative Japan Inc. 6. shuffle dispatcher worker
©ɹ2013 Internet Initiative Japan Inc. 7. reduce tasks ΛϊʔυʹׂΓͯ dispatcher
worker
©ɹ2013 Internet Initiative Japan Inc. 8. dispatcher ʹ݁ՌΛฦ͢ dispatcher worker
©ɹ2013 Internet Initiative Japan Inc. example(1): εςʔλείʔυΛ͑Δ Apache log ͷHTTPεςʔλείʔυͷग़ݱΛ͑Δ
$ pmux --mapper='cut -d" " -f 9’ \ --reducer='sort|uniq -c’ /mnt/glusterfs/*.log 176331 200 106360 206 809 400 21852 403 533 404 27 406 805 416 25 500
©ɹ2013 Internet Initiative Japan Inc. example(2): word count $ pmux
--mapper=map.rb --reducer=reduce.rb \ --file=map.rb –-file=reduce.rb \ /mnt/glusterfs/*.txt #! /usr/bin/ruby -an $F.each {|f| print "#{f}\t1\n"} #! /usr/bin/ruby -an BEGIN {$c = Hash.new 0} $c[$F[0]] += $F[1].to_i END {$c.each {|k, v| print "#{k} #{v}\n"}} map.rb reduce.rb command line
©ɹ2013 Internet Initiative Japan Inc. ੑೳ 14:00:00.416011 IP 21.44.60.29.http >
170.73.162.175.58546: . 3523999974:3524001422(1448) ack 3401170238 win 1716 <nop,nop,timestamp 1070614671 1955062367> ҎԼͷΑ͏ͳύέοτΩϟϓνϟϩά (by tcpdump) ֤ϑΝΠϧͰ࠷ग़ݱͷଟ͍IPΞυϨεΛநग़͢Δ 8344 files, 500K lines/file, total 4 billion lines
©ɹ2013 Internet Initiative Japan Inc. map ίϚϯυ --mapper='egrep –o "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"|
sort|uniq -c|sort -nr|head -1'
©ɹ2013 Internet Initiative Japan Inc. ݁Ռ 8 hr 49 min
6 sec 1 node, without pmux
©ɹ2013 Internet Initiative Japan Inc. ݁Ռ 8 hr 49 min
6 sec 1 min 45 sec 300ഒ! 1 node, without pmux 60 nodes (֤ϊʔυ8ίΞ)