Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Riak 2.0における全文検索 と整合性の問題

UENISHI Kota
November 19, 2014

Riak 2.0における全文検索 と整合性の問題

WebDB Forum 2014 のBashoジャパンの発表スライドです

UENISHI Kota

November 19, 2014
Tweet

More Decks by UENISHI Kota

Other Decks in Technology

Transcript

  1. CAP Theorem • C: ෳ਺ͷAtomic Objectʹର͢Δ࿈ ଓͨ͠ૢ࡞ (w1, w3, w4,

    ….) ͕શ ͯಉҰͰ͋Δ͜ͱ (linearizable) • A: Atomic Objectʹૢ࡞ w1, w2, …Λ࣮ߦͰ͖Δ͜ͱ • P: ωοτϫʔΫ͕੾ΕΔͱAtomic Object΁ͷϝοηʔδ͕౸ୡ͠ͳ͍
  2. run Riak with Search $ which java $ sudo apt-get

    install riak $ echo “search = on” >> /etc/riak/riak.conf $ riak start $ riak-admin bucket-type create tt $ riak-admin bucket-type activate tt $ curl -XPUT http://localhost:8098/search/index/t $ curl -XPUT -H ‘content-type: application/json’ \ http://localhost:8098/types/tt/props \ -d ‘{“props”:{“search_index”:”t”}}’
  3. Consistent Hashing • 160-bit Ωʔۭؒ • ۭؒΛ౳෼͢Δ • ύʔςΟγϣϯ͸ϊʔ υ͕ݸผ؅ཧ

    • ϨϓϦΧ͸Nݸͷύʔ ςΟγϣϯʹίϐʔ͞ ΕΔ OPEF OPEF OPEF OPEF hash(“meetups/spamham”) N=3
  4. σʔλϕʔεͷݕࡧ • DB૊ࠐܕ • groongaͳͲ • “LIKE” • Pros •

    ੔߹ੑΛҡ࣋͠΍͍͢ • Cons • ີ݁߹ʹͳΔ • ֎෦࿈ܞܕ • Solr • Elasticsearch • Pros • ૄ݁߹ʹͰ͖Δ • Cons • ੔߹ੑΛҡ࣋͠ʹ͍͘
  5. Active Anti Entropy • APࢦ޲ͷDBͷσʔλྼԽΛ๷͙ ͨΊͷόοΫάϥ΢ϯυॲཧ • Merkle-TreeΛ࢖ͬͯύʔςΟγϣ ϯຖͷʮνΣοΫαϜʯΛܭࢉ •

    ࠩ෼Λݟ͚ͭͨΒͦ͜ΛRead Repair͢Δ hash(vnode=0, pid=0) hash(vnode=1, pid=0) hash(vnode=2, pid=0)
  6. YZ Active Anti Entropy • ݕࡧΠϯσοΫεʹ͍ͭͯ΋ Merkle TreeΛ࡞੒ • ύʔςΟγϣϯຖʹKey-Valueͷ

    Treeͱൺֱ͠ɺ͕ࠩ͋Ε͹Πϯ σοΫεΛमਖ਼ hash(vnode=0, pid=0, kv) hash(vnode=0, pid=0, yz)
  7. ·ͱΊ • σʔλϕʔεͱશจݕࡧͷ໰୊ • ੔߹ੑΛͱΔ͔ɺૄ݁߹ΛͱΔ͔ͷ໰୊ • ৽͍͠Riak Search 2.0 •

    ਫฏ෼ࢄͯ͠εέʔϧΞ΢τͰ͖Δݕࡧ • ݁Ռ੔߹ੑΛબͿ͜ͱʹΑΓૄ݁߹Խͱ෼ࢄԽ ʹ੒ޭʢ͔͠΋APܕʹʂʣ • ݁Ռ੔߹ੑΛબ୒ͨ͠ઃܭʹΑΓӡ༻͕؆୯ʹ
  8. outline • σʔλϕʔεʹೖ͍ͬͯΔσʔλΛશจݕࡧ͍ͨ͠→୔ࢁͷΠϯσοΫε͕Ͱ͖ΔɺFKeyͰ ΠϯσοΫε…ͱ͍͏͚ͩͰ͸ • શจݕࡧΤϯδϯͷछྨ • ֎෦ܕʢ੔߹ੑΛҡ࣋͠ʹ͍͕͘Ԡ༻͕ޮ͘ɺރΕͨιϑτ΢ΣΞ΍ϓϥάΠϯ͕ଟ͍ʣ • ૊ΈࠐΈܕʢ੔߹ੑΛҡ࣋͠΍͍͕͢ɺϝϯςφϯε͕೉͍͠ʣ

    • Riak͸ͦͷதؒɹόϯυϧͯ͠ΔͷͰָɺ͚ͩͲ࣮ମ͸Solrɺ੔߹ੑΛࣗಈతʹҡ࣋͢Δ • όϯυϧͷํ๏ɺ੔߹ੑɺ෼ࢄͷํ๏ • ݕࡧΠϯσοΫε͚ͩΛ෼ࢄͤ͞Δͷ͸೉͍͠ • DBͱΠϯσοΫεͷ੔߹ɺϨϓϦΧͱϨϓϦΧͷ੔߹ɺJepsenͷ͸ͳ͠