通过kibana将数据从mysql导入到Elastic Search
警告-忽略“pipelines.yml”文件,因为指定了模块或命令行选项
和
管道已终止{:pipeline_id =>“main”,:thread =>“#”}
和我的conf
input {
jdbc {
jdbc_driver_library => "mysql-connector-java-5.1.46-bin.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://localhost:3306/test"
jdbc_user => "root"
jdbc_password => "***"
statement => "SELECT * from Test"
}
}
output{
stdout { codec => json_lines }
elasticsearch {
"hosts" => "localhost:9200"
"index" => "test-migrate"
"document_type" => "data"
}
}
有什么解决办法吗?
最佳答案
默认情况下,如果在不使用计划的情况下运行单个查询,则处理查询后,logstash管道将终止。
您需要在jdbc
输入中启用"dispatch"以定期运行它,如下所示,
input {
jdbc {
jdbc_driver_library => "mysql-connector-java-5.1.46-bin.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://localhost:3306/test"
schedule => "0 * * * *"
jdbc_user => "root"
jdbc_password => "***"
statement => "SELECT * from Test"
}
}
这将在每天每小时的第0分钟上执行查询。
schedule的语法与cron类似。请查看here以获取语法和更多详细信息。
关于elasticsearch - 从mysql导入数据错误-管道已终止,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50655931/