Mongo连接器的Solr插件

solr-doc-manager的Python项目详细描述


开始

安装

此包是mongo-connector的文档管理器。

最简单的方法是同时安装solr doc manager 作为Mongo连接器,pip

pip install mongo-connector[solr]

如果您已经安装了Mongo连接器,请通过:

pip install solr-doc-manager

您还可以安装solr doc manager的开发版本 手动:

git clone https://github.com/mongodb-labs/solr-doc-manager
cd solr-doc-manager
python setup.py install

您可能必须使用sudo运行python setup.py install,具体取决于 安装Mongo连接器的位置以及您拥有的特权。

有关使用solr运行mongo连接器的信息,请参见https://github.com/mongodb-labs/mongo-connector/wiki/Usage%20with%20Solr

注意

请注意,在Mongo连接器版本2.5.0之前,Solr文档管理器与Mongo连接器一起打包。

运行测试

要求

  1. solr doc manager github存储库的副本

The tests are not included in the package from PyPI and can only be acquired by cloning this repository on Github:

git clone https://github.com/mongodb-labs/solr-doc-manager
  1. solr

The integration tests require Solr to be running. To set up and run Solr:

curl -O http://archive.apache.org/dist/lucene/solr/4.9.1/solr-4.9.1.tgz
tar -zxf solr-4.9.1.tgz
cp mongo_connector/doc_managers/schema.xml solr-4.9.1/example/solr/collection1/conf/
cd solr-4.9.1/example/ && java -Djetty.port=8983 -Dsolr.solr.home=solr -jar start.jar > /dev/null 2>&1 &

Solr will be running on http://localhost:8983/solr

  1. Mongo编排

Mongo Connector runs MongoDB on its own using another tool called Mongo Orchestration. This package should install automatically if you run ^{tt3}$, but the Mongo Orchestration server still needs to be started manually before running the tests:

mongo-orchestration --bind 127.0.0.1 --config orchestration.config start

will start the server. To stop it:

mongo-orchestration --bind 127.0.0.1 --config orchestration.config stop

The location of the MongoDB server should be set in orchestration.config. For more information on how to use Mongo Orchestration, or how to use it with different arguments, please look at the Mongo-Orchestration README.

  1. 环境变量

There are a few influential environment variables that affect the tests. These are:

  • ^{tt4}$ is the username to use if running the tests with authentication enabled.
  • ^{tt5}$ is the password for the above.
  • ^{tt6}$ is the starting port for running MongoDB. Future nodes will be started on sequentially increasing ports.
  • ^{tt7}$ is the address on which Solr is running.
  • ^{tt8}$ is the address to use for Mongo Orchestration (i.e. hostname:port)

所有测试都位于tests目录中。

在命令行上运行测试

虽然测试会自行设置和拆除MongoDB集群,但在进行完整的测试运行之前,请确保启动Solr!

您可以使用一个命令运行所有测试(这在所有受支持的python版本中都有效):

python setup.py test

此外,您还可以选择运行哪些测试(仅限python>;2.6)!例如,如果您只想运行solr doc manager测试:

python -m unittest tests.test_solr_doc_manager

错误消息

有些测试旨在生成大量ERROR级别的日志消息,特别是回滚测试。mongo connector记录在oplog中迭代光标时遇到的异常,因此我们在mongodb集群在测试中被分离时在控制台输出中看到这些异常。只要所有的测试都通过,并且有一条消息,一切都很好。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java LineNumberReader。如果查询行为不正确,则返回readLine()   java包含了一个使用AndroidX的工具栏,这让我的应用程序崩溃了   JVM设置通过“java jar”运行应用程序的最佳实践   java如何获取ImageButton宽度   java Oracle SQLLDR实用程序无响应   列出Java获取对象的arrayList中最常见的元素   java使用带有FlowLayout的getContentpane对布局应用更改,但不起作用为什么?   在java中,我可以在画布上绘制画布吗?   编译游戏代码时发生java异常错误   从firestore获取java Webview失败   java将TableLayout中单元格的内容向右对齐   java无法在发布模式下启动活动(使用proguard安卓optimize配置)   java允许在线程期间进行GUI更新。睡觉   java如何对以变量为列表的列表进行排序   API URL上的java Google云端点异常