Configure elasticsearch and river-mongodb plug-ins on windows, mongodbriver
Install ElasticSearch
1. Download The elasticsearch installation package. Https://www.elastic.co/downloads/elasticsearch
2. decompress the elasticsearch package to the installation directory. For example, D: \ Elasticsearch, and add D: \ Elasticsearch \ bin to the System path
Install JDK
1. Download JDK. The lowest version is jdk update u55. Http://www.oracle.com/technetwork/java/javase/overview/index.html
2. Configure the JAVA_HOME environment variable. Point to the JDK installation directory, such as D: \ Java \ jdk \
Install maven
1. Download the maven installation package. Http://maven.apache.org/download.cgi
2. decompress the maven package to the installation directory. For example, D: \ Maven, and add D: \ Maven \ bin to the System path
3. Configure the maven local storage location. Open D: \ Maven \ Config \ setting. xml and add <localRepository> D: \ Maven \ m2 \ repository </localRepository>
Note: (1) Step 3 can be skipped; (2) if you do not want to install the river-mongodb plug-in from the source code, you do not need to install maven
Install the river-mongodb plug-in
1. download the latest source code package for the elasticsearch-river-mongodb plug-in. Https://github.com/richardwilly98/elasticsearch-river-mongodb
2. decompress the source code package and compile it. Run the command line to enter the elasticsearch-river-mongodb-master Directory, and run the command mvn package-Dmaven. test. skip = true.
3. The compilation process is slow and you need to wait patiently. The compiled plug-in is stored in the elasticsearch-river-mongodb-master \ target \ releasesdirectory. The file name is like elasticsearch-river-mongodb-2.0.6-snapshot.zip.
4. Install the compilation plug-in. Decompress the package directly to the plugins \ river-mongodb directory under the elasticsearch installation directory, or run the command plugin-I river-mongodb-u file:/E: \ Documents \ programming \ ElasticSearch \ install \ elasticsearch-river-mongodb-master \ target \ releases \ elasticsearch-river-mongodb-2.0.6-SNAPSHOT.zip
Note: If you do not want to install the river-mongodb plug-in from the source code, you can directly run plugin-I com. github. Richard willy98.elasticsearch/elasticsearch-river-mongodb/2.0.6 on the command line (here 2.0.6 is the version number)
Install curl
1. Download the curl tool. Http://curl.haxx.se/dlwiz? Type = bin
2. Just install it in a silly way.
Configure mongodb river
1. Download the curl tool. Http://curl.haxx.se/dlwiz? Type = bin1. run elasticsearch. Run bin \ elasticsearch. bat in the elasticsearch installation directory.
2. Run curl-XPUT "http: // 127.0.0.1: 9200/_ river/icssa/_ meta? Pretty "-d" {\ "type \": \ "mongodb \", \ "mongodb \": {\ "host \": \ "127.0.0.1 \", \ "port \": \ "27017 \", \ "credentials \": [{\ "db \": \ "admin \", \ "user \": \ "admin \", \ "password \": \ "12345 \"}], \ "db \": \ "icssa \", \ "collection \": \ "equipment \" },\ "index \": {\ "name \": \ "icssa \", \ "type \": \ "equipment \"}}"
Note: (1) mongodb must be configured as a replication cluster; (2) Change the port of the mongodb routing process (mongos) to 27017; (3) you must configure the mongodb username and password (if any). Otherwise, elasticsearch will save the following error: com. mongodb. except exception: can't use 'local' database through mongos
View synchronization results
1. Open http: // localhost: 9200/_ plugin/head/in the browser, provided that you have installed the head plug-in for elasticsearch
2. The synchronization result is shown as follows:
Note:
Elasticsearch, river-mongodb plug-in, and mongodb versions must match