Use reiver-jdbc to import data in Elasticsearch

Source: Internet
Author: User

Elastisearch provides the river module to obtain data from other data sources. This function exists as a plug-in. The existing river plug-ins include:

River pluginsedit

1. Supported by Elasticsearch

CouchDB River Plugin

RabbitMQ River Plugin

Twitter River Plugin

Wikipedia River Plugin

2. Supported by the community

ActiveMQ River Plugin (by Dominik Dorn)

Amazon SQS River Plugin (by Alex Bogdanovski)

CSV River Plugin (by Martin Bednar)

Dropbox River Plugin (by David Pilato)

FileSystem River Plugin (by David Pilato)

Git River Plugin (by Olivier Bazoud)

GitHub River Plugin (by uberVU)

Hazelcast River Plugin (by Steve Samuel)

JDBC River Plugin (by J? Rg Prante)

JMS River Plugin (by Steve Sarandos)

Kafka River Plugin (by Endgame Inc .)

LDAP River Plugin (by Tanguy Leroux)

MongoDB River Plugin (by Richard Louapre)

Neo4j River Plugin (by Steve Samuel)

Open Archives Initiative (OAI) River Plugin (by J? Rg Prante)

Redis River Plugin (by Steve Samuel)

RSS River Plugin (by David Pilato)

Sofa River Plugin (by adamlofts)

Solr River Plugin (by Luca Cavanna)

St9 River Plugin (by Sunny Gleason)

Subversion River Plugin (by Pascal Lombard)

DynamoDB River Plugin (by Kevin Wang)

It can be seen that most data sources have been covered, especially relational databases that provide unified jdbc-river for data operations.

The source code of elasticsearch-river-jdbc is: github.com/jprante/elasticsearch-river-jdbc. this project provides detailed documents. The following uses SQL Server as an example to describe how to use it.

First, install elasticsearch-river-jdbc and run the following command in the elasticsearch directory:

./Bin/plugin -- install jdbc -- url Scheme

Then, install the JDBC library of SQLServer. The link is Microsoft JDBC Driver. Copy 'sqljdbc4. jar' to the lib folder in the installation directory of elasticsearch.

Considering the elasticsearch cluster, the preceding two steps must be performed on each node.

Last but not least, create a river in elasticsearch so that elasticsearch can automatically obtain data from SQLServer.

PUT/_ river/mytest_river/_ meta

{

"Type": "jdbc ",

"Jdbc ":{

"Driver": "com. microsoft. sqlserver. jdbc. SQLServerDriver ",

"Url": "jdbc: sqlserver: // MYSQLSERVERNAME; databaseName = MYProductDatabase ",

"User": "admin", "password": "Password ",

"SQL": "select ProductID as _ id, CategoryID, ManufacturerID, MfName, ProductTitle, MfgPartNumber from MyProductsTable (nolock )",

"Poll": "10 m ",

"Strategy": "simple ",

"Index": "myinventory ",

"Type": "product ",

"Bulk_size": 100,

"Max_retries": 5,

"Max_retries_wait": "30 s ",

"Max_bulk_requests": 5,

"Bulk_flush_interval": "5 s"

}

}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.