新人求助:logstash获取mysql数据,插入elasticsearch后,会把索引中原有的数据删除,只留最新的一条
Logstash | 作者 hyf3119641 | 发布于2017年09月06日 | 阅读数:3056
logstash的配置文件如下:
input {
jdbc {
jdbc_driver_library => "/root/mysql-connector-java.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://127.0.0.1:3306/james?characterEncoding=utf8&useSSL=false"
jdbc_user => "app"
jdbc_password => "app"
jdbc_paging_enabled => "true"
jdbc_page_size => "50000"
statement => "select * from JAMES_MAIL"
schedule => "* * * * *"
type => "nametype"
}
}
output {
elasticsearch {
hosts => "192.168.5.128:9200"
index => "mysql_es-%{+YYYY.MM.dd}"
document_id => "%{id}"
# user => elastic
# password => changeme
}
stdout {
codec => json_lines
}
}
input {
jdbc {
jdbc_driver_library => "/root/mysql-connector-java.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://127.0.0.1:3306/james?characterEncoding=utf8&useSSL=false"
jdbc_user => "app"
jdbc_password => "app"
jdbc_paging_enabled => "true"
jdbc_page_size => "50000"
statement => "select * from JAMES_MAIL"
schedule => "* * * * *"
type => "nametype"
}
}
output {
elasticsearch {
hosts => "192.168.5.128:9200"
index => "mysql_es-%{+YYYY.MM.dd}"
document_id => "%{id}"
# user => elastic
# password => changeme
}
stdout {
codec => json_lines
}
}
1 个回复
novia - 1&0
赞同来自: hyf3119641