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

niconicoの検索を支えるElasticsearch / niconico Elastic...

shoito
November 18, 2014

niconicoの検索を支えるElasticsearch / niconico Elasticsearch

niconicoでのElasticsearch運用事例的なお話。
第7回elasticsearch勉強会 #elasticsearch #elasticsearchjp elasticsearch.doorkeeper.jp/events/16837

報告ブログ記事
http://ch.nicovideo.jp/dwango-engineer/blomaga/ar674946

運用事例や構成/設定などの情報を参考に伺いたいので @shoito / fb:shoito に是非お声かけを。

shoito

November 18, 2014
Tweet

More Decks by shoito

Other Decks in Technology

Transcript

  1. ݕࡧର৅͸Կ͔ʁ ⿣OJDPOJDPͷίϯςϯπ ˞ݱࡏ͸ݕࡧ݁ՌʹදࣔͰ͖Δίϯςϯπ͚ͩ  ⿣χίχίಈը໿   ⿣χίχίੜ์ૹ໿  ⿣χίχί੩ը໿

      ⿣χίχίνϟϯωϧ χίχίχϡʔε  ⿣ ·ͩ·ͩର৅͸૿͑Δ ˞ΠϕϯτͷൃੜຖʹΠϯσοΫεߋ৽
  2. ΞʔΩςΫνϟ ͍ͩͿϥϑʹ RabbitMQ Cluster MySQL Master/Slave Elasticsearch Cluster Indexer &


    Converter API front MessageReceiver niconico
 services niconico
 services ࢀরܥ ߋ৽ܥ Op module ids query contents on-premises
  3. ϊʔυΠϯσοΫεઃܭ ⿣ ϊʔυͷϩʔϧ෼͚ͳ͠ OPEFNBTUFS OPEFEBUBUSVF 
 
 
 
 ⿣

    αʔϏεΠϯσοΫελΠϓ ϨϓϦΧ ˞Ϛοϐϯάมߋɺ3FJOEFYͳͲͷϝϯςΛαʔϏεຖʹͰ͖ΔΑ͏ʹ Ϋϥελ ϊʔυ ΠϯσοΫε λΠϓ
  4. NBQQJOHT\ JUFN\  ུ  QSPQFSUJFT\ UJUMF\ UZQFTUSJOH  JOEFY@BOBMZ[FSJOEFYJOH"OBMZ[FS

      ུ  ^  EFTDSJQUJPO\^ WJFX@DPVOU\ UZQFJOUFHFS ^  NZMJTU@DPVOU\^  VQMPBE@UJNF\^  DPNNVOJUZ@JE\^ ϊʔυΠϯσοΫεઃܭ ⿣ Ϛοϐϯά͸ϑϥοτ ✤ χίχίಈը WJEFP  ✤ UJUMF ✤ EFTDSJQUJPO ✤ WJFX@DPVOU ✤ NZMJTU@DPVOU ✤ VQMPBE@UJNF ✤ DPNNVOJUZ@JE ✤  ✤ χίχίੜ์ૹ MJWF  ✤ UJUMF ✤ EFTDSJQUJPO ✤ WJFX@DPVOU ✤ DPNNFOU@DPVOU ✤ DPNNVOJUZ@MFWFM ✤ DPNNVOJUZ@JE ✤ 
  5. ϊʔυΠϯσοΫεઃܭ ⿣ ΤΠϦΞεΛશΠϯσοΫεͰར༻ WJEFP@ WJEFP WJEFP@ WJEFP WJEFP@ ϝϯςલ ϝϯςޙ

    WJEFP@ WJEFP WJEFP@ ϝϯςத reindex
 (number_of_replicas͸0ʹɺ
 optimizeޙɺ0͔Β1ʹ͢Δ) Close
  6. Create { "timestamp": 1415850040, "cudtype": "create", "issuer": "publisher", "service_name": "video",

    "cmsid": "sm9", "values": { "user_id": 1234567, "title": "৽ɾ߽݂ࣉҰ଒ -൥೰ղ์ - Ϩοπΰʔʂӄཅࢣ", "description": “Ϩοπΰʔʂӄཅࢣʢϑϧίʔϥεόʔδϣϯʣ”, "comment_count": 0, “…”, // লུ - શϑΟʔϧυσʔλ͕ૹΒΕΔ "tags": “ӄཅࢣ ެࣜ …” } }
  7. CUD CUD CUD CUD CUD CUD CUD CUD CUD χίಈ

    χίੜ etc. MessageReceiver RabbitMQ CUD CUD CUD CUD CUD CUD CUD Elasticsearch MySQL Indexer & Converter αʔϏεڥք MessageReceiver MessageReceiver
  8. &MBTUJDTFBSDIΫϥελͷ੒௕ 2012 2013 2014 WΫϥελߏங WҠߦ 2015 WҠߦ ϊʔυ਺✖️ WҠߦ

    ϊʔυ਺✖️ WYҠߦ ϊʔυ਺✖️ʁ ˞ΫϥελSFTUBSUʹΑΔ
 ɹఀࢭϝϯς ˞3PMMJOHSFTUBSUʹΑΔ
 ɹແఀࢭϝϯς ˞ΫϥελίϐʔεΠον
 ɹʹΑΔແఀࢭϝϯς ˞3PMMJOHSFTUBSUʹΑΔϝϯς༧ఆ
  9. ͜Ε·Ͱૺ۰ͨ͠τϥϒϧ ⿣ 4QSJUCSBJO໰୊ ˞NJOJNVN@NBTUFS@OPEFTઃఆࡁΈ  ⿣ ϚελϊʔυͰͷ'VMM($ʹΑΔQJOHUJNFPVU ⿣ ϚελϊʔυͷSFTUBSUͱγϟʔυͷSFSPVUFͰճ෮ 01

    02 03 04 05 06 01 03 04 05 06 02 03 04 05 06 Ϋϥελ ϊʔυ Ϛελʔϊʔυ cluster_v1 cluster_v1 cluster_v1 ϊʔυ01͔ΒݟͨΫϥελ ϊʔυ02͔ΒݟͨΫϥελ ਖ਼ৗঢ়ଶͷΫϥελ
  10. ͜Ε·Ͱૺ۰ͨ͠τϥϒϧ ⿣ ૝ఆ֎ͷΠϯσοΫεEZOBNJDDSFBUJPOPGNBQQJOHT ⿣ ஌Β͵ؒʹҙਤ͍ͯ͠ͳ͍ΠϯσοΫε͕࡞ΒΕͯ͠·͍ͬͯͨ ⿣ BDUJPOBVUP@DSFBUF@JOEFYGBMTF ⿣ JOEFYNBQQFSEZOBNJDGBMTF ⿣

    ૝ఆ֎ͷϑΟʔϧυEZOBNJDDSFBUJPOPGpFMET ⿣ ϑΟʔϧυ௥Ճ͸Ͱ͖Δ͚Ͳফͤͳ͍ ⿣ ҙਤ͍ͯ͠ͳ͍ϑΟʔϧυΛؚΉ+40/Λ์ΓࠐΜͩ͜ͱ͕ݪҼ ⿣ EZOBNJDTUSJDU ⿣ JOEFYRVFSZQBSTFBMMPX@VONBQQFE@pFMETUSVFGBMTF  ʹ͠ͱ͘ͱ ͞Βʹྑ͍͔΋
  11. ෛՙܭଌνϡʔχϯά ⿣ ෛՙܭଌπʔϧ(BUMJOH +.FUFS
 IUUQTHJUIVCDPNFMBTUJDTFBSDIFMBTUJDTFBSDIU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