Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

検索のダウンタイム0でバックアップからindexをリストアする方法

12 239 vues

Publié le

第6回Elasticsearch勉強会 資料

Publié dans : Ingénierie
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici

検索のダウンタイム0でバックアップからindexをリストアする方法

  1. 1. 株式会社ドワンゴモバイル 西田和史@kbigwheel
  2. 2. 前置き  撮影・情報共有自由  後日スライドはネット上で共有します
  3. 3. Snapshot & Restore API  Elasticsearch 1.0.0で追加された機能  バージョン1.0.0未満 ○ Indexをバックアップするためには クラスタの停止が必要  バージョン1.0.0以降 ○ Indexのバックアップが無停止で可能!
  4. 4. しかし、  バックアップからリストアするためには 対象のIndexを一旦削除もしくはcloseする 必要あり  普通に実行すると無停止でリストアするこ とはできない!  そこで本LTでは無停止でリストアするテクニッ クを紹介
  5. 5. 典型的シナリオ 1. 音楽サイトAでの検索結果が何かおかしい…  「嵐」で検索してジャニーズのグループがでな い!やばい! 2. Indexを今朝の状態に戻したいが、 普通にRestore APIを叩こうとすると 対象のIndexを一度closeする必要がある  一時的にまったく検索できなくなる なるべく避けたい
  6. 6. なんとか今の検索は動作させつつ、 バックグラウンドで リストア作業を行いたい!
  7. 7. Index Aliases機能とリストア時のリネー ムを組み合わせて無停止で復元しよう!  次の2つを組み合わせる 1. Index aliases - Indexへ別名を与える機能 ○ 例: インデックス“artist20140716” に対して エイリアス“artist” を付与 http://localhost:9200/artist20140716/artist/1234 http://localhost:9200/artist/artist/1234 1. リストアするindexをリネーム可能 全く等価 になる! このようにprefixや suffixをつけることが 可能!
  8. 8. 事前準備 1. indexは日付、versionなどのサフィックス をつけて作成  artist_20140716, product_v5 2. 各indexにサフィックスを削除した文字列で aliasを付与  artist_20140716 → artist, product_v5 → product 3. 検索は必ずalias名を通して実行 http://{{domain}}/artist_20140716/artist/_search?q=水樹奈々 http://{{domain}}/artist/artist/_search?q=水樹奈々
  9. 9. 障害時の対応手順(1/2) 1. リストアAPIでスナップショットを復元 $ curl -XPOST "localhost:9200/_snapshot/my_backup/full_20140716/_restore?pretty" -d '{ > "indices": “artist_20140716", > "ignore_unavailable": "true", > "include_global_state": false, > "rename_pattern": "artist_20140716", > "rename_replacement": “artist_20140716_restored“ > }‘ && curl -XPOST "localhost:9200/_aliases" -d '{ > "actions" : [ > { "remove" : { "index" : "artist_20140716_restored", "alias" : “artist" } } > ] > }' Indexをリネーム ポイント:リストアAPIはエイリアスも復 元してしまうので、即座に復元中のIndex に付いているエイリアスは削除する (これを忘れるとそのエイリアス経由で の検索がすべて500エラーになる) 2. Elasticsearch-Headなどで リストアしたIndexがGreenに なるまで待機
  10. 10. 障害時の対応手順(2/2) 3. リストア完了後、壊れたIndexと リストアしたIndexをスイッチする $ curl -XPOST "localhost:9200/_aliases" -d ' > { > "actions" : [ > { "remove" : { "index" : “artist_20140716", "alias" : “artist" } }, > { "add" : { "index" : "artist_20140716_restored", "alias" : “artist" } } > ] > }' 4. 動作確認後、不要であれば壊れたIndex を削除
  11. 11. 補足情報  バージョン1.3.0からaliasなしでの restoreが可能になった少しだけ手順が 楽になる $ curl -XPOST "localhost:9200/_snapshot/my_backup/full_20140716/_restore?pretty" -d '{ > "indices": “artist_20140716", > "ignore_unavailable": "true", > "include_global_state": false, > "rename_pattern": "artist_20140716", > "rename_replacement": “artist_20140716_restored“ > }‘ && curl -XPOST "localhost:9200/_aliases" -d '{ > "actions" : [ > { "remove" : { "index" : "artist_20140716_restored", "alias" : “artist" } } > ] > }' $ curl -XPOST "localhost:9200/_snapshot/my_backup/full_20140716/_restore?pretty" -d '{ > "indices": “artist_20140716", > "ignore_unavailable": "true", > "include_global_state": false, > "rename_pattern": "artist_20140716", > "rename_replacement": “artist_20140716_restored“, > “include_aliases": false > }‘

×