• logstash-input-jdbc 同时同步多个表的情况


    input {
        jdbc {
          jdbc_connection_string => "jdbc:mysql://localhost:3306/crm?zeroDateTimeBehavior=convertToNull"
          jdbc_user => "root"
          jdbc_password => ""
          jdbc_driver_library => "D:/siyang/elasticsearch-5.2.2/logstash-5.2.2/mysql-connector-java-5.1.30.jar"
          jdbc_driver_class => "com.mysql.jdbc.Driver"
          jdbc_paging_enabled => "true"
          jdbc_page_size => "50000"
          statement_filepath => "filename.sql"
          schedule => "* * * * *"
          type => "jdbc_office"
        }
        jdbc {
          jdbc_connection_string => "jdbc:mysql://localhost:3306/crm?zeroDateTimeBehavior=convertToNull"
          jdbc_user => "root"
          jdbc_password => "" 
          jdbc_driver_library => "D:/siyang/elasticsearch-5.2.2/logstash-5.2.2/mysql-connector-java-5.1.30.jar"
          jdbc_driver_class => "com.mysql.jdbc.Driver"
          jdbc_paging_enabled => "true"
          jdbc_page_size => "50000"
          statement => "SELECT * from sys_user"
          schedule => "* * * * *"
          type => "jdbc_user"
        }
    }
    output {
     stdout {
            codec => json_lines
        }
        if[type] == "jdbc_office"{
            elasticsearch {
            hosts  => "localhost:9200"
            index => "contacts4"
            document_type => "office1"
            document_id => "%{id}"
            }
        }
        if[type] == "jdbc_user"{
            elasticsearch {
            hosts  => "localhost:9200"
            index => "contacts4"
            document_type => "user1"
            document_id => "%{id}"
            }
        }
    }

    注意事项,数据库里面的字段不要用type,如果有,as成其他的名字,不然的话,这里判断会有异常

  • 相关阅读:
    C#聊天+五子棋
    分页
    用户自定义控件(.ascx)
    一、Text To Speech
    验证码
    白话学习MVC(三)页面周期二
    二、Speech To Text
    微软云体验营 北京站 ,4月27日免费开营啦!名额有限速速报名!
    Windows 8 页面应用测试(2)
    《Windows 8应用开发权威指南》图书开始在网络上预售
  • 原文地址:https://www.cnblogs.com/tu6ge/p/7843510.html
Copyright © 2020-2023  润新知