https://github.com/jPRante/elasticsearch-jdbc/
# elastic_search_learninghow to use elastic search# 安装elasticserach-jdbc做增量同步wget http://xbib.org/repository/org/xbib/elasticsearch/importer/elasticsearch-jdbc/<version>/elasticsearch-jdbc-<version>-dist.zip* version=2.3.4.0unzip elasticsearch-jdbc-<version>-dist.zipcd elasticsearch-jdbc-<version>cd bintest.sh:bin=/Users/jesusslim/Downloads/elasticsearch-jdbc-2.3.4.0/binlib=/Users/jesusslim/Downloads/elasticsearch-jdbc-2.3.4.0/libecho '{ "type" : "jdbc", "statefile" : "statefile.json", "jdbc": { "url" : "jdbc:MySQL://ip:port/db_name?user=test&passWord=password", "user" : "test", "password" : "password", "type" : "allocate_record", "index": "crm", "schedule" : "0 * * * * ?", "metrics" : { "enabled" : true }, "sql" : [ { "statement" : "select id as _id,id,last_remark_time,last_remark from ebk_allocate_record where adv_group = 1 and last_remark_time > UNIX_TIMESTAMP(?)", "parameter" : [ "$metrics.lastexecutionstart" ] } ] }}' | java / -cp "${lib}/*" / -Dlog4j.configurationFile=${bin}/log4j2.xml / org.xbib.tools.Runner / org.xbib.tools.JDBCImporter
需要java v1.8
其他配置如外网访问等需配置elasticsearch/config/的yml
新闻热点
疑难解答