torlee 发表于 2018-10-5 14:45:35

mysql准实时同步数据到Elasticsearch

input{  jdbc {
  jdbc_driver_library => "mysql-connector-java-5.1.44-bin.jar"
  jdbc_driver_class => "com.mysql.jdbc.Driver"
  jdbc_connection_string => "jdbc:mysql://rm-***.mysql.rds.aliyuncs.com:3306/db_name"
  jdbc_user => "db_user"
  jdbc_password => "db_password"
  jdbc_paging_enabled => "true"
  jdbc_page_size => "1000"
  jdbc_default_timezone =>"Asia/Shanghai"
  schedule => "* * * * *"
  statement => "select * from jm_es_employee where updatetime > :sql_last_value"
  use_column_value => true
  tracking_column => "updatetime"
  last_run_metadata_path => "./logstash_jdbc_last_run"
  }
  }
  output{
  elasticsearch {
  hosts => "es-cn-***.elasticsearch.aliyuncs.com:9200"
  user => "elastic"
  password => "es_password"
  index => "employee"
  document_id => "%{id}"
  }
  stdout {
  codec => json_lines
  }
  }

页: [1]
查看完整版本: mysql准实时同步数据到Elasticsearch