elasticsearch-river-jdbc

来源:互联网 发布:淘宝少女屎 编辑:程序博客网 时间:2024/05/21 21:45

整理下elasticsearch-river-jdbc插件的用法,希望对大家有帮助。

环境:window + mysql 

首先从介绍安装开始

1.1:es version 0.20+ (使用0.20+以上版本的) 

cd D:\elasticsearch-0.20.5\bin

plugin -url http://bit.ly/Yp2Drj -install river-jdbc
1.2:es version  0.90.0 Beta1+ 
cd D:\elasticsearch-0.20.5\bin

plugin -url http://bit.ly/145e9Ly -install river-jdbc


经测试,以上命令无效。只有自己下载jar包 https://bintray.com/pkg/show/general/jprante/elasticsearch-plugins/elasticsearch-river-jdbc

2:放一个mysql-jdbc连接jar包到lib目录下

3:创建_river

http://localhost:9200/_river/my_jdbc_river/_meta

{"type": "jdbc",  "jdbc":{     "strategy":"simple",     "driver":"com.mysql.jdbc.Driver",    "url":"jdbc:mysql://localhost:3306/yb_kw",     "user":"",     "password":"",     "sql":"select * from sort",     "sqlparams":null,     "poll" : "1h",     "rounding" : null,     "scale" : 0,     "autocommit" : false,     "fetchsize" : 10,     "max_rows" : 0,     "max_retries" : 3,     "max_retries_wait":"10s",     "locale" : Locale.getDefault().toLanguageTag(),     "digesting" : true,     "acksql" : null,     "acksqlparams" : null        },  "index": {     "index" : "gindex",     "type" : "gindex",     "bulk_size" : 100,     "max_bulk_requests" : 30,     "index_settings" : null,     "type_mapping" : null,     "versioning" : false,     "acknowledge" : false   }}


本文出自:https://github.com/jprante/elasticsearch-river-jdbc/wiki/JDBC-River-parameters

待续……

原创粉丝点击