【发布时间】:2017-02-24 09:06:34
【问题描述】:
我在 mysql 上有 3 个表。
并将数据索引到elasticsearch。
它在下面工作。(logstash 配置)
input {
jdbc {
jdbc_driver_library => "lib/mysql-connector-java-5.1.33.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://localhost:3306/test"
jdbc_user => "test"
jdbc_password => "test"
statement => "SELECT * FROM TABLE1"
schedule => "* * * * *"
type => "table1"
}
//
// two more inputs
//
}
output {
stdout {codec => rubydebug}
if [type] == "table1" {
elasticsearch {
hosts => ["localhost:9200"]
index => "test"
document_type => "%{type}"
document_id => "%{id}"
template => "./template"
template_overwrite => true
}
}
//
// two more outputs
//
}
我删除了另外两个输入和输出,从 mysql 上的 TABLE1 中删除了一些行。
并启动了logstash。
它没有更新。
所以,输入
curl -XDELETE 'http://localhost:9200/*'
然后再次重新启动logstash。
但是在 elasticsearch 上再次添加了三个具有相同行的表。
如何自动更新elasticsearch数据?
【问题讨论】:
标签: mysql elasticsearch logstash