您的位置:首页 > 运维架构 > Shell

php 执行 shell 命令 更新 mysql 到 es

2016-08-04 15:54 609 查看
#!/bin/sh

# DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# bin=${DIR}/../bin

# lib=${DIR}/../lib

bin=$JDBC_IMPORTER_HOME/bin

lib=$JDBC_IMPORTER_HOME/lib

# echo $lib

num=$1

echo '

{

    "type" : "jdbc",

    "jdbc" : {

        "url" : "jdbc:mysql://127.0.0.1:3306/adbug",

        "user" : "root",

        "password" : "",

        "sql" : [ { 

          "statement" : "select *,id as _id from users where id>?", 

          "parameter" : '${num}'

        } ],

        "index" : "users",

        "type" : "user_index",

        "index_settings" : {

            "index" : {

                "number_of_shards" : 1

            }

        }

    }

}

' | java \

    -cp "${lib}/*" \

    -Dlog4j.configurationFile=${bin}/log4j2.xml \

    org.xbib.tools.Runner \

    org.xbib.tools.JDBCImporter
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: