使用 nohup 或 disown 如果你要让某个进程运行在后台。

logstash 同步多个mysql时 配置文件document_id参数能相同么?

Logstash | 作者 wjx1015 | 发布于2018年01月05日 | 阅读数:7457

output {
    stdout {
        codec => json_lines
    }
    if [type] == "jdbc" {
    elasticsearch {
        hosts  => "192.168.126.130:9200"
        index => "course-1" #索引名称
        document_type => "form" #type名称
        document_id => "%{id}" #id必须是待查询的数据表的序列字段
    }
    }
    if [type] == "jdbc2" {
    elasticsearch {
        hosts  => "192.168.126.130:9200"
        index => "course-2" #索引名称
        document_type => "form2" #type名称
        document_id => "%{id}" #id必须是待查询的数据表的序列字段
    }
    }
}
两个document_id 能相同么?  因为两个表都是id 这个字段    但是无法创建两个索引和同步
已邀请:

wjx1015

赞同来自:

具体配置如下:(启动同步没有报错信息,也显示同步  但是没有创建两个索引)
input {
    stdin {
    }
    jdbc {

      jdbc_connection_string => "jdbc:mysql://192.168.1.114:3306/edu6_xyw"
      jdbc_user => "root"
      jdbc_password => "root@khcm0635"
      jdbc_driver_library => "/usr/local/logstash-6.1.0/mysql-connector-java-5.1.45.jar"
      jdbc_driver_class => "com.mysql.jdbc.Driver"
      jdbc_paging_enabled => "true"
      jdbc_page_size => "100000"
      statement_filepath => "/usr/local/logstash-6.1.0/course.sql"
      schedule => "* * * * *"
      type => "jdbc"
    }

   jdbc {
      jdbc_connection_string => "jdbc:mysql://192.168.1.114:3306/xueyuanwang_shop"
      jdbc_user => "root"
      jdbc_password => "root@khcm0635"
      jdbc_driver_library => "/usr/local/logstash-6.1.0/mysql-connector-java-5.1.45.jar"
      jdbc_driver_class => "com.mysql.jdbc.Driver"
      jdbc_paging_enabled => "true"
      jdbc_page_size => "100000"
      statement_filepath => "/usr/local/logstash-6.1.0/ecm_bank.sql"
      schedule => "* * * * *"
      type => "jdbc2"
    }

}
output {
    stdout {
        codec => json_lines
    }
    if [type] == "jdbc" {
    elasticsearch {
        hosts  => "192.168.126.130:9200"
        index => "course-1" #索引名称
        document_type => "form" #type名称
        document_id => "%{id}" #id必须是待查询的数据表的序列字段
    }
    }
    if [type] == "jdbc2" {
    elasticsearch {
        hosts  => "192.168.126.130:9200"
        index => "course-2" #索引名称
        document_type => "form2" #type名称
        document_id => "%{bid}" #id必须是待查询的数据表的序列字段
    }
    }
}
 

要回复问题请先登录注册