admxj
11/18/2019 - 6:02 PM

mysql 同步es

mysql 同步es

input{
    jdbc{
        jdbc_driver_library => "/Volumes/Data/logstash-6.3.2/mysql-connector-java-5.1.37.jar"
        jdbc_driver_class => "com.mysql.jdbc.Driver"
        jdbc_connection_string => "jdbc:mysql://127.0.0.1:3306/blog"
        jdbc_user => "root"
        jdbc_password => "123456"
        schedule => "* * * * *"
        clean_run => true
        statement => "select * FROM t_blog WHERE update_time > :sql_last_value AND update_time < NOW() ORDER BY update_time desc"
    }
}

output {
    elasticsearch{
        hosts => ["127.0.0.1:9200"]
        index => "blog"
        document_id => "%{id}"
    }
}