Use logstash2.2.2 to import data from the MySQL database into the Elasticsearch

Source: Internet
Author: User
Tags logstash

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.