mysql 增量导入到elasticsearch

来源:互联网 发布:网络机顶盒ir接口 编辑:程序博客网 时间:2024/06/06 09:49
<pre name="code" class="html">zjtest7-redis:/odbc_es# cat /odbc_es/run_mysql.sh. ~/.bash_profilecd /root/checkv_date=`date +%Y-%m-%d '--date=1 days ago'`echo $v_datesed -i s/v_date/$v_date/g mysql_import_es.shsh ./mysql_import_es.shcp -r -f .mysql_import_es.sh mysql_import_es.shzjtest7-redis:/odbc_es# cat mysql_import_es.sh. ~/.bash_profilebin=/usr/local/elasticsearch-jdbc-2.3.4.0/binlib=/usr/local/elasticsearch-jdbc-2.3.4.0/libecho '{    "elasticsearch.autodiscover":true,     "elasticsearch.cluster":"es_cluster",    "type" : "jdbc",    "jdbc" : {        "url" : "jdbc:mysql://192.168.32.218:3306/zjzc",        "user" : "root",        "password" : "1234567",        "sql" : "select * from Client  where registerTime>=\"v_date 00:00:00\" and registerTime<=\"v_date 23:59:59\"",       "elasticsearch" : {             "cluster" : "es_cluster",             "host" : "192.168.32.80",             "port" : 9300        },      "index" : "logstash-client-v_date",         "type" : "Client"    }}' | java \       -cp "${lib}/*" \       -Dlog4j.configurationFile=${bin}/log4j2.xml \       org.xbib.tools.Runner \       org.xbib.tools.JDBCImporterzjtest7-redis:/odbc_es# cat ~/.bashrc # .bashrc# User specific aliases and functionsalias rm='rm -i'#alias cp='cp -i'alias mv='mv -i'# Source global definitionsif [ -f /etc/bashrc ]; then. /etc/bashrcfi


                                             
0 0
原创粉丝点击