1. Decompression logstash2.2.2 Backstage, enter the ETC directory, create logstash-simple.conf, add the following configuration, according to their own environment to modify
Input {
JDBC {
Jdbc_driver_library = "/usr/local/elasticsearch-2.2.1/mysqldriver/mysql-connector-java-5.1.30-bin.jar"
Jdbc_driver_class = "Com.mysql.jdbc.Driver"
jdbc_connection_string = "Jdbc:mysql://10.10.13.7:3306/carsrc?autoreconnect=true&usessl=false"
Jdbc_user = "Devuser"
Jdbc_password = "Devuser"
Schedule = "* * * * * *"
Jdbc_default_timezone = "Asia/shanghai"
statement = "SELECT * from Company_secondcar_source_order;"
}
}
Output {
Elasticsearch {
index = "CARSRC"
Document_type = "Secondcarsource"
document_id = "%{car_source_id}"
hosts = ["10.10.13.7:9200"]
}
}
2. Then execute
./logstash-f. /etc/logstash-simple.conf
This will import the data from the table into the Elasticsearch
Use logstash2.2.2 to import data from the MySQL database into the Elasticsearch