1

通过 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"
  }
}

有什么解决办法吗?

4

1 回答 1

1

默认情况下,如果您在不使用调度的情况下运行单个查询,则一旦处理完查询,logstash 管道将终止。您需要在jdbc输入中启用调度以定期运行它,如下所示,

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。请在此处查看语法和更多详细信息。

于 2018-06-05T02:00:52.913 回答