mongo-connector没有将数据从MongoDB同步到Solr

时间:2016-12-13 10:07:01

标签: mongodb solr pymongo pysolr

我需要将MongoDB的数据同步到Solr

当我发出命令

mongo-connector -m dbserver:27018 -n shop -t http://localhost:8983/solr/Search --auto-commit-interval=0 -d solr_doc_manager

错误日志是:

2016-12-13 15:21:40,461 [CRITICAL] mongo_connector.oplog_manager:630 - Exception during collection dump
Traceback (most recent call last):
  File "c:\program files (x86)\python35-32\lib\site-packages\mongo_connector\oplog_manager.py", line 583, in do_dump
    upsert_all(dm)
  File "c:\program files (x86)\python35-32\lib\site-packages\mongo_connector\oplog_manager.py", line 567, in upsert_all
    dm.bulk_upsert(docs_to_dump(namespace), mapped_ns, long_ts)
  File "c:\program files (x86)\python35-32\lib\site-packages\mongo_connector\util.py", line 32, in wrapped
    return f(*args, **kwargs)
  File "c:\program files (x86)\python35-32\lib\site-packages\mongo_connector\doc_managers\solr_doc_manager.py", line 288, in bulk_upsert
    batch = list(next(cleaned) for i in range(self.chunk_size))
  File "c:\program files (x86)\python35-32\lib\site-packages\mongo_connector\doc_managers\solr_doc_manager.py", line 288, in <genexpr>
    batch = list(next(cleaned) for i in range(self.chunk_size))
  File "c:\program files (x86)\python35-32\lib\site-packages\mongo_connector\doc_managers\solr_doc_manager.py", line 286, in <genexpr>
    cleaned = (self._clean_doc(d, namespace, timestamp) for d in docs)
  File "c:\program files (x86)\python35-32\lib\site-packages\mongo_connector\oplog_manager.py", line 509, in docs_to_dump
    database, coll = namespace.split('.', 1)
ValueError: not enough values to unpack (expected 2, got 1)
2016-12-13 15:21:40,464 [ERROR] mongo_connector.oplog_manager:638 - OplogThread: Failed during dump collection cannot recover! Collection(Database(MongoClient(host=['dbserver:27018'], document_class=dict, tz_aware=False, connect=True, replicaset='shop'), 'local'), 'oplog.rs')
2016-12-13 15:21:41,460 [ERROR] mongo_connector.connector:304 - MongoConnector: OplogThread <OplogThread(Thread-2, started 4972)> unexpectedly stopped! Shutting down

我不知道我错在哪里。请帮我解决这个问题。 谢谢。

1 个答案:

答案 0 :(得分:0)

来自-n参数的the documentation

  

从MongoDB读取的集合列表。集合名称应以database_name.collection_name

的形式给出

所以你错过了参数的database_namecollection_name,这取决于MongoDB的结构。