hi, everybody.
i have used logstash for collecting the data of mysql.
the data of mysql have several tables, and i created config files like below.
tb_a.config
input {
jdbc {
jdbc_driver_library => "lib/mysql-connector-java-5.1.33.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://127.0.0.1:59000/DB"
jdbc_user => "user"
jdbc_password => "pass"
statement => " SELECT * FROM TABLE_A "
schedule => "* * * * *"
}
}
output {
elasticsearch {
hosts => ["127.0.0.1:9200"]
index => "table_a"
document_type => "a"
document_id => "%{a_seq}"
}
}
tb_b.config
input {
jdbc {
jdbc_driver_library => "lib/mysql-connector-java-5.1.33.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://127.0.0.1:59000/DB"
jdbc_user => "user"
jdbc_password => "pass"
statement => " SELECT * FROM TABLE_B "
schedule => "* * * * *"
}
}
output {
elasticsearch {
hosts => ["127.0.0.1:9200"]
index => "table_b"
document_type => "b"
document_id => "%{b_seq}"
}
}
and i runned logstash by below command.
logstash -f ../conf/tb_a.config &
logstash -f ../conf/tb_b.config &
but it was not good. if i need more collecting other table data, i will add config file.
recently, i saw this reply - http://stackoverflow.com/questions/37613611/multiple-inputs-on-logstash-jdbc
there was multi input. i look good that than mine.
My question, what's better multi config file or multi input. in my case, the table collected by logstash may be added.
sorry, low english.
thanks a lot.