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 这个字段 但是无法创建两个索引和同步
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 这个字段 但是无法创建两个索引和同步
1 个回复
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必须是待查询的数据表的序列字段
}
}
}