Elasticsearch中使用reiver-jdbc導(dǎo)入數(shù)據(jù)
來(lái)源:易賢網(wǎng) 閱讀:7699 次 日期:2014-12-04 14:58:03
溫馨提示:易賢網(wǎng)小編為您整理了“Elasticsearch中使用reiver-jdbc導(dǎo)入數(shù)據(jù)”,方便廣大網(wǎng)友查閱!

Elastisearch中提供了river模塊來(lái)從其他數(shù)據(jù)源中獲取數(shù)據(jù),該項(xiàng)功能以插件的形式存在,目前已有的river插件包括:

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)

可以看出,已經(jīng)覆蓋了大部分的數(shù)據(jù)源,特別是針對(duì)關(guān)系型數(shù)據(jù)庫(kù)提供了統(tǒng)一的jdbc-river來(lái)進(jìn)行數(shù)據(jù)操作。

elasticsearch-river-jdbc的源碼在:github.com/jprante/elasticsearch-river-jdbc,該項(xiàng)目提供了詳細(xì)的文檔,下面以SQL Server為例簡(jiǎn)單說(shuō)明使用方法。

首先,需要安裝elasticsearch-river-jdbc,在elasticsearch目錄下執(zhí)行:

./bin/plugin --install jdbc --url xbib.org/repository/org/xbib/elasticsearch/plugin/elasticsearch-river-jdbc/1.1.0.1/elasticsearch-river-jdbc-1.1.0.1-plugin.zip

然后,安裝SQLServer的JDBC庫(kù),鏈接為: Microsoft JDBC Driver.把其中的 'sqljdbc4.jar'復(fù)制到elasticsearch安裝目錄的lib文件夾下。

考慮到elasticsearch集群,以上兩個(gè)步驟在每個(gè)節(jié)點(diǎn)上都需要執(zhí)行。

最后也是最關(guān)鍵的一步,在elasticsearch中建立river,讓elasticsearch自動(dòng)從SQLServer中獲取數(shù)據(jù)。

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":"10m",

"strategy" : "simple",

"index" : "myinventory",

"type" : "product",

"bulk_size" : 100,

"max_retries": 5,

"max_retries_wait":"30s",

"max_bulk_requests" : 5,

"bulk_flush_interval" : "5s"

}

}

更多信息請(qǐng)查看IT技術(shù)專(zhuān)欄

更多信息請(qǐng)查看數(shù)據(jù)庫(kù)
易賢網(wǎng)手機(jī)網(wǎng)站地址:Elasticsearch中使用reiver-jdbc導(dǎo)入數(shù)據(jù)
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門(mén)公布的正式信息和咨詢?yōu)闇?zhǔn)!

2025國(guó)考·省考課程試聽(tīng)報(bào)名

  • 報(bào)班類(lèi)型
  • 姓名
  • 手機(jī)號(hào)
  • 驗(yàn)證碼
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢 | 簡(jiǎn)要咨詢須知 | 加入群交流 | 手機(jī)站點(diǎn) | 投訴建議
工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
云南網(wǎng)警備案專(zhuān)用圖標(biāo)
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
咨詢QQ:526150442(9:00—18:00)版權(quán)所有:易賢網(wǎng)
云南網(wǎng)警報(bào)警專(zhuān)用圖標(biāo)