Get the App
SLTechnology News&Howtos  ›  Database  › 

Mongo-connector integrates MongoDB to Solr to realize incremental indexing

Shulou Source: shulou.com Published: 2022-06-01 12:03:19 09月29日 Update

Mongo-connector Integration MongoDB to Solr for Incremental Indexing

Configuring MongoDB Replication Sets

Reference: Deploying a Replication Set for Testing and Development

Install Solr 5.3

Reference: Installing Solr5.3 under CentOS

Install Python 2.7

Install Python 2.7 on CentOS

install pip

Reference: Installing pip under CentOS

Install mongo-connector

Method 1: Install using pip

pip install mongo-connector

Installed in Python's default package directory:

/usr/local/lib/python2.7/site-packages

Method 2: Install as a Service

1. Go to https://github.com/mongodb-labs/mongo-connector/archive/master.zip and download mongo-connector-master.zip.

2. Unzip into directory.

unzip mongo-connector-master.zipcd mongo-connector-master

3. Edit configuration files.

vi config.json

4. Installed as a service.

python setup.py install_service

Create the mongo-connector service in/etc/init.d and copy the config.json file to/etc/mongo-connector.json.

Uninstall mongo-connector service

python setup.py uninstall_service

It removes/etc/init.d/mongo-connector and/etc/mongo-connector.json

View Service Status

service mongo-connector status

Configure Solr

The Solr configuration file solr.xml is located at/data/solr/data/.

Creating core

su - solr -c "/usr/local/solr/solr/bin/solr create -c card -n data_driven_schema_configs"

The folder/data/solr/data/card is generated. Under the directory/data/solr/data/card/conf is the configuration directory of card. Synonyms and stop words can be configured.

Configure solrconfig.xml

1. Make sure LukeRequestHandler is enabled

The following line of applications appears in the solrconfig.xml file.

2. Configure hard commits (frequency of refresh to hard disk) and soft commits (frequency of commit to memory)

Configure and in the solrconfig.xml file

30000010000true100060000

Configure schema.xml

1. Mongo Connector stores metadata to help handle rollback in each document. To support this data, you need to add the following information to your schema.xml:

2. Configure configuration in schema.xml.

Start mongo-connector

Method 1: Start from the command line

nohup sudo mongo-connector -m localhost:27019 -t http://localhost:8983/solr/card -o oplog_progress.txt -n example.card -u _id -d solr_doc_manager > mongo-connector.out 2>&1

Method 2: Start with service

service mongo-connector start

Solr Delete all indexes

http://192.168.11.52:8983/solr/card/update/? stream.body=%3Cdelete%3E%3Cquery%3E*:*%3C/query%3E%3C/delete%3E&stream.contentType=text/xml;charset=utf-8&commit=true

Reference:

http://blog.mongodb.org/post/29127828146/introducing-mongo-connector

https://github.com/mongodb-labs/mongo-connector/wiki/Installation

https://github.com/mongodb-labs/mongo-connector/wiki/Usage-with-Solr

https://loutilities.wordpress.com/2012/11/26/complementing-mongodb-with-real-time-solr-search/

Tags: Configuration file service directory reference method data index frequency load increment next information memory synonym command copy folder document status Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Huawei MariaDB Apple Redmi