Logstash JDBC 输入插件:从 mysql 批量迁移数据

Logstash JDBC Input plugin : Migrate data from mysql in batch count

我有一个 table 的 20GB 数据,有 5000 万行。需要使用 logstash jdbc 输入插件迁移到 ElasticSearch。我已经尝试了所有基本实现,但在批量迁移数据时需要帮助,即一次只有 10,000 行。我不确定如何以及在何处指定此计数以及下次我如何更新它 运行 logstash。请帮我解决这个问题

这是我的:

input {
    jdbc {
        jdbc_driver_library => "mysql-connector-java-5.1.12-bin.jar"
        jdbc_driver_class => "com.mysql.jdbc.Driver"
        jdbc_connection_string => "jdbc:mysql://localhost/db"
        jdbc_validate_connection => true
        jdbc_user => "root"
        jdbc_password => "root"
        clean_run => true
        record_last_run => true
        use_column_value => true
        jdbc_paging_enabled => true
        jdbc_page_size => 5
        tracking_column => id
        statement => "select * from employee"
    }
}

提前致谢。

您需要将 jdbc_paging_enabled 设置为 true 才能使分页正常工作。

但是你还需要确保clean_run设置为false,否则分页将无法工作。