安装前面几篇文章,安装好mongo_connector后,进行文件从MongoDB到ES的备份,使用下面的命令操作:
<span style="font-size:14px;">mongo-connector -m localhost:27017 -t localhost:9200 -d elastic_doc_manager</span>
出现错误:
<span style="font-size:14px;"><pre name="code" class="html">No handlers could be found for logger "mongo_connector.util"
Traceback (most recent call last):
File "/usr/local/bin/mongo-connector", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/mongo_connector/util.py", line 85, in wrapped
func(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/mongo_connector/connector.py", line 1041, in main
conf.parse_args()
File "/usr/local/lib/python2.7/site-packages/mongo_connector/config.py", line 118, in parse_args
option, dict((k, values.get(k)) for k in option.cli_names))
File "/usr/local/lib/python2.7/site-packages/mongo_connector/connector.py", line 824, in apply_doc_managers
module = import_dm_by_name(dm['docManager'])
File "/usr/local/lib/python2.7/site-packages/mongo_connector/connector.py", line 814, in import_dm_by_name
"vailable doc managers." % full_name)
mongo_connector.errors.InvalidConfiguration: Could not import mongo_connector.doc_managers.elastic_doc_manager. </span>
<span style="font-size:14px;">It could be that this doc manager has been moved out of this project and is maintained elsewhere. </span>
<span style="font-size:14px;">Make sure that you have the doc manager installed alongside mongo-connector. Check the README for a list of available doc managers.
[iienet@slave1 site-packages]$</span>
根据说明,可能是elastic_doc_manager的问题,继续深入寻找原因
mongo_connector的安装位置是
<span style="font-size:14px;">[iienet@slave1 site-packages]$ ls
bson pysolr-3.4.0.dist-info
easy-install.pth pysolr.py
elastic_doc_manager-0.1.0.dist-info pysolr.pyc
elasticsearch README
elasticsearch-1.9.0.dist-info requests
gridfs requests-2.9.1.dist-info
mongo_connector setuptools-20.6.7-py2.7.egg
mongo_connector-2.3.dist-info setuptools.pth
pip-8.1.1-py2.7.egg urllib3
pymongo urllib3-1.15.dist-info
pymongo-3.2.2-py2.7.egg-info
[iienet@slave1 site-packages]$ pwd
/usr/local/lib/python2.7/site-packages
[iienet@slave1 site-packages]$ </span>
这是改正错误后的结果,出现错误前,里面并没有es的信息
继续查找elastic_doc_manager的相关信息
地址是
https://pypi.python.org/pypi/elastic-doc-manager#downloads
发现它需要安装
<span style="font-size:14px;">pip install elastic-doc-manager</span>