ubuntu 14.14上的mongo-connector错误

时间:2016-06-01 21:46:44

标签: mongodb ubuntu elasticsearch pymongo

mongoconnector以前曾经工作过,但现在却没有。以下是错误的很长一段时间的一部分:

...
   return f(*args, **kwargs)
  File "/home/ubuntu/anaconda/lib/python2.7/site-packages/mongo_connector/doc_managers/elastic2_doc_manager.py", line 203, in bulk_upsert
    for ok, resp in responses:
  File "/home/ubuntu/anaconda/lib/python2.7/site-packages/elasticsearch/helpers/__init__.py", line 160, in streaming_bulk
    for result in _process_bulk_chunk(client, bulk_actions, raise_on_exception, raise_on_error, **kwargs):
  File "/home/ubuntu/anaconda/lib/python2.7/site-packages/elasticsearch/helpers/__init__.py", line 132, in _process_bulk_chunk
    raise BulkIndexError('%i document(s) failed to index.' % len(errors), errors)
BulkIndexError: (u'86 document(s) failed to index.', [{u'index': {u'status': 400, u'_type': u'wikis', u'_id': u'574f3f9253a18f8397ecc13a', u'error': {u'caused_by': {u'reason': u'Cannot parse "+1960-00-00T00:00:00Z": Value 0 for monthOfYear must be in the range [1,12]', u'type': u'illegal_field_value_exception'}, u'reason': u'failed to parse [claims.P1082.qualifiers.P585.datavalue.value.time]', u'type': u'mapper_parsing_exception'}, u'_index': u'test1'}}, 
...
2016-06-01 21:32:55,806 [ERROR] mongo_connector.oplog_manager:557 - OplogThread: Failed during dump collection cannot recover! Collection(Database(MongoClient('localhost', 27017), u'local'), u'oplog.rs')
2016-06-01 21:32:56,618 [ERROR] mongo_connector.connector:302 - MongoConnector: OplogThread <OplogThread(Thread-6, started 139915396376320)> unexpectedly stopped! Shutting down

在外面启动MongoDB:

$ mongod --dbpath data --replSet&#34; rs0&#34; #create replica set on port 27017

$ mongo #initiate replica set

在mongo repl中,我输入:

  

rs.initiate({&#34; _id&#34;:&#34; rs0&#34;,&#34;版本&#34;:1,&#34;会员&#34;:[{&# 34; _id&#34;:0,&#34; host&#34;:&#34; localhost:27017&#34;}]})

Elasticsearch已在端口9200上启动。

现在

$ mongo-connector -m localhost:27017 -t localhost:9200 -d elastic2_doc_manager

...然后我收到了错误。

1 个答案:

答案 0 :(得分:0)

基础错误看起来像

{u'reason': u'Cannot parse "+1960-00-00T00:00:00Z": Value 0 for monthOfYear must be in the range [1,12]', u'type': u'illegal_field_value_exception'}

这仅表示MongoDB中的某个文档的无效日期+1960-00-00T00:00:00Z包含无效的月份(00)和日期(00)。

您需要找到该记录并进行修复,之后复制将起作用,前提是您没有其他记录存在同样的问题。