我通过easy_install脚本安装了python、pymongo,并厌倦了easy_install mongo-connector命令。但是安装后我在python目录中找不到mongo_connector.py?安装 mongo-connector 有什么问题吗?
然后我厌倦了下载的 mongodb-connector.tar.gz 的 python setup.py install 并安装了包。
PS C:\Python33> python C:\Python33\Lib\site-packages\mongo-connector\mongo_connector.py -m localhost:27017 -t http://loc
alhost:8080/solr
2014-01-23 16:52:55,596 - INFO - Beginning Mongo Connector
2014-01-23 16:52:55,596 - INFO - No doc manager specified, using simulator.
2014-01-23 16:52:56,596 - CRITICAL - MongoC`onnector: Can't find OplogProgress file!
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Python33\lib\threading.py", line 901, in _bootstrap_inner
self.run()
File "C:\Python33\Lib\site-packages\mongo-connector\mongo_connector.py", line 204, in run
repl_set = prim_admin.command("replSetGetStatus")['set']
File "C:\Python33\lib\site-packages\pymongo-2.6.3-py3.3-win-amd64.egg\pymongo\database.py", line 396, in command
msg, allowable_errors)
File "C:\Python33\lib\site-packages\pymongo-2.6.3-py3.3-win-amd64.egg\pymongo\helpers.py", line 147, in _check_command
_response
raise OperationFailure(msg % errmsg, code)
pymongo.errors.OperationFailure: command SON([('replSetGetStatus', 1)]) failed: not running with --replSet
但是连接器不起作用,有人在 Windows 上使用过 mongo-connector 吗?
最佳答案
您需要运行副本集而不是独立的 mongod 才能使 mongo-connector 工作,如自述文件中所述:https://github.com/10gen-labs/mongo-connector/blob/master/README.markdown
这样做的原因是 mongo 连接器依赖于允许副本集相互复制的系统(错误中提到的 Oplog
)以复制您的数据。如果您只是在单台机器上尝试这个,仍然可以通过在同一台机器上启动多个进程来配置副本集。请参阅此处的文档:http://docs.mongodb.org/manual/tutorial/deploy-replica-set/
关于python - 在 Windows 上安装 mongo-connector,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21312403/