読者です 読者をやめる 読者になる 読者になる

エロサイトの作り方

2013年11月から勉強しながらエロサイトを作っています。

mongorestoreしたらElasticsearchで検索できなくなった件

MongoDB Elasticsearch

表題の通りですが、

$ mongorestore --drop ./backup/

とやったら、Elasticsearch側に以下のメッセージが出て検索できなくなってしまいました。

[2014-06-21 21:30:03,291][INFO ][org.elasticsearch.river.mongodb.Indexer] Ignore drop collection request [test], [pages]. The option has been disabled.
[2014-06-21 21:30:03,615][INFO ][org.elasticsearch.river.mongodb.Indexer] Ignore drop collection request [test], [pages]. The option has been disabled.
[2014-06-21 21:30:05,570][INFO ][org.elasticsearch.river.mongodb.Indexer] Ignore drop collection request [test], [pages]. The option has been disabled.
[2014-06-21 21:30:05,697][INFO ][org.elasticsearch.river.mongodb.Indexer] Ignore drop collection request [test], [pages]. The option has been disabled.
[2014-06-21 21:30:05,804][INFO ][org.elasticsearch.river.mongodb.Indexer] Ignore drop collection request [test], [pages]. The option has been disabled.
[2014-06-21 21:30:05,881][INFO ][org.elasticsearch.river.mongodb.Indexer] Ignore drop collection request [test], [pages]. The option has been disabled.
[2014-06-21 22:29:35,865][INFO ][org.elasticsearch.river.mongodb.Indexer] Ignore drop collection request [test], [pages]. The option has been disabled.
[2014-06-21 22:41:05,586][INFO ][org.elasticsearch.river.mongodb.Slurper] Cursor 25228887971249460 has been closed. About to open a new cusor.
[2014-06-21 22:41:05,723][WARN ][org.elasticsearch.river.mongodb.Slurper] Exception in slurper
org.elasticsearch.river.mongodb.Slurper$SlurperException: River out of sync with oplog.rs collection
    at org.elasticsearch.river.mongodb.Slurper.isRiverStale(Slurper.java:618)
    at org.elasticsearch.river.mongodb.Slurper.oplogCursor(Slurper.java:603)
    at org.elasticsearch.river.mongodb.Slurper.run(Slurper.java:119)
    at java.lang.Thread.run(Thread.java:722)

とりあえず再起動

$ elasticsearch
[2014-06-22 00:39:58,852][INFO ][node                     ] [Man-Elephant] version[1.1.1], pid[16976], build[f1585f0/2014-04-16T14:27:12Z]
[2014-06-22 00:39:58,853][INFO ][node                     ] [Man-Elephant] initializing ...
[2014-06-22 00:39:58,964][INFO ][plugins                  ] [Man-Elephant] loaded [marvel, analysis-kuromoji, mapper-attachments, mongodb-river], sites [marvel, inquisitor, river-mongodb]
[2014-06-22 00:40:02,145][INFO ][node                     ] [Man-Elephant] initialized
[2014-06-22 00:40:02,145][INFO ][node                     ] [Man-Elephant] starting ...
[2014-06-22 00:40:02,262][INFO ][transport                ] [Man-Elephant] bound_address {inet[/127.0.0.1:9300]}, publish_address {inet[/127.0.0.1:9300]}
[2014-06-22 00:40:05,319][INFO ][cluster.service          ] [Man-Elephant] new_master [Man-Elephant][nygrd9hlQ0uqi29-Iex5bw][Air.local][inet[/127.0.0.1:9300]], reason: zen-disco-join (elected_as_master)
[2014-06-22 00:40:05,356][INFO ][discovery                ] [Man-Elephant] elasticsearch_sandbox/nygrd9hlQ0uqi29-Iex5bw
[2014-06-22 00:40:05,420][INFO ][http                     ] [Man-Elephant] bound_address {inet[/127.0.0.1:9200]}, publish_address {inet[/127.0.0.1:9200]}
[2014-06-22 00:40:06,474][INFO ][gateway                  ] [Man-Elephant] recovered [13] indices into cluster_state
[2014-06-22 00:40:06,608][INFO ][river.mongodb            ] Parse river settings for mongodb
[2014-06-22 00:40:06,690][INFO ][org.elasticsearch.river.mongodb.MongoDBRiver] Starting river mongodb
[2014-06-22 00:40:07,354][INFO ][org.elasticsearch.river.mongodb.MongoDBRiver] MongoDB River Plugin - version[2.0.0] - hash[a0c23f1] - time[2014-02-23T20:40:05Z]
[2014-06-22 00:40:07,354][INFO ][org.elasticsearch.river.mongodb.MongoDBRiver] starting mongodb stream. options: secondaryreadpreference [false], drop_collection [false], include_collection [], throttlesize [5000], gridfs [false], filter [null], db [test], collection [pages], script [null], indexing to [test]/[pages]
[2014-06-22 00:40:07,910][INFO ][org.elasticsearch.river.mongodb.MongoDBRiver] MongoDB version - 2.4.10
[2014-06-22 00:40:08,120][WARN ][org.elasticsearch.river.mongodb.Slurper] Exception in slurper
org.elasticsearch.river.mongodb.Slurper$SlurperException: River out of sync with oplog.rs collection
    at org.elasticsearch.river.mongodb.Slurper.isRiverStale(Slurper.java:618)
    at org.elasticsearch.river.mongodb.Slurper.oplogCursor(Slurper.java:603)
    at org.elasticsearch.river.mongodb.Slurper.run(Slurper.java:119)
    at java.lang.Thread.run(Thread.java:722)
[2014-06-22 00:40:08,575][INFO ][node                     ] [Man-Elephant] started
[2014-06-22 00:40:12,761][INFO ][cluster.metadata         ] [Man-Elephant] [.marvel-2014.06.21] update_mapping [index_event] (dynamic)
[2014-06-22 00:40:12,772][INFO ][cluster.metadata         ] [Man-Elephant] [.marvel-2014.06.21] update_mapping [node_event] (dynamic)
[2014-06-22 00:40:12,776][INFO ][cluster.metadata         ] [Man-Elephant] [.marvel-2014.06.21] update_mapping [cluster_event] (dynamic)

メッセージは変わらず。

インデックスを登録し直す

$ curl -XDELETE 'http://localhost:9200/_river/mongodb/_riverstatus'
{"found":true,"_index":"_river","_type":"mongodb","_id":"_riverstatus","_version":8}

$ curl -XDELETE 'http://localhost:9200/_river/mongodb/_meta'
{"found":true,"_index":"_river","_type":"mongodb","_id":"_meta","_version":4}

$ curl -XDELETE 'http://localhost:9200/test/pages'
{"acknowledged":true}

登録時は1リクエストなのに、削除時は3リクエスト必要らしい。

$ curl -XPUT 'http://localhost:9200/_river/mongodb/_meta' -d '{
  "type": "mongodb",
  "mongodb": {
    "db": "test",
    "collection": "pages"
  },
  "index": {
    "name": "test",
    "type": "pages"
  }
}'
{"_index":"_river","_type":"mongodb","_id":"_meta","_version":3,"created":true}%
__my_preexec_end_timetrack:local:3: not valid in this context: "type":

再登録。実行したらCPUが本気出し始めた。

まだインデックス作っている途中だけど、結果も返ってくるから正常に稼働しているみたい。

ところで

__my_preexec_end_timetrack:local:3: not valid in this context: "type":

こんなメッセージ前も出てたかな?と思ってググったら自分の過去記事だけが出てきた。このメッセージが出てくるの世界中でうちだけとか途方に暮れる。